Zend_Db_Profiler-Firebug.xml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect3 id="zend.db.profiler.profilers.firebug">
  4. <title>Profiling with Firebug</title>
  5. <para>
  6. <classname>Zend_Db_Profiler_Firebug</classname> sends profiling infomation to the
  7. <ulink url="http://www.getfirebug.com/">Firebug</ulink> <ulink
  8. url="http://getfirebug.com/logging.html">Console</ulink>.
  9. </para>
  10. <para>
  11. All data is sent via the <classname>Zend_Wildfire_Channel_HttpHeaders</classname>
  12. component which uses <acronym>HTTP</acronym> headers to ensure the page content is not
  13. disturbed. Debugging <acronym>AJAX</acronym> requests that require clean
  14. <acronym>JSON</acronym> and <acronym>XML</acronym> responses is possible with this approach.
  15. </para>
  16. <para>
  17. Requirements:
  18. </para>
  19. <itemizedlist>
  20. <listitem>
  21. <para>
  22. Firefox Browser ideally version 3 but version 2 is also supported.
  23. </para>
  24. </listitem>
  25. <listitem>
  26. <para>
  27. Firebug Firefox Extension which you can download from <ulink
  28. url="https://addons.mozilla.org/en-US/firefox/addon/1843">https://addons.mozilla.org/en-US/firefox/addon/1843</ulink>.
  29. </para>
  30. </listitem>
  31. <listitem>
  32. <para>
  33. FirePHP Firefox Extension which you can download from <ulink
  34. url="https://addons.mozilla.org/en-US/firefox/addon/6149">https://addons.mozilla.org/en-US/firefox/addon/6149</ulink>.
  35. </para>
  36. </listitem>
  37. </itemizedlist>
  38. <example id="zend.db.profiler.profilers.firebug.example.with_front_controller">
  39. <title>DB Profiling with Zend_Controller_Front</title>
  40. <programlisting language="php"><![CDATA[
  41. // In your bootstrap file
  42. $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
  43. $profiler->setEnabled(true);
  44. // Attach the profiler to your db adapter
  45. $db->setProfiler($profiler);
  46. // Dispatch your front controller
  47. // All DB queries in your model, view and controller
  48. // files will now be profiled and sent to Firebug
  49. ]]></programlisting>
  50. </example>
  51. <example id="zend.db.profiler.profilers.firebug.example.without_front_controller">
  52. <title>DB Profiling without Zend_Controller_Front</title>
  53. <programlisting language="php"><![CDATA[
  54. $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
  55. $profiler->setEnabled(true);
  56. // Attach the profiler to your db adapter
  57. $db->setProfiler($profiler);
  58. $request = new Zend_Controller_Request_Http();
  59. $response = new Zend_Controller_Response_Http();
  60. $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
  61. $channel->setRequest($request);
  62. $channel->setResponse($response);
  63. // Start output buffering
  64. ob_start();
  65. // Now you can run your DB queries to be profiled
  66. // Flush profiling data to browser
  67. $channel->flush();
  68. $response->sendHeaders();
  69. ]]></programlisting>
  70. </example>
  71. </sect3>
  72. <!--
  73. vim:se ts=4 sw=4 et:
  74. -->