Exemple #1
0
function profile_point($text)
{
    $thistime = microtime();
    $GLOBALS['profiler_log'][] = profiler_microtime_diff($thistime, $GLOBALS['profiler_start']) . ' | ' . profiler_microtime_diff($thistime, $GLOBALS['profiler_last']) . ' msec | ' . ceil(memory_get_usage() / 1024) . ' kB | ' . $text;
    $GLOBALS['profiler_last'] = $thistime;
}
Exemple #2
0
function logToFile($filename, $content, $clearfile = false)
{
    global $profiler_report, $profiler_time_start, $profiler_last;
    if ($clearfile) {
        @unlink($filename);
    }
    if (is_array($content)) {
        $content = dumpArray($content);
    }
    $uri = $_SERVER['REQUEST_URI'];
    if (stristr($uri, 'password') != '') {
        $uri = '***';
    }
    @WriteToFile($filename, $_SERVER['REMOTE_ADDR'] . ' ' . $_SERVER['HTTP_HOST'] . ' ' . $uri . ' ' . $_SESSION['uid'] . ' ' . session_id() . ' ' . date('Y-m-d H:i:s') . ' ' . profiler_microtime_diff(microtime(), $GLOBALS['profiler_start']) . '  ' . trim($content) . "\r\n");
}
Exemple #3
0
switch ($_REQUEST['request']) {
    case 'verify':
        if ($pingPassword == trim($_REQUEST['password'])) {
            $result = array('result' => 'OK');
        } else {
            $result = array('result' => 'fail', 'reason' => 'wrong ping password');
        }
        print json_encode($result);
        break;
    case 'ping':
        if (trim(cfg('ping/password')) == trim($_REQUEST['password'])) {
            $baseCtr = h2_getController('endpoint');
            h2_invokeAction($baseCtr, 'cron');
            print h2_invokeView($baseCtr, 'cron');
            h2_statlog('cron', 'cron');
            $result = array('result' => 'OK', 'stamp' => time(), 'runtime' => profiler_microtime_diff(microtime(), $GLOBALS['profiler_start']));
        } else {
            $result = array('result' => 'fail', 'reason' => 'wrong ping password');
        }
        print json_encode($result);
        break;
    default:
        if ($_SERVER['SERVER_PROTOCOL'] != '') {
            print json_encode(array('result' => 'fail', 'reason' => 'invalid ping request'));
        } else {
            $baseCtr = h2_getController('endpoint');
            h2_invokeAction($baseCtr, 'cron');
            print h2_invokeView($baseCtr, 'cron');
            h2_statlog('cron', 'cron');
        }
        break;