Example #1
0
function cron_get_file_lock()
{
    $lock_obtained = false;
    if (file_exists(CRON_ALLOWED)) {
        #		bb_log(date('H:i:s - ') . getmypid() .' -x-- FILE-LOCK try'. LOG_LF, CRON_LOG_DIR .'cron_check');
        $lock_obtained = @rename(CRON_ALLOWED, CRON_RUNNING);
    } elseif (file_exists(CRON_RUNNING)) {
        cron_release_deadlock();
    } elseif (!file_exists(CRON_ALLOWED) && !file_exists(CRON_RUNNING)) {
        file_write('', CRON_ALLOWED);
        $lock_obtained = @rename(CRON_ALLOWED, CRON_RUNNING);
    }
    return $lock_obtained;
}
Example #2
0
        }
    }
}
$dl_link_css = array(DL_STATUS_RELEASER => 'genmed', DL_STATUS_WILL => 'dlWill', DL_STATUS_DOWN => 'leechmed', DL_STATUS_COMPLETE => 'seedmed', DL_STATUS_CANCEL => 'dlCancel');
$dl_status_css = array(DL_STATUS_RELEASER => 'genmed', DL_STATUS_WILL => 'dlWill', DL_STATUS_DOWN => 'dlDown', DL_STATUS_COMPLETE => 'dlComplete', DL_STATUS_CANCEL => 'dlCancel');
// Exit if board is disabled via ON/OFF trigger or by admin
if (($bb_cfg['board_disable'] || file_exists(BB_DISABLED)) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !defined('IN_LOGIN')) {
    header('HTTP/1.0 503 Service Unavailable');
    if ($bb_cfg['board_disable']) {
        // admin lock
        send_no_cache_headers();
        bb_die('BOARD_DISABLE');
    } else {
        if (file_exists(BB_DISABLED)) {
            // trigger lock
            cron_release_deadlock();
            send_no_cache_headers();
            bb_die('BOARD_DISABLE_CRON');
        }
    }
}
// Cron functions
function cron_release_deadlock()
{
    if (file_exists(CRON_RUNNING)) {
        if (TIMENOW - filemtime(CRON_RUNNING) > 2400) {
            cron_enable_board();
            cron_release_file_lock();
        }
    }
}