コード例 #1
0
ファイル: index.php プロジェクト: ritthai/LMS
        }
    } else {
        if (isset($_GET['action']) && $_GET['action'] != "") {
            // Action with no params
            $action = $_GET['action'];
            switch ($action) {
                case 'list':
                    $args['filelist'] = File::ListAll();
                    include "views/{$action}.view.php";
                    break;
                case 'show':
                    Error::generate('notice', 'Invalid file ID', Error::$FLAGS['single']);
                    header("Location: {$PAGE_REL_URL}");
                    break;
                default:
                    Error::generate('suspicious', "Invalid action {$action} in /file/");
                    header("Location: {$PAGE_REL_URL}");
            }
        } else {
            include "views/index.view.php";
        }
    }
}
db_close();
profiling_end('all');
profiling_print_summary();
Error::showSeparator();
Error::setBgColour('#B66');
Error::generate('debug', "Finished rendering {$_SERVER['REQUEST_URI']} normally");
Error::setBgColour('#555');
Error::showSeparator();
コード例 #2
0
ファイル: cache_course.php プロジェクト: ritthai/LMS
// max no. of simultaneous outgoing connections
// stats
$logpath = "{$ROOT}/admin/daemon_stats.log";
$fp = fopen($logpath, "a");
date_default_timezone_set('America/New_York');
$start_time = date(DATE_RFC822);
$n_reqs_recvd = 0;
$n_reqs_procd = 0;
$n_preempted_reqs = 0;
$time_delta = 1000 * 1000 * 1000;
$db_reconnect_delta = 0;
while (true) {
    $time_delta += profiling_end('all');
    profiling_start('all');
    if ($time_delta >= 60 * 1000 * 1000) {
        fputs($fp, "\r\n" . "Daemon ID     : {$GLOBALS['client']} v1 pid={$pid}\r\n" . "Start time    : {$start_time}\r\n" . "Current time  : " . date(DATE_RFC822) . "\r\n" . "# reqs recvd  : {$n_reqs_recvd}\r\n" . "# reqs procd  : {$n_reqs_procd}\r\n" . "# preempted   : {$n_preempted_reqs}\r\n" . "# in queue    : " . count($in_progress) . "\r\n" . "max simult    : {$max_simult_queries}\r\n" . "IPC conns     : " . count($clients) . "\r\n" . "cURL actvconns: {$active}" . "\r\n" . profiling_print_summary());
        $db_reconnect_delta += $time_delta;
        $time_delta = 0;
    }
    if ($db_reconnect_delta > 3600 * 1000 * 1000) {
        db_close();
        fputs($fp, "\r\n{$GLOBALS['client']} RECONNECTING TO DATABASE\r\n");
        db_connect();
        $db_reconnect_delta = 0;
    }
    $timeout = $completed->size() > 0 || count($in_progress) > 0 ? 10000 : 1000000;
    $r = array_merge(array($sock), $clients);
    $w = $e = NULL;
    profiling_start('idle');
    if (socket_select($r, $w, $e, $timeout / 1000000, $timeout % 1000000) < 1) {
        profiling_end('idle');