public function __construct()
 {
     $this->_message = new \Zend_Wildfire_Plugin_FirePhp_TableMessage('Doctrine Queries');
     $this->_message->setBuffered(true);
     $this->_message->setHeader(array('Time', 'Event', 'Parameters'));
     $this->_message->setOption('includeLineNumbers', false);
     \Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->_message, 'Doctrine Queries');
 }
示例#2
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     $this->_label = 'SQLs SGDOC-e';
     $this->_message = new FirePhp_TableMessage('Doctrine2 Queries');
     $this->_message->setBuffered(true);
     $this->_message->setHeader(array('Time', 'Event', 'Parameters'));
     $this->_message->setOption('includeLineNumbers', false);
     $this->_setCriticalQueriesLogger();
     FirePhp::getInstance()->send($this->_message);
 }
示例#3
0
 /**
  *
  * @param boolean $enable
  */
 public function setEnabled($enable)
 {
     parent::setEnabled($enable);
     if ($enable) {
         $this->_message = new TableMessage($this->label);
         $this->_message->setBuffered(true);
         $this->_message->setHeader(array('Time', 'Event', 'Parameters', 'Results'));
         $this->_message->setDestroy(true);
         Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->_message);
     }
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     $conn = Doctrine_Manager::connection();
     $conn->setListener($this->profiler = new Doctrine_Connection_Profiler());
     // setup firebug
     $this->message = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->label);
     $this->message->setBuffered(true);
     $this->message->setHeader(array('Time', 'Event', 'Parameters'));
     $this->message->setDestroy(true);
     $this->message->setOption('includeLineNumbers', false);
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->message);
 }
示例#5
0
 /**
  * Constructor
  *
  * @param string $label OPTIONAL Label for the profiling info.
  * @return void
  */
 public function __construct($label = null)
 {
     $this->_label = $label;
     if (!$this->_label) {
         $this->_label = 'Imind_Profiler_Doctrine_Firebug';
     }
     if (!$this->_message) {
         $this->_message = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_label);
         $this->_message->setBuffered(true);
         $this->_message->setHeader(array('Name', 'Time', 'Event', 'Parameters'));
         $this->_message->setDestroy(true);
         Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->_message);
     }
 }
示例#6
0
 /**
  * Enable or disable the profiler.  If $enable is false, the profiler
  * is disabled and will not log any queries sent to it.
  *
  * @param  boolean $enable
  * @return Zend_Db_Profiler Provides a fluent interface
  */
 public function setEnabled($enable)
 {
     parent::setEnabled($enable);
     if ($this->getEnabled()) {
         if (!$this->_message) {
             $this->_message = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_label);
             $this->_message->setBuffered(true);
             $this->_message->setHeader(array('Time', 'Event', 'Parameters'));
             $this->_message->setDestroy(true);
             Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->_message);
         }
     } else {
         if ($this->_message) {
             $this->_message->setDestroy(true);
             $this->_message = null;
         }
     }
     return $this;
 }
示例#7
0
 /**
  * Display profiling results and flush output buffer
  */
 public function display()
 {
     $firebugMessage = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_renderCaption());
     $firebugMessage->setHeader(array_keys($this->_getColumns()));
     foreach ($this->_getTimers() as $timerId) {
         $row = array();
         foreach ($this->_getColumns() as $columnId) {
             $row[] = $this->_renderColumnValue($timerId, $columnId);
         }
         $firebugMessage->addRow($row);
     }
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send($firebugMessage);
     // setup the wildfire channel
     $firebugChannel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $firebugChannel->setRequest($this->_request ? $this->_request : new Zend_Controller_Request_Http());
     $firebugChannel->setResponse($this->_response ? $this->_response : new Zend_Controller_Response_Http());
     // flush the wildfire headers into the response object
     $firebugChannel->flush();
     // send the response headers
     $firebugChannel->getResponse()->sendHeaders();
     ob_end_flush();
 }
 /**
  * Log a message to the Firebug Console.
  *
  * @param array $event The event data
  * @return void
  */
 protected function _write($event)
 {
     if (!$this->getEnabled()) {
         return;
     }
     if (array_key_exists($event['priority'], $this->_priorityStyles)) {
         $type = $this->_priorityStyles[$event['priority']];
     } else {
         $type = $this->_defaultPriorityStyle;
     }
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send($event['message'], null, $type);
 }
