コード例 #1
0
ファイル: runtest.php プロジェクト: VinkenCheng/webpagetest
     $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' || isset($_SERVER['HTTP_SSL']) && $_SERVER['HTTP_SSL'] == 'On' ? 'https' : 'http';
     $test['tsview_results_host'] = "{$protocol}://{$_SERVER['HTTP_HOST']}";
     // tsview_configs format: KEY>VALUE,KEY>VALUE,......
     if (array_key_exists('tsview_configs', $_REQUEST)) {
         $test['tsview_configs'] = $_REQUEST['tsview_configs'];
     }
 }
 if (array_key_exists('affinity', $_REQUEST)) {
     $test['affinity'] = hexdec(substr(sha1($_REQUEST['affinity']), 0, 8));
 }
 if (array_key_exists('tester', $_REQUEST) && preg_match('/[a-zA-Z0-9\\-_]+/', $_REQUEST['tester'])) {
     $test['affinity'] = 'Tester' . $_REQUEST['tester'];
 }
 // custom options
 $test['cmdLine'] = '';
 ValidateCommandLine($req_cmdline, $error);
 $test['addCmdLine'] = $req_cmdline;
 if (isset($req_disableThreadedParser) && $req_disableThreadedParser) {
     if (strlen($test['addCmdLine'])) {
         $test['addCmdLine'] .= ' ';
     }
     $test['addCmdLine'] .= '--disable-threaded-html-parser';
 }
 if (isset($req_spdyNoSSL) && $req_spdyNoSSL) {
     if (strlen($test['addCmdLine'])) {
         $test['addCmdLine'] .= ' ';
     }
     $test['addCmdLine'] .= '--use-spdy=no-ssl';
 }
 if (isset($req_dataReduction) && $req_dataReduction) {
     if (strlen($test['addCmdLine'])) {
コード例 #2
0
ファイル: vanilla2export.php プロジェクト: Nordic-T/Nordic-T
function parseCommandLine($Options = null, $Files = null)
{
    global $GlobalOptions, $Supported, $argv;
    if (isset($Options)) {
        $GlobalOptions = $Options;
    }
    if (!isset($GlobalOptions)) {
        $GlobalOptions = array();
    }
    if (!isset($Supported)) {
        $Supported = array();
    }
    $CommandOptions = GetAllCommandLineOptions();
    list($ShortCodes, $LongCodes) = GetOptCodes($CommandOptions);
    //   print_r($LongCodes);
    $Opts = getopt($ShortCodes, $LongCodes);
    if (isset($Opts['help']) || isset($Opts['h'])) {
        WriteCommandLineHelp();
        die;
    }
    // Spawn new packages from the command line!
    if (isset($Opts['spawn']) || isset($Opts['s'])) {
        $Name = isset($Opts['spawn']) ? $Opts['spawn'] : $Opts['s'];
        SpawnPackage($Name);
        die;
    }
    $Opts = ValidateCommandLine($Opts, $CommandOptions);
    if (is_array($Files)) {
        $Opts2 = array();
        foreach ($Files as $Name) {
            $Value = array_pop($argv);
            if (!$Value) {
                echo "Missing required parameter: {$Name}";
            } else {
                $Opts2[$Name] = $Value;
            }
        }
        if ($Opts2) {
            if ($Opts === false) {
                $Opts = $Opts2;
            } else {
                $Opts = array_merge($Opts, $Opts2);
            }
        }
    }
    if ($Opts === false) {
        die;
    }
    $_POST = $Opts;
    return $Opts;
}