示例#1
0
 function testValidCode()
 {
     if (function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     require_code('files2');
     $php_path = find_php_path();
     $contents = get_directory_contents(get_file_base());
     foreach ($contents as $c) {
         if (substr($c, -4) == '.php' && basename($c) != 'errorlog.php' && basename($c) != 'phpstub.php' && basename($c) != 'permissioncheckslog.php') {
             $message = shell_exec($php_path . ' -l ' . $c);
             $this->assertTrue(strpos($message, 'No syntax errors detected') !== false, $message . ' (' . $c . ')');
         }
     }
 }
示例#2
0
/**
 * Script to perform ocPortal CRON jobs called by the real CRON.
 *
 * @param  PATH  	File path of the cron_bridge.php script
 */
function cron_bridge_script($caller)
{
    if (function_exists('set_time_limit')) {
        @set_time_limit(1000);
    }
    // May get overridden lower later on
    if (get_param_integer('querymode', 0) == 1) {
        header('Content-Type: text/plain');
        @ini_set('ocproducts.xss_detect', '0');
        require_code('files2');
        $php_path = find_php_path();
        echo $php_path . ' -C -q --no-header ' . $caller;
        exit;
    }
    global $CURRENT_SHARE_USER, $SITE_INFO;
    if (is_null($CURRENT_SHARE_USER) && array_key_exists('custom_share_domain', $SITE_INFO)) {
        require_code('files');
        foreach ($SITE_INFO as $key => $val) {
            if (substr($key, 0, 12) == 'custom_user_') {
                $url = preg_replace('#://[\\w\\.]+#', '://' . substr($key, 12) . '.' . $SITE_INFO['custom_share_domain'], get_base_url()) . '/data/cron_bridge.php';
                http_download_file($url);
            }
        }
    }
    decache('main_staff_checklist');
    $limit_hook = get_param('limit_hook', '');
    set_value('last_cron', strval(time()));
    $cron_hooks = find_all_hooks('systems', 'cron');
    foreach (array_keys($cron_hooks) as $hook) {
        if ($limit_hook != '' && $limit_hook != $hook) {
            continue;
        }
        require_code('hooks/systems/cron/' . $hook);
        $object = object_factory('Hook_cron_' . $hook, true);
        if (is_null($object)) {
            continue;
        }
        $object->run();
    }
    if (!headers_sent()) {
        header('Content-type: text/plain');
    }
}