示例#9
0
 /**
  * @group ZF-10537
  */
 public function testFileLineOffsets()
 {
     $firephp = Zend_Wildfire_Plugin_FirePhp::getInstance();
     $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $protocol = $channel->getProtocol(Zend_Wildfire_Plugin_FirePhp::PROTOCOL_URI);
     $firephp->setOption('includeLineNumbers', true);
     $firephp->setOption('maxTraceDepth', 0);
     $lines = array();
     // NOTE: Do NOT separate the following pairs otherwise the line numbers will not match for the test
     // Message number: 1
     $lines[] = __LINE__ + 1;
     $this->_logger->log('Hello World', Zend_Log::INFO);
     // Message number: 2
     $this->_logger->addPriority('TRACE', 8);
     $this->_writer->setPriorityStyle(8, 'TRACE');
     $lines[] = __LINE__ + 1;
     $this->_logger->trace('Trace to here');
     // Message number: 3
     $this->_logger->addPriority('TABLE', 9);
     $this->_writer->setPriorityStyle(9, 'TABLE');
     $table = array('Summary line for the table', array(array('Column 1', 'Column 2'), array('Row 1 c 1', ' Row 1 c 2'), array('Row 2 c 1', ' Row 2 c 2')));
     $lines[] = __LINE__ + 1;
     $this->_logger->table($table);
     // Message number: 4
     $lines[] = __LINE__ + 1;
     $this->_logger->info('Hello World');
     $messages = $protocol->getMessages();
     $messages = $messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI];
     for ($i = 0; $i < sizeof($messages); $i++) {
         if (!preg_match_all('/FirebugTest\\.php","Line":' . $lines[$i] . '/', $messages[$i], $m)) {
             $this->fail("File and line does not match for message number: " . ($i + 1));
         }
     }
 }
示例#10
0
 /**
  * Constructs the FirePHP messages.
  *
  * @param array $profiles
  * @param string $label
  * @return Zend_Wildfire_Plugin_FirePhp_TableMessage
  */
 private function _constructFirePhp(array $columns, $label, $setBuffer = true)
 {
     $msg = new Zend_Wildfire_Plugin_FirePhp_TableMessage($label);
     // If a message is buffered it can be updated for the duration
     // of the request and is only flushed at the end of the request.
     $msg->setBuffered($setBuffer);
     $msg->setHeader($columns);
     // Destroy the message to prevent delivery
     $msg->setOption('includeLineNumbers', false);
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send($msg);
     return $msg;
 }
示例#11
0
<?php

require_once dirname(__FILE__) . '/.Start.php';
$firephp = Zend_Wildfire_Plugin_FirePhp::getInstance();
$firephp->setOption('maxObjectDepth', 2);
$firephp->setOption('maxArrayDepth', 3);
class TestObject
{
    var $name = 'test data';
}
class TestObject2
{
    var $name1 = 'name 1';
    var $name2 = 'name 2';
    var $name3 = 'name 3';
}
$obj = new TestObject();
$obj->child = new TestObject();
$obj->child->child = new TestObject();
$obj->child->child->child = new TestObject();
$obj->child->child->child->child = new TestObject();
$obj->child2 = new TestObject2();
$obj->child2->name4 = 'name 4';
$firephp->setObjectFilter('TestObject2', array('name2', 'name4'));
Zend_Wildfire_Plugin_FirePhp::send($obj);
$array = array();
$array['name'] = 'test data';
$array['child']['name'] = 'test data';
$array['child']['obj'] = $obj;
$array['child']['child']['name'] = 'test data';
$array['child']['child']['child']['name'] = 'test data';
示例#12
0
 /**
  * @group ZF-4934
  */
 public function testAdvancedLogging()
 {
     Zend_Wildfire_Plugin_FirePhp::getInstance()->setOption('maxTraceDepth', 0);
     $message = 'This is a log message!';
     $label = 'Test Label';
     $table = array('Summary line for the table', array(array('Column 1', 'Column 2'), array('Row 1 c 1', ' Row 1 c 2'), array('Row 2 c 1', ' Row 2 c 2')));
     $this->_logger->addPriority('TRACE', 8);
     $this->_logger->addPriority('TABLE', 9);
     $this->_writer->setPriorityStyle(8, 'TRACE');
     $this->_writer->setPriorityStyle(9, 'TABLE');
     $this->_logger->trace($message);
     $this->_logger->table($table);
     try {
         throw new Exception('Test Exception');
     } catch (Exception $e) {
         $this->_logger->err($e);
     }
     try {
         Zend_Wildfire_Plugin_FirePhp::send($message, $label, 'UNKNOWN');
         $this->fail('Should not be able to log with undefined log style');
     } catch (Exception $e) {
         // success
     }
     $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $protocol = $channel->getProtocol(Zend_Wildfire_Plugin_FirePhp::PROTOCOL_URI);
     $messages = array(Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE => array(Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI => array(1 => '[{"Type":"TABLE"},["Summary line for the table",[["Column 1","Column 2"],["Row 1 c 1"," Row 1 c 2"],["Row 2 c 1"," Row 2 c 2"]]]]')));
     $qued_messages = $protocol->getMessages();
     unset($qued_messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI][0]);
     unset($qued_messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI][2]);
     $this->assertEquals(serialize($qued_messages), serialize($messages));
 }
