Example #1
0
                        # as of PHP 5.3
                    }
            }
        }
    }
}
if (POODLE_SETUP) {
    Poodle::$DEBUG = Poodle::DBG_ALL;
}
Poodle::$DIR_BASE = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR;
if (POODLE_BACKEND || POODLE_SETUP) {
    Poodle::$DIR_BASE = dirname(Poodle::$DIR_BASE) . DIRECTORY_SEPARATOR;
    chdir(Poodle::$DIR_BASE);
}
spl_autoload_register('Poodle::autoload');
# Dragonfly config
Poodle::$DIR_CACHE = BASEDIR . 'cache/';
class Poodle_Debugger
{
    public static function trigger($errmsg, $skip = 0, $errno = E_USER_WARNING)
    {
        trigger_error($errmsg, $errno);
    }
}
class Poodle_LOG
{
    public static function notice($section, $msg)
    {
        trigger_error("{$section}: {$msg}", E_USER_WARNING);
    }
}
Example #2
0
 protected function log(&$query, $qtime)
 {
     global $dbal;
     $dbal->getConfiguration()->getSQLLogger()->stopQuery();
     ++$this->total_queries;
     $this->total_time += $qtime;
     if ($this->DBM->debug || $qtime > 1) {
         $tmp = debug_backtrace();
         $file = '';
         $line = 0;
         for ($i = 0; $i < count($tmp); ++$i) {
             if (isset($tmp[$i]['file'], $tmp[$i]['line'])) {
                 $file = $tmp[$i]['file'];
                 $line = $tmp[$i]['line'];
                 if (!strpos($file, '\\sql\\') && !strpos($file, '/sql/')) {
                     break;
                 }
             }
         }
         $file = Poodle::shorten_file_path($file);
         if ($qtime > 1) {
             Poodle_LOG::notice('Slow SQL', "Slow Query {$qtime} in {$file}#{$line}:\n\n" . $query);
         }
         if ($this->DBM->debug & Poodle::DBG_SQL_QUERIES) {
             $this->querylist[$file][] = array('line' => $line, 'query' => $query, 'time' => $qtime);
         }
     }
 }