Esempio n. 1
0
$supports_sharding = false;
if (array_key_exists('shards', $_REQUEST) && $_REQUEST['shards']) {
    $supports_sharding = true;
}
$is_done = false;
if (isset($locations) && is_array($locations) && count($locations) && (!array_key_exists('freedisk', $_GET) || (double) $_GET['freedisk'] > 0.1)) {
    shuffle($locations);
    $location = trim($locations[0]);
    if (!$is_done && array_key_exists('reboot', $_GET)) {
        $is_done = GetReboot();
    }
    if (!$is_done && array_key_exists('ver', $_GET)) {
        $is_done = GetUpdate();
    }
    if (!$is_done && @$_GET['video']) {
        $is_done = GetVideoJob();
    }
    foreach ($locations as $loc) {
        $location = trim($loc);
        if (!$is_done && strlen($location)) {
            $is_done = GetJob();
        }
    }
} elseif (isset($_GET['freedisk']) && (double) $_GET['freedisk'] <= 0.1) {
    if (isset($_GET['reboot']) && GetSetting("lowDiskReboot")) {
        header('Content-type: text/plain');
        header("Cache-Control: no-cache, must-revalidate");
        header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
        echo "Reboot";
        $is_done = true;
    }
Esempio n. 2
0
<?php

set_time_limit(300);
// see if there is a video  job
$done = false;
if ($_GET['video']) {
    $done = GetVideoJob();
}
if (!$done) {
    header('Content-type: text/plain');
    header("Cache-Control: no-cache, must-revalidate");
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    $location = $_GET['location'];
    $key = $_GET['key'];
    // load all of the locations
    $locations = parse_ini_file('../settings/locations.ini', true);
    $settings = parse_ini_file('../settings/settings.ini');
    $workDir = $locations[$location]['localDir'];
    $locKey = $locations[$location]['key'];
    if (strlen($workDir) && (!strlen($locKey) || !strcmp($key, $locKey))) {
        // keep track of the last time this location reported in
        if (!is_dir('./times')) {
            mkdir('./times');
        }
        $timeFile = fopen("./times/{$location}.tm", "wb", false);
        if ($timeFile) {
            fclose($timeFile);
        }
        // lock the working directory for the given location
        $lockFile = fopen($workDir . '/lock.dat', 'a+b', false);
        if ($lockFile) {