示例#13
0
 public function testFirePhpPluginSubclass()
 {
     $firephp = Zend_Wildfire_Plugin_FirePhp::init('Zend_Wildfire_WildfireTest_FirePhpPlugin');
     $this->assertEquals(get_class($firephp), 'Zend_Wildfire_WildfireTest_FirePhpPlugin');
     Zend_Wildfire_Plugin_FirePhp::destroyInstance();
     try {
         Zend_Wildfire_Plugin_FirePhp::init('Zend_Wildfire_WildfireTest_Request');
         $this->fail('Should not be able to initialize');
     } catch (Exception $e) {
         // success
     }
     $this->assertNull(Zend_Wildfire_Plugin_FirePhp::getInstance(true));
     try {
         Zend_Wildfire_Plugin_FirePhp::init(array());
         $this->fail('Should not be able to initialize');
     } catch (Exception $e) {
         // success
     }
     $this->assertNull(Zend_Wildfire_Plugin_FirePhp::getInstance(true));
 }
示例#14
0
 /**
  * @copyright http://anton.shevchuk.name/php/debug-zend-framework-application-with-firephp/
  * @static
  */
 public static function timeStamp($comment = "")
 {
     if (!self::$_timer instanceof Zend_Wildfire_Plugin_FirePhp_TableMessage) {
         self::$_timer = new Zend_Wildfire_Plugin_FirePhp_TableMessage('Timer');
         self::$_timer->setBuffered(true);
         self::$_timer->setHeader(array('Time (sec)', 'Total (sec)', 'Memory (Kb)', 'Total (Kb)', 'Comment', 'File'));
         self::$_timer->setOption('includeLineNumbers', false);
     }
     $back = debug_backtrace();
     list($msec, $sec) = explode(chr(32), microtime());
     list($mTotal, $mSec) = self::getMemoryUsage();
     if (!isset(self::$_time)) {
         self::$_time["start"] = $sec + $msec;
         self::$_time["section"] = $sec + $msec;
         self::$_timer->addRow(array(sprintf("%01.4f", 0), sprintf("%01.4f", 0), $mSec, $mTotal, $comment, basename(@$back[0]["file"]) . ':' . @$back[0]["line"]));
     } else {
         $start = self::$_time["section"];
         self::$_time["section"] = $sec + $msec;
         self::$_timer->addRow(array(sprintf("%01.4f", round(self::$_time["section"] - $start, 4)), sprintf("%01.4f", round(self::$_time["section"] - self::$_time["start"], 4)), $mSec, $mTotal, $comment, basename(@$back[0]["file"]) . ':' . @$back[0]["line"]));
     }
     self::updateMessageLabel();
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send(self::$_timer);
 }
