コード例 #1
0
 public function offsetSet($p_key, $p_value)
 {
     // prevent debugmode from being unset.
     if ($p_key == 'debugMode' && !$p_value && TYPOlightDebug::isActive()) {
         // work around the fact, that TYPOlight is including /system/config/localconfig.php twice.
         $traces = @debug_backtrace();
         if (!(substr($this->path($traces[1]['file']), -28, 28) == '/system/libraries/Config.php')) {
             TYPOlightDebug::warn($traces[1]['file'] . ':' . $traces[1]['line'] . ' tried to set debugMode to false, but I need it to remain true in debug mode.', true);
         }
     } else {
         $old = $this->offsetGet($p_key);
         if ($old != $p_value) {
             TYPOlightDebug::info(array('old' => $old, 'new' => $p_value), 'Configuration value ' . $p_key . ' changed', true);
             return parent::offsetSet($p_key, $p_value);
         }
     }
 }
コード例 #2
0
 protected function ProcessHook($hookname, $params)
 {
     $cnt = count($GLOBALS['TL_HOOKS'][$hookname]) - 2;
     if ($cnt > 0) {
         $lasthook = end(self::$hookstack);
         if ($lasthook === $hookname) {
             TYPOlightDebug::info('EXIT HOOK::' . $hookname);
             TYPOlightDebug::groupEnd();
             array_pop(self::$hookstack);
         } else {
             array_push(self::$hookstack, $hookname);
             TYPOlightDebug::group('HOOK::' . $hookname . ' (' . $cnt . ' handler' . ($cnt - 1 ? 's' : '') . ' registered)');
             TYPOlightDebug::info($params, 'ENTER HOOK::' . $hookname);
         }
     } else {
         TYPOlightDebug::info($params, 'HOOK::' . $hookname);
     }
 }
コード例 #3
0
 protected static function checkSize()
 {
     if (self::$sizeexceeded) {
         return false;
     }
     $size = self::$fb->getSize();
     self::$size = $size;
     if (self::$size >= self::$maxsize) {
         self::$fb->warn('Debug data too big, used ' . self::$size . ' of ' . self::$maxsize . ' allowed, logging stopped.');
         self::$sizeexceeded = true;
     }
     return !self::$sizeexceeded;
 }
コード例 #4
0
 protected function addLine($value, $key = '')
 {
     $file = '';
     $i = 0;
     if (is_array($value) && count($value) >= 2 && (isset($value[1]) && (strpos($value[1], 'rows returned') !== false || strpos($value[1], 'rows affected') !== false))) {
         // logging of statements disabled? exit!
         if (!(array_key_exists('logDatabase', $GLOBALS['TL_CONFIG']) && $GLOBALS['TL_CONFIG']['logDatabase'])) {
             return true;
         }
         $traces = @debug_backtrace(false);
         while (($file == '' || $file == '/system/libraries/Database.php') && $i++ < count($traces) - 2) {
             if (!($trace = $traces[$i])) {
                 break;
             }
             if (array_key_exists('file', $trace)) {
                 // are we still in debugging files?
                 if (strpos($this->path($trace['file']), 'libraries/Database.php')) {
                     $file = str_replace(TL_ROOT, '', $this->path($traces[$i + 1]['file']));
                 }
             }
         }
         if ($file !== '') {
             // only log database queries that are allowed, according to our settings.
             if (preg_match('#/system/modules/([^/]+)/#', $file, $names)) {
                 if (!(array_key_exists('logDatabaseModules', $GLOBALS['TL_CONFIG']) && $GLOBALS['TL_CONFIG']['logDatabaseModules'] && in_array($names[1], deserialize($GLOBALS['TL_CONFIG']['logDatabaseModules'])))) {
                     return true;
                 }
             } else {
                 // not from module directory, should be core then
                 if (!(array_key_exists('logDatabaseModules', $GLOBALS['TL_CONFIG']) && $GLOBALS['TL_CONFIG']['logDatabaseModules'] && in_array('core', deserialize($GLOBALS['TL_CONFIG']['logDatabaseModules'])))) {
                     return true;
                 }
             }
             // log and exit.
             TYPOlightDebug::info($value, 'Database Query: ' . ($key ? $key : substr($value[0], 0, 80) . '...'), true);
             return true;
         }
     }
     $label = $key;
     if ($this->method) {
         $label = $key;
         $key = $this->method;
         $this->method = '';
     }
     if (in_array($key, array('log', 'info', 'warn', 'error'))) {
         TYPOlightDebug::$key($value, $label);
     } else {
         TYPOlightDebug::log($value, $key ? $key : '');
     }
 }