Ejemplo n.º 1
0
 /**
  * TODO: Document this Method!
  */
 public function preToolbarRendering()
 {
     $times = \Debug\Toolbar\Service\DataStorage::get('SqlLogger:Times');
     if (!is_array($times)) {
         $times = array();
     }
     $queries = \Debug\Toolbar\Service\DataStorage::get('SqlLogger:Queries');
     $origins = \Debug\Toolbar\Service\DataStorage::get('SqlLogger:Origins');
     $params = \Debug\Toolbar\Service\DataStorage::get('SqlLogger:Params');
     $types = \Debug\Toolbar\Service\DataStorage::get('SqlLogger:Types');
     $merged = array();
     if (is_array($queries)) {
         foreach ($queries as $key => $value) {
             $origin = $origins[$key];
             if (isset($origin['line'])) {
                 $origin = 'Called from: ' . $origin['class'] . $origin['type'] . $origin['function'] . ' on line ' . $origin['line'];
             } else {
                 $origin = '';
             }
             $merged[$key] = array('query' => $value, 'time' => number_format($times[$key] * 1000, 2), 'origin' => $origin, 'params' => $params[$key], 'types' => $types[$key]);
         }
     }
     $merged = $this->formatQueries($merged);
     \Debug\Toolbar\Service\Collector::getModule('Sql')->getToolbar()->addIcon('hdd')->addBadge(count($queries))->getPopup()->addPartial('Sql/Statistic', array('time' => array_sum($times), 'queries' => $merged, 'queriesCount' => count($queries)))->getPanel()->addPartial('Sql/Queries', array('time' => array_sum($times), 'queries' => $merged, 'queriesCount' => count($queries)));
 }
Ejemplo n.º 2
0
 /**
  * TODO: Document this Method! ( assignVariables )
  */
 public function preToolbarRendering()
 {
     $account = $this->context->getAccount();
     $votes = array();
     $privilege = array('PRIVILEGE_ABSTAIN', 'PRIVILEGE_GRANT', 'PRIVILEGE_DENY');
     $roleVotes = \Debug\Toolbar\Service\DataStorage::get('Security:RoleVotes');
     if (is_array($roleVotes)) {
         foreach ($roleVotes as $key => $value) {
             $vote = array('role' => (string) $value['role']);
             $vote['privilege'] = '';
             if (is_array($value['privileges'])) {
                 foreach ($value['privileges'] as $k => $p) {
                     $vote['privilege'] = $privilege[$p];
                 }
             }
             $votes[$value['role'] . ':' . $vote['privilege']] = $vote;
         }
     } else {
         $roles = $this->context->getRoles();
         foreach ($roles as $key => $value) {
             $vote = array('role' => (string) $value);
             $votes[] = $vote;
         }
     }
     \Debug\Toolbar\Service\Collector::getModule('Security')->getToolbar()->addIcon('user')->addText(is_object($account) ? $account->getAccountIdentifier() : 'Guest')->getPopup()->addPartial('Security', array('roles' => $this->context->getRoles(), 'account' => $this->context->getaccount(), 'votes' => $votes))->getPanel()->addPartial('Security', array('roles' => $this->context->getRoles(), 'account' => $this->context->getaccount(), 'votes' => $votes));
 }
Ejemplo n.º 3
0
 public function preToolbarRendering()
 {
     $rawAdvices = (array) \Debug\Toolbar\Service\DataStorage::get('AOP:Advices');
     $advices = array();
     foreach ($rawAdvices as $key => $value) {
         if (stristr($value['adviceClass'], 'Debug\\Toolbar') && TRUE) {
         } else {
             $key = implode('.', $value);
             if (isset($advices[$key])) {
                 $advices[$key]['counter']++;
             } else {
                 $advices[$key] = $value;
                 $advices[$key]['counter'] = 1;
                 $reflectionClass = new \ReflectionClass($value['adviceClass']);
                 $advices[$key]['classComment'] = $this->cleanupComment($reflectionClass->getDocComment());
                 $advices[$key]['methodComment'] = $this->cleanupComment($reflectionClass->getMethod($value['adviceMethodName'])->getDocComment());
             }
         }
     }
     $table = '';
     foreach ($advices as $advice) {
         $title = '<b>' . $advice['adviceClass'] . '->' . $advice['adviceClass'] . '</b> <br /> <small>Called ' . $advice['counter'] . ' times</small>';
         $content = $advice['joinPointClass'] . '->' . $advice['joinPointMethodName'];
         $table .= '<table class="table table-striped table-bordered small-break signals">';
         $table .= '<tr><th>' . $title . '</th></tr>';
         $table .= '<tr><td class="indent-left">' . $content . '</td></tr>';
         $table .= '</table>';
     }
     \Debug\Toolbar\Service\Collector::getModule('AOP')->getToolbar()->addText('AOP')->addBadge(count($advices))->getPopup()->addHtml($table)->getPanel()->addHtml($table);
 }