示例#15
0
 /**
  * @group ZF-5540
  */
 public function testMaxObjectArrayDepth()
 {
     $this->_setupWithoutFrontController();
     $firephp = Zend_Wildfire_Plugin_FirePhp::getInstance();
     $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $protocol = $channel->getProtocol(Zend_Wildfire_Plugin_FirePhp::PROTOCOL_URI);
     $firephp->setOption('maxObjectDepth', 2);
     $firephp->setOption('maxArrayDepth', 1);
     $obj = new Zend_Wildfire_WildfireTest_TestObject3();
     $obj->testArray = array('val1', array('val2', array('Hello World')));
     $obj->child = clone $obj;
     $obj->child->child = clone $obj;
     $firephp->send($obj);
     $table = array();
     $table[] = array('Col1', 'Col2');
     $table[] = array($obj, $obj);
     $firephp->send($table, 'Label', Zend_Wildfire_Plugin_FirePhp::TABLE);
     $messages = $protocol->getMessages();
     $message = $messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI][0];
     $this->assertEquals($message, '[{"Type":"LOG"},{"__className":"Zend_Wildfire_WildfireTest_TestObject3","public:name":"Name","public:value":"Value","undeclared:testArray":["val1","** Max Array Depth (1) **"],"undeclared:child":{"__className":"Zend_Wildfire_WildfireTest_TestObject3","public:name":"Name","public:value":"Value","undeclared:testArray":["val1","** Max Array Depth (1) **"],"undeclared:child":"** Max Object Depth (2) **"}}]');
     $message = $messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI][1];
     $this->assertEquals($message, '[{"Type":"TABLE","Label":"Label"},[["Col1","Col2"],[{"__className":"Zend_Wildfire_WildfireTest_TestObject3","public:name":"Name","public:value":"Value","undeclared:testArray":["val1","** Max Array Depth (1) **"],"undeclared:child":{"__className":"Zend_Wildfire_WildfireTest_TestObject3","public:name":"Name","public:value":"Value","undeclared:testArray":["val1","** Max Array Depth (1) **"],"undeclared:child":"** Max Object Depth (2) **"}},{"__className":"Zend_Wildfire_WildfireTest_TestObject3","public:name":"Name","public:value":"Value","undeclared:testArray":["val1","** Max Array Depth (1) **"],"undeclared:child":{"__className":"Zend_Wildfire_WildfireTest_TestObject3","public:name":"Name","public:value":"Value","undeclared:testArray":["val1","** Max Array Depth (1) **"],"undeclared:child":"** Max Object Depth (2) **"}}]]]');
 }
示例#16
0
 /**
  * Log a message to the Firebug Console.
  *
  * @param array $event The event data
  * @return void
  */
 protected function _write($event)
 {
     if (!$this->getEnabled()) {
         return;
     }
     if (array_key_exists($event['priority'], $this->_priorityStyles)) {
         $type = $this->_priorityStyles[$event['priority']];
     } else {
         $type = $this->_defaultPriorityStyle;
     }
     $message = $this->_formatter->format($event);
     $label = isset($event['firebugLabel']) ? $event['firebugLabel'] : null;
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send($message, $label, $type, array('traceOffset' => 6));
 }
 /**
  * getGenerateTime
  *
  * @access  public
  * @param   strin $aComment
  * @param   bool $aPrint
  * @return  string time
  */
 public static function getGenerateTime($aComment = "")
 {
     if (!self::$enabled) {
         return;
     }
     $back = debug_backtrace();
     list($msec, $sec) = explode(chr(32), microtime());
     list($mTotal, $mSec) = self::getMemoryUsage();
     if (!isset(self::$time)) {
         self::$time["start"] = $sec + $msec;
         self::$time["section"] = $sec + $msec;
         self::$timer->addRow(array(sprintf("%01.4f", 0), sprintf("%01.4f", 0), $mSec, $mTotal, $aComment, basename(@$back[0]["file"]) . ':' . @$back[0]["line"]));
     } else {
         $start = self::$time["section"];
         self::$time["section"] = $sec + $msec;
         self::$timer->addRow(array(sprintf("%01.4f", round(self::$time["section"] - $start, 4)), sprintf("%01.4f", round(self::$time["section"] - self::$time["start"], 4)), $mSec, $mTotal, $aComment, basename(@$back[0]["file"]) . ':' . @$back[0]["line"]));
     }
     self::updateMessageLabel();
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send(self::$timer);
 }
示例#18
0
 /**
  * Defined by Zend_Controller_Plugin_Abstract
  */
 public function dispatchLoopShutdown()
 {
     $html = '';
     if ($this->getRequest()->isXmlHttpRequest()) {
         return;
     }
     /**
      * Creating menu tab for all registered plugins
      */
     foreach ($this->_plugins as $plugin) {
         $plugin->getPanel();
         $message = $plugin->message;
         if (!$message) {
             continue;
         }
         if ($message) {
             Zend_Wildfire_Plugin_FirePhp::getInstance()->send($message);
         }
     }
 }