当前位置: 首页>>代码示例>>PHP>>正文


PHP logTestMsg函数代码示例

本文整理汇总了PHP中logTestMsg函数的典型用法代码示例。如果您正苦于以下问题:PHP logTestMsg函数的具体用法?PHP logTestMsg怎么用?PHP logTestMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了logTestMsg函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CreateTest


//.........这里部分代码省略.........
            if ($test['keepua']) {
                $testFile .= "keepua=1\r\n";
            }
            if ($test['mobile']) {
                $testFile .= "mobile=1\r\n";
            }
            if (isset($test['dpr']) && $test['dpr'] > 0) {
                $testFile .= "dpr={$test['dpr']}\r\n";
            }
            if (isset($test['width']) && $test['width'] > 0) {
                $testFile .= "width={$test['width']}\r\n";
            }
            if (isset($test['height']) && $test['height'] > 0) {
                $testFile .= "height={$test['height']}\r\n";
            }
            if ($test['clearcerts']) {
                $testFile .= "clearcerts=1\r\n";
            }
            if ($test['orientation']) {
                $testFile .= "orientation={$test['orientation']}\r\n";
            }
            if (array_key_exists('continuousVideo', $test) && $test['continuousVideo']) {
                $testFile .= "continuousVideo=1\r\n";
            }
            if (array_key_exists('responsive', $test) && $test['responsive']) {
                $testFile .= "responsive=1\r\n";
            }
            if (array_key_exists('cmdLine', $test) && strlen($test['cmdLine'])) {
                $testFile .= "cmdLine={$test['cmdLine']}\r\n";
            }
            if (array_key_exists('addCmdLine', $test) && strlen($test['addCmdLine'])) {
                $testFile .= "addCmdLine={$test['addCmdLine']}\r\n";
            }
            if (array_key_exists('customBrowserUrl', $test) && strlen($test['customBrowserUrl'])) {
                $testFile .= "customBrowserUrl={$test['customBrowserUrl']}\r\n";
            }
            if (array_key_exists('customBrowserMD5', $test) && strlen($test['customBrowserMD5'])) {
                $testFile .= "customBrowserMD5={$test['customBrowserMD5']}\r\n";
            }
            if (array_key_exists('customBrowserSettings', $test) && is_array($test['customBrowserSettings']) && count($test['customBrowserSettings'])) {
                foreach ($test['customBrowserSettings'] as $setting => $value) {
                    $testFile .= "customBrowser_{$setting}={$value}\r\n";
                }
            }
            if (isset($test['uastring'])) {
                $testFile .= "uastring={$test['uastring']}\r\n";
            }
            $UAModifier = GetSetting('UAModifier');
            if ($UAModifier && strlen($UAModifier)) {
                $testFile .= "UAModifier={$UAModifier}\r\n";
            }
            if (isset($test['appendua'])) {
                $testFile .= "AppendUA={$test['appendua']}\r\n";
            }
            // see if we need to add custom scan rules
            if (array_key_exists('custom_rules', $test)) {
                foreach ($test['custom_rules'] as &$rule) {
                    $rule = trim($rule);
                    if (strlen($rule)) {
                        $testFile .= "customRule={$rule}\r\n";
                    }
                }
            }
            // Add custom metrics
            if (array_key_exists('customMetrics', $test)) {
                foreach ($test['customMetrics'] as $name => $code) {
                    $testFile .= "customMetric={$name}:{$code}\r\n";
                }
            }
            if (!SubmitUrl($testId, $testFile, $test, $url)) {
                $testId = null;
            }
        }
        // log the test
        if (isset($testId)) {
            logTestMsg($testId, "Test Created");
            // store the entire test data structure JSON encoded (instead of a bunch of individual files)
            $oldUrl = @$test['url'];
            $test['url'] = $url;
            SaveTestInfo($testId, $test);
            $test['url'] = $oldUrl;
            if ($batch_locations) {
                LogTest($test, $testId, 'Multiple Locations test');
            } else {
                if ($batch) {
                    LogTest($test, $testId, 'Bulk Test');
                } else {
                    LogTest($test, $testId, $url);
                }
            }
        } else {
            // delete the test if we didn't really submit it
            delTree("{$test['path']}/");
        }
    } else {
        global $error;
        $error = 'Your test request was intercepted by our spam filters (or because we need to talk to you about how you are submitting tests)';
    }
    return $testId;
}
开发者ID:VinkenCheng,项目名称:webpagetest,代码行数:101,代码来源:runtest.php

示例2: ProcessTestShard

