Zend_Db_Profiler-Firebug.xml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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><para>
  21. Firefox Browser ideally version 3 but version 2 is also supported.
  22. </para></listitem>
  23. <listitem> <para>
  24. Firebug Firefox Extension which you can download from <ulink
  25. url="https://addons.mozilla.org/en-US/firefox/addon/1843">https://addons.mozilla.org/en-US/firefox/addon/1843</ulink>.
  26. </para></listitem>
  27. <listitem><para>
  28. FirePHP Firefox Extension which you can download from <ulink
  29. url="https://addons.mozilla.org/en-US/firefox/addon/6149">https://addons.mozilla.org/en-US/firefox/addon/6149</ulink>.
  30. </para></listitem>
  31. </itemizedlist>
  32. <example id="zend.db.profiler.profilers.firebug.example.with_front_controller">
  33. <title>DB Profiling with Zend_Controller_Front</title>
  34. <programlisting language="php"><![CDATA[
  35. // In your bootstrap file
  36. $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
  37. $profiler->setEnabled(true);
  38. // Attach the profiler to your db adapter
  39. $db->setProfiler($profiler)
  40. // Dispatch your front controller
  41. // All DB queries in your model, view and controller
  42. // files will now be profiled and sent to Firebug
  43. ]]></programlisting>
  44. </example>
  45. <example id="zend.db.profiler.profilers.firebug.example.without_front_controller">
  46. <title>DB Profiling without Zend_Controller_Front</title>
  47. <programlisting language="php"><![CDATA[
  48. $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
  49. $profiler->setEnabled(true);
  50. // Attach the profiler to your db adapter
  51. $db->setProfiler($profiler)
  52. $request = new Zend_Controller_Request_Http();
  53. $response = new Zend_Controller_Response_Http();
  54. $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
  55. $channel->setRequest($request);
  56. $channel->setResponse($response);
  57. // Start output buffering
  58. ob_start();
  59. // Now you can run your DB queries to be profiled
  60. // Flush profiling data to browser
  61. $channel->flush();
  62. $response->sendHeaders();
  63. ]]></programlisting>
  64. </example>
  65. </sect3>
  66. <!--
  67. vim:se ts=4 sw=4 et:
  68. -->