[wp-hackers] Seeing the Actual SQL statements WP is running when compiling the posts...

Haluk Karamete halukkaramete at gmail.com
Tue Dec 6 20:21:37 UTC 2011


>>  Call from: require, require_once, require_once, require_once,
                 WP->init, wp_get_current_user, get_currentuserinfo,
                 wp_validate_auth_cookie, get_userdatabylogin, get_user_by
this are the functions, class or methods, there call this sql statement.

Now Frank,

Does that mean that SQL statement has actually been called that many
times and from that many places in this particular instance?

Or does it mean that it could be possibly called from those places in the core?




On Tue, Dec 6, 2011 at 3:17 AM, Frank Bueltge <frank at bueltge.de> wrote:
> Its the description on wp.org Repo not enough for you for the plugin
> Debug Queries?
>
> For your example:
>   Time: 0.00058102607727051
> the period for this query in seconds
>
>   Query: SELECT * FROM wp_users WHERE user_login = 'admin'
> the SQL statement, an Select to all table fields in wp_users, if
> user_login is exact admin
>
>   Call from: require, require_once, require_once, require_once,
>                  WP->init, wp_get_current_user, get_currentuserinfo,
>                  wp_validate_auth_cookie, get_userdatabylogin, get_user_by
> this are the functions, class or methods, there call this sql statement.
>
> Ideas, Requirements for the plugin.
> Current i rewrite also an tool for other content stuff on development
> and debugging:
> please see the dev-version of Debug Objects:
> http://wordpress.org/extend/plugins/debug-objects/download/
>>>
> Best regards
>
>
>
> On Tue, Dec 6, 2011 at 10:07 AM, jackie sparks
> <jackie.craig.sparks at live.com> wrote:
>>
>> Right on thanks Frank!
>>
>>> Date: Mon, 5 Dec 2011 19:38:38 -0800
>>> From: icwordpress at gmail.com
>>> To: wp-hackers at lists.automattic.com
>>> Subject: Re: [wp-hackers] Seeing the Actual SQL statements WP is running when compiling the posts...
>>>
>>> Frank, I got your plug in. For a moment, I thought I would  need a
>>> German interpreter but that feeling faded away fast. Your plug in
>>> works right out of the box. Very educational..
>>>
>>> What's the call from list all about?
>>>
>>>     Time: 0.00058102607727051
>>>     Query: SELECT * FROM wp_users WHERE user_login = 'admin'
>>>     Call from: require, require_once, require_once, require_once,
>>> WP->init, wp_get_current_user, get_currentuserinfo,
>>> wp_validate_auth_cookie, get_userdatabylogin, get_user_by
>>>
>>>
>>>
>>> On Sat, Dec 3, 2011 at 12:00 AM, Frank Bueltge <frank at bueltge.de> wrote:
>>> > You can use the plugin Debug Queries, list all queries with full sql
>>> > statement on all pages.
>>> >
>>> > Sorry für die kurze Mail, vom Mobile gesendet.
>>> > Am 03.12.2011 07:41 schrieb "IC IC" <icwordpress at gmail.com>:
>>> >
>>> >> Is it theoretically possible to write a parser to run over all the
>>> >> core files and parse each and every function that belongs to the core?
>>> >>
>>> >> before parser
>>> >>
>>> >> function get_queried_object_id() {
>>> >>        global $wp_query;
>>> >>        return $wp_query->get_queried_object_id();
>>> >> }
>>> >>
>>> >>
>>> >> after parser
>>> >>
>>> >> function get_queried_object_id() {
>>> >>
>>> >>      $list_of_functions_that_have_run_so_far =
>>> >> $list_of_functions_that_have_run_so_far .   "get_queried_object_id()";
>>> >>      or even better
>>> >>      $list_of_functions_that_have_run_so_far =
>>> >> $list_of_functions_that_have_run_so_far .   "> wp-includes > query.php
>>> >> > get_queried_object_id()";
>>> >>
>>> >>
>>> >>        global $wp_query;
>>> >>        return $wp_query->get_queried_object_id();
>>> >> }
>>> >>
>>> >>
>>> >> would that work? or would there be some functions that would halt the
>>> >> execution because of this change therefore,  this is a mute exercise?
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> On Fri, Dec 2, 2011 at 10:07 PM, Dion Hulse (dd32) <wordpress at dd32.id.au>
>>> >> wrote:
>>> >> > On 3 December 2011 17:03, IC IC <icwordpress at gmail.com> wrote:
>>> >> >> That's very cool. Thank you..
>>> >> >>
>>> >> >> Along the same learning lines, how about printing the list of every
>>> >> >> single WP function that have run before it makes it to the template?
>>> >> >> And perhaps display that list in the post itself?
>>> >> >>
>>> >> >> Did somebody programmatically do that already?
>>> >> >>
>>> >> >> Obviously, this would be on a test site where it is OK and quite
>>> >> >> interesting to see all the actual run time list..
>>> >> >>
>>> >> >> BTW, is there a way in PHP to tell the functions to output their name
>>> >> >> programmatically?
>>> >> >>
>>> >> >> something like
>>> >> >>
>>> >> >> function xyx ()
>>> >> >> {
>>> >> >>  echo this.function.name;
>>> >> >> }
>>> >> >>
>>> >> >
>>> >> > There's a few php "dynamic" constants which refer directly to the
>>> >> > point in execution:
>>> >> > __FUNCTION__, __CLASS__, __FILE__, __LINE__
>>> >> >
>>> >> > I don't believe it's possible to get all the functions that have been
>>> >> > executed in PHP, however, you can easily output the name of each
>>> >> > hook(action, filter) as it's fired in WordPress with this code
>>> >> > snippet:
>>> >> >
>>> >> > add_action( 'all', function() { var_dump( current_filter() ); });
>>> >> >
>>> >> > That'll execute on every WordPress hook, allowing you to see where
>>> >> > each hook is fired.. Can be very useful to work it out.
>>> >> > _______________________________________________
>>> >> > wp-hackers mailing list
>>> >> > wp-hackers at lists.automattic.com
>>> >> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>>> >> _______________________________________________
>>> >> wp-hackers mailing list
>>> >> wp-hackers at lists.automattic.com
>>> >> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>> >>
>>> > _______________________________________________
>>> > wp-hackers mailing list
>>> > wp-hackers at lists.automattic.com
>>> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list