/**
* Process a sharded test
* 
* @param mixed $testInfo
*/
function ProcessTestShard(&$testInfo, &$test, &$delete)
{
    global $supports_sharding;
    global $tester;
    if (array_key_exists('shard_test', $testInfo) && $testInfo['shard_test']) {
        if (array_key_exists('type', $testInfo) && $testInfo['type'] == 'traceroute' || !$supports_sharding) {
            $testInfo['shard_test'] = 0;
        } else {
            $done = true;
            $assigned_run = 0;
            // find a run to assign to a tester
            for ($run = 1; $run <= $testInfo['runs']; $run++) {
                if (!array_key_exists('tester', $testInfo['test_runs'][$run])) {
                    $testInfo['test_runs'][$run]['tester'] = $tester;
                    $testInfo['test_runs'][$run]['started'] = time();
                    $testInfo['test_runs'][$run]['done'] = false;
                    $assigned_run = $run;
                    break;
                }
            }
            // go through again and see if all tests have been assigned
            for ($run = 1; $run <= $testInfo['runs']; $run++) {
                if (!array_key_exists('tester', $testInfo['test_runs'][$run])) {
                    $done = false;
                    break;
                }
            }
            if ($assigned_run) {
                logTestMsg($testInfo['id'], "Run {$assigned_run} assigned to {$tester}");
                $append = "run={$assigned_run}\r\n";
                // Figure out if this test needs to be discarded
                $index = $assigned_run;
                if (array_key_exists('discard', $testInfo)) {
                    if ($index <= $testInfo['discard']) {
                        $append .= "discardTest=1\r\n";
                        $index = 1;
                        $done = true;
                        $testInfo['test_runs'][$assigned_run]['discarded'] = true;
                    } else {
                        $index -= $testInfo['discard'];
                    }
                }
                $append .= "index={$index}\r\n";
                $insert = strpos($test, "\nurl");
                if ($insert !== false) {
                    $test = substr($test, 0, $insert + 1) . $append . substr($test, $insert + 1);
                } else {
                    $test = "run={$assigned_run}\r\n" + $test;
                }
            }
            if (!$done) {
                $delete = false;
            }
        }
    }
}
开发者ID:nowol79,项目名称:webpagetest-1,代码行数:61,代码来源:getwork.php

示例3: file_put_contents

                            file_put_contents('./video/dat/industry.dat', $data);
                            Unlock($indLock);
                        }
                    }
                }
                if ($testInfo_dirty) {
                    SaveTestInfo($id, $testInfo);
                }
                SecureDir($testPath);
                UnlockTest($testLock);
                /*************************************************************************
                 * Do No modify TestInfo after this point
                 **************************************************************************/
                // do any post-processing when the full test is complete that doesn't rely on testinfo
                if ($done) {
                    logTestMsg($id, "Test Complete");
                    // send an async request to the post-processing code so we don't block
                    SendAsyncRequest("/work/postprocess.php?test={$id}");
                }
            } else {
                logMsg("location key incorrect\n");
            }
        }
    }
}
$workdone_end = microtime(true);
/*
if (isset($workdone_video_start) && isset($workdone_video_end)) {
  $elapsed = intval(($workdone_end - $workdone_start) * 1000);
  $video_elapsed = intval(($workdone_video_end - $workdone_video_start) * 1000);
  if ($video_elapsed > 10)
开发者ID:krishnakanthpps,项目名称:webpagetest,代码行数:31,代码来源:workdone.php

示例4: SendCallback

                } else {
                    $url .= '&';
                }
                $url .= "id={$testId}";
                SendCallback($url);
            }
        }
        // send a beacon?
        if (isset($beaconUrl) && strlen($beaconUrl)) {
            if (!isset($pageData)) {
                $pageData = loadAllPageData($testPath);
            }
            include './work/beacon.inc';
            SendBeacon($beaconUrl, $id, $testPath, $testInfo, $pageData);
        }
        logTestMsg($id, "Test post-processing complete");
    }
}
function SendCallback($url)
{
    if (function_exists('curl_init')) {
        $c = curl_init();
        curl_setopt($c, CURLOPT_URL, $url);
        curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 10);
        curl_setopt($c, CURLOPT_TIMEOUT, 10);
        curl_exec($c);
        curl_close($c);
    } else {
        $context = stream_context_create(array('http' => array('header' => 'Connection: close', 'timeout' => 10)));
开发者ID:NeilBryant,项目名称:webpagetest,代码行数:31,代码来源:postprocess.php


注:本文中的logTestMsg函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。