File: Zend_Db_Profiler-Firebug.xml

package info (click to toggle)
zendframework 1.12.9%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 133,584 kB
  • sloc: xml: 1,311,829; php: 570,173; sh: 170; makefile: 125; sql: 121
file content (93 lines) | stat: -rw-r--r-- 3,032 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect3 id="zend.db.profiler.profilers.firebug">
    <title>Profiling with Firebug</title>

    <para>
        <classname>Zend_Db_Profiler_Firebug</classname> sends profiling infomation to the
        <ulink url="http://www.getfirebug.com/">Firebug</ulink> <ulink
            url="http://getfirebug.com/logging.html">Console</ulink>.
    </para>

    <para>
        All data is sent via the <classname>Zend_Wildfire_Channel_HttpHeaders</classname>
        component which uses <acronym>HTTP</acronym> headers to ensure the page content is not
        disturbed. Debugging <acronym>AJAX</acronym> requests that require clean
        <acronym>JSON</acronym> and <acronym>XML</acronym> responses is possible with this approach.
    </para>

    <para>
        Requirements:
    </para>

    <itemizedlist>
        <listitem>
            <para>
                Firefox Browser ideally version 3 but version 2 is also supported.
            </para>
        </listitem>

        <listitem>
            <para>
                Firebug Firefox Extension which you can download from <ulink
                    url="https://addons.mozilla.org/en-US/firefox/addon/1843">https://addons.mozilla.org/en-US/firefox/addon/1843</ulink>.
            </para>
        </listitem>

        <listitem>
            <para>
                FirePHP Firefox Extension which you can download from <ulink
                    url="https://addons.mozilla.org/en-US/firefox/addon/6149">https://addons.mozilla.org/en-US/firefox/addon/6149</ulink>.
            </para>
        </listitem>
    </itemizedlist>

    <example id="zend.db.profiler.profilers.firebug.example.with_front_controller">
        <title>DB Profiling with Zend_Controller_Front</title>

        <programlisting language="php"><![CDATA[
// In your bootstrap file

$profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
$profiler->setEnabled(true);

// Attach the profiler to your db adapter
$db->setProfiler($profiler);

// Dispatch your front controller

// All DB queries in your model, view and controller
// files will now be profiled and sent to Firebug
]]></programlisting>
    </example>

    <example id="zend.db.profiler.profilers.firebug.example.without_front_controller">
        <title>DB Profiling without Zend_Controller_Front</title>

        <programlisting language="php"><![CDATA[
$profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
$profiler->setEnabled(true);

// Attach the profiler to your db adapter
$db->setProfiler($profiler);

$request  = new Zend_Controller_Request_Http();
$response = new Zend_Controller_Response_Http();
$channel  = Zend_Wildfire_Channel_HttpHeaders::getInstance();
$channel->setRequest($request);
$channel->setResponse($response);

// Start output buffering
ob_start();

// Now you can run your DB queries to be profiled

// Flush profiling data to browser
$channel->flush();
$response->sendHeaders();
]]></programlisting>
    </example>
</sect3>
<!--
vim:se ts=4 sw=4 et:
-->