Example #1
0
function util_initEverything()
{
    // smarty < session_start/end : smarty caches the person's nickname.
    util_defineRootPath();
    util_defineWwwRoot();
    util_requireOtherFiles();
    util_defineConstants();
    db_init();
    session_init();
    mc_init();
    FlashMessage::restoreFromSession();
    SmartyWrap::init();
    DebugInfo::init();
}
<?php

DebugInfo::init();
class DebugInfo
{
    private static $startTimestamp;
    private static $lastClockReset;
    private static $enabled = true;
    private static $debugInfo = array();
    public static function init()
    {
        self::$startTimestamp = self::getTimeInMillis();
        self::$lastClockReset = self::getTimeInMillis();
    }
    private static function getTimeInMillis()
    {
        $seconds = microtime(true);
        return (int) ($seconds * 1000);
    }
    public static function resetClock()
    {
        self::$lastClockReset = self::getTimeInMillis();
    }
    // Certain scripts produce a lot of debug info and need a way to disable debugging.
    public static function disable()
    {
        self::$enabled = false;
    }
    // Measures the time since the last clock reset and appends a message
    public static function stopClock($message)
    {