Ejemplo n.º 4
0
 /**
  * TODO: Document this Method!
  */
 public function preToolbarRendering()
 {
     $dispatcher = $this->objectManager->get('TYPO3\\Flow\\SignalSlot\\Dispatcher');
     if (method_exists($dispatcher, 'getSignals')) {
         $classes = $this->objectManager->get('TYPO3\\Flow\\SignalSlot\\Dispatcher')->getSignals();
         $classes = $this->sanitize($classes);
         \Debug\Toolbar\Service\Collector::getModule('Signals')->getToolbar()->addText('Signals')->addBadge(count($classes))->getPopup()->addPartial('Signals', array('classes' => $classes))->getPanel()->addPartial('Signals', array('classes' => $classes));
     }
 }
 /**
  * TODO: Document this Method! ( assignVariables )
  */
 public function preToolbarRendering()
 {
     $memoryUsage = memory_get_peak_usage(TRUE) / 1024 / 1024;
     $memoryUsage = number_format($memoryUsage, 1) . ' MB';
     \Debug\Toolbar\Service\Collector::getModule('Environment')->getToolbar()->addIcon('info-sign')->addText($memoryUsage)->getPopup()->addTable(array('PHP Version' => PHP_VERSION, 'Flow Context' => $this->objectManager->getContext(), 'Flow Version' => FLOW_VERSION_BRANCH))->getPanel()->addTable(array('PHP Version' => PHP_VERSION, 'Flow Context' => $this->objectManager->getContext(), 'Flow Version' => FLOW_VERSION_BRANCH));
     return;
     #$configurations = array();
     #foreach ($configurations as $configurationName => $configurationConstant) {
     #    $configuration = $this->configurationManager->getConfiguration($configurationConstant);
     #    $configurations[$configurationName] = \Symfony\Component\Yaml\Yaml::dump($configuration, 10);
     #}
     #$configurations["Constants"] = \Symfony\Component\Yaml\Yaml::dump(get_defined_constants(), 10);
     #$this->view->assign('configurations', $configurations);
 }
Ejemplo n.º 6
0
 public function preToolbarRendering()
 {
     $logDir = FLOW_PATH_DATA . 'Logs/';
     $logFiles = scandir($logDir);
     $logs = array();
     foreach ($logFiles as $logFile) {
         if (pathinfo($logFile, PATHINFO_EXTENSION) !== 'log') {
             continue;
         }
         $lines = file($logDir . '/' . $logFile);
         $lines = array_slice($lines, -200);
         foreach ($lines as $key => $line) {
             $loggingLevels = array(' DEBUG ' => ' <span class="muted">DEBUG</span> ', ' INFO ' => ' <span class="text-info">INFO</span> ', ' NOTICE ' => ' <span class="text-warning">NOTICE</span> ', ' WARNING ' => ' <span class="text-warning">WARNING</span> ', ' ERROR ' => ' <span class="text-error">ERROR</span> ', ' CRITICAL ' => ' <span class="text-error">CRITICAL</span> ', ' ALERT ' => ' <span class="text-error">ALERT</span> ', ' EMERGENCY ' => ' <span class="text-error">EMERGENCY</span> ');
             $lines[$key] = str_replace(array_keys($loggingLevels), array_values($loggingLevels), $line);
         }
         $logs[$logFile] = $lines;
         unset($lines);
     }
     \Debug\Toolbar\Service\Collector::getModule('Logging')->getToolbar()->addIcon('list-alt')->addText('Logging')->getPopup()->setClass('fullscreen')->addPartial('Logging', array('logs' => $logs))->getPanel()->addPartial('Logging', array('logs' => $logs));
 }