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


PHP ValidateTestId函数代码示例

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


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

示例1: arrayLookupWithDefault

$flattenUploadedZippedHar = arrayLookupWithDefault('flattenZippedHar', $_REQUEST, false);
// The following params are set by the android agents (blaze and WebpageTest).
// TODO(skerner): POST params are not saved to disk directly, so it is hard to
// see what the agent uploaded after the fact.  Consider writing them to a
// file that gets uploaded.
$runNumber = arrayLookupWithDefault('_runNumber', $_REQUEST, null);
$runNumber = arrayLookupWithDefault('run', $_REQUEST, $runNumber);
$runIndex = arrayLookupWithDefault('index', $_REQUEST, null);
$cacheWarmed = arrayLookupWithDefault('_cacheWarmed', $_REQUEST, null);
$cacheWarmed = arrayLookupWithDefault('cached', $_REQUEST, $cacheWarmed);
$docComplete = arrayLookupWithDefault('_docComplete', $_REQUEST, null);
$onFullyLoaded = arrayLookupWithDefault('_onFullyLoaded', $_REQUEST, null);
$onRender = arrayLookupWithDefault('_onRender', $_REQUEST, null);
$urlUnderTest = arrayLookupWithDefault('_urlUnderTest', $_REQUEST, null);
$testInfo_dirty = false;
if (ValidateTestId($id)) {
    $testPath = './' . GetTestPath($id);
    if (array_key_exists('video', $_REQUEST) && $_REQUEST['video']) {
        logMsg("Video file {$id} received from {$_REQUEST['location']}");
        $dir = './' . GetVideoPath($id);
        if (array_key_exists('file', $_FILES) && array_key_exists('tmp_name', $_FILES['file'])) {
            if (!is_dir($dir)) {
                mkdir($dir, 0777, true);
            }
            $dest = $dir . '/video.mp4';
            move_uploaded_file($_FILES['file']['tmp_name'], $dest);
            @chmod($dest, 0666);
            $iniFile = $dir . '/video.ini';
            if (is_file($iniFile)) {
                $ini = file_get_contents($iniFile);
            } else {
开发者ID:krishnakanthpps,项目名称:webpagetest,代码行数:31,代码来源:workdone.php

示例2: WriteJob

/**
* Write out the actual job file
*/
function WriteJob($location, &$test, &$job, $testId)
{
    $ret = false;
    global $error;
    global $locations;
    if ($locations[$location]['relayServer']) {
        // upload the test to a the relay server
        $test['id'] = $testId;
        $ret = SendToRelay($test, $job);
    } else {
        // make sure the work directory exists
        if (!is_dir($test['workdir'])) {
            mkdir($test['workdir'], 0777, true);
        }
        $workDir = $test['workdir'];
        $locationLock = LockLocation($location);
        if (isset($locationLock)) {
            if (isset($test['affinity'])) {
                $test['job'] = "Affinity{$test['affinity']}.{$test['job']}";
            }
            $fileName = $test['job'];
            $file = "{$workDir}/{$fileName}";
            if (file_put_contents($file, $job)) {
                if (AddJobFile($workDir, $fileName, $test['priority'], $test['queue_limit'])) {
                    // store a copy of the job file with the original test in case the test fails and we need to resubmit it
                    $test['job_file'] = realpath($file);
                    if (ValidateTestId($testId)) {
                        $testPath = GetTestPath($testId);
                        if (strlen($testPath)) {
                            $testPath = './' . $testPath;
                            if (!is_dir($testPath)) {
                                mkdir($testPath, 0777, true);
                            }
                            file_put_contents("{$testPath}/test.job", $job);
                        }
                    }
                    $tests = json_decode(file_get_contents("./tmp/{$location}.tests"), true);
                    if (!$tests) {
                        $tests = array();
                    }
                    $testCount = $test['runs'];
                    if (!$test['fvonly']) {
                        $testCount *= 2;
                    }
                    if (array_key_exists('tests', $tests)) {
                        $tests['tests'] += $testCount;
                    } else {
                        $tests['tests'] = $testCount;
                    }
                    file_put_contents("./tmp/{$location}.tests", json_encode($tests));
                    $ret = true;
                } else {
                    unlink($file);
                    $error = "Sorry, that test location already has too many tests pending.  Pleasy try again later.";
                }
            }
            UnlockLocation($locationLock);
        }
    }
    return $ret;
}
开发者ID:VinkenCheng,项目名称:webpagetest,代码行数:64,代码来源:runtest.php

示例3: chdir

<?php

// Compare the end-state frames across multiple tests and report how similar they are.
// Only JSON responses are supported.
chdir('..');
include 'common_lib.inc';
require_once 'video/visualProgress.inc.php';
$result = array('statusCode' => 200, 'data' => array());
if (isset($_REQUEST['tests'])) {
    $tests = explode(',', $_REQUEST['tests']);
    $baseline = null;
    foreach ($tests as $params) {
        if (preg_match('/(?P<id>[0-9a-zA-Z_]+)-r\\:(?P<run>[0-9]+)/', $params, $matches)) {
            $test = $matches['id'];
            $run = $matches['run'];
            if (ValidateTestId($test)) {
                RestoreTest($test);
                $result['data'][$test] = -1;
                $histogram = GetLastFrameHistogram($test, $run);
                if (isset($histogram)) {
                    if (isset($baseline)) {
                        $result['data'][$test] = CompareHistograms($histogram, $baseline);
                    } else {
                        $result['data'][$test] = 100;
                        $baseline = $histogram;
                    }
                }
            }
        }
    }
}
开发者ID:sethblanchard,项目名称:webpagetest,代码行数:31,代码来源:compareFrames.php

示例4: array

$tests = array();
$fastest = null;
$ready = true;
$error = null;
$endTime = 'visual';
$supports60fps = false;
if (array_key_exists('end', $_REQUEST) && strlen($_REQUEST['end'])) {
    $endTime = trim($_REQUEST['end']);
}
$compTests = explode(',', $_REQUEST['tests']);
foreach ($compTests as $t) {
    $parts = explode('-', $t);
    if (count($parts) >= 1) {
        $test = array();
        $test['id'] = $parts[0];
        if (ValidateTestId($test['id'])) {
            $test['cached'] = 0;
            $test['end'] = $endTime;
            for ($i = 1; $i < count($parts); $i++) {
                $p = explode(':', $parts[$i]);
                if (count($p) >= 2) {
                    if ($p[0] == 'r') {
                        $test['run'] = (int) $p[1];
                    }
                    if ($p[0] == 'l') {
                        $test['label'] = $p[1];
                    }
                    if ($p[0] == 'c') {
                        $test['cached'] = (int) $p[1];
                    }
                    if ($p[0] == 'e') {
开发者ID:ceeaspb,项目名称:webpagetest,代码行数:31,代码来源:filmstrip.inc.php

示例5: ParseTests

/**
* Parse the list of tests and identify the screen shots to compare
* 
*/
function ParseTests()
{
    $tests = array();
    global $median_metric;
    if (isset($_REQUEST['tests'])) {
        $groups = explode(',', $_REQUEST['tests']);
        foreach ($groups as $group) {
            $parts = explode('-', $group);
            if (count($parts) >= 1 && ValidateTestId($parts[0])) {
                $test = array();
                $test['id'] = $parts[0];
                $test['cached'] = 0;
                for ($i = 1; $i < count($parts); $i++) {
                    $p = explode(':', $parts[$i]);
                    if (count($p) >= 2) {
                        if ($p[0] == 'r') {
                            $test['run'] = (int) $p[1];
                        }
                        if ($p[0] == 'l') {
                            $test['label'] = $p[1];
                        }
                        if ($p[0] == 'c') {
                            $test['cached'] = (int) $p[1];
                        }
                    }
                }
                RestoreTest($test['id']);
                $test['path'] = GetTestPath($test['id']);
                if (!isset($test['run'])) {
                    $pageData = loadAllPageData($test['path']);
                    $test['run'] = GetMedianRun($pageData, $test['cached'], $median_metric);
                }
                if (!isset($test['label'])) {
                    $label = getLabel($test['id'], $user);
                    if (!empty($label)) {
                        $test['label'] = $new_label;
                    } else {
                        $info = GetTestInfo($test['id']);
                        if ($info && isset($info['label']) && strlen($info['label'])) {
                            $test['label'] = trim($info['label']);
                        }
                    }
                }
                if (!isset($test['label'])) {
                    $test['label'] = $test['id'];
                }
                $cachedText = '';
                if ($test['cached']) {
                    $cachedText = '_Cached';
                }
                $fileBase = "{$test['path']}/{$test['run']}{$cachedText}_screen";
                if (is_file("{$fileBase}.png")) {
                    $test['image'] = "{$fileBase}.png";
                } elseif (is_file("{$fileBase}.jpg")) {
                    $test['image'] = "{$fileBase}.jpg";
                }
                if (isset($test['image'])) {
                    $size = getimagesize($test['image']);
                    if ($size && count($size) >= 2 && $size[0] > 0 && $size[1] > 0) {
                        $test['width'] = $size[0];
                        $test['height'] = $size[1];
                        $tests[] = $test;
                    }
                }
            }
        }
    }
    if (!count($tests)) {
        unset($tests);
    }
    return $tests;
}
开发者ID:NeilBryant,项目名称:webpagetest,代码行数:76,代码来源:compare_screens.php

示例6: chdir

<?php

chdir('..');
include 'common.inc';
$id = $_REQUEST['id'];
$file = './' . GetVideoPath($id) . '/video.mp4';
if (ValidateTestId($id) && is_file($file)) {
    header('Content-disposition: attachment; filename=video.mp4');
    header('Content-type: video/mp4');
    readfile_chunked($file);
} else {
    ?>
<!DOCTYPE html>
<html>
    <head>
        <title>WebPagetest - Visual Comparison</title>
        <?php 
    $gaTemplate = 'Video Download Error';
    include 'head.inc';
    ?>
        <style type="text/css">
            div.content
            {
                text-align:center;
                background: black;
                color: white;
                font-family: arial,sans-serif
            }
            .link
            {
                text-decoration: none;
开发者ID:ceeaspb,项目名称:webpagetest,代码行数:31,代码来源:download.php

示例7: ob_start

ob_start();
set_time_limit(300);
include 'common.inc';
$pub = $settings['publishTo'];
if (!isset($pub) || !strlen($pub)) {
    $pub = $_SERVER['HTTP_HOST'];
}
$noheaders = false;
if (array_key_exists('noheaders', $_REQUEST) && $_REQUEST['noheaders']) {
    $noheaders = true;
}
$id = null;
if (array_key_exists('test', $_REQUEST) && strlen($_REQUEST['test'])) {
    $id = $_REQUEST['test'];
    ValidateTestId($id);
}
$page_keywords = array('Publish', 'Webpagetest', 'Website Speed Test', 'Page Speed');
$page_description = "Publish test results to WebPagetest.";
?>
<!DOCTYPE html>
<html>
    <head>
        <title>WebPagetest - Publish</title>
        <?php 
$gaTemplate = 'Publish';
include 'head.inc';
?>
    </head>
    <body>
        <div class="page">
开发者ID:NeilBryant,项目名称:webpagetest,代码行数:30,代码来源:publish.php

示例8: array

                $url = $pageData['URL'];
            }
            $bulk['urls'][] = array('u' => $url, 'id' => $test_id);
        }
    }
    gz_file_put_contents("{$testPath}/bulk.json", json_encode($bulk));
    // Return the test ID (or redirect if not using the API)
    TestResult($test, $error);
} elseif (array_key_exists('devtools', $_FILES)) {
    if (ValidateKey()) {
        /****************************************************************************
         * Importing a test
         ****************************************************************************/
        $id = null;
        $error = null;
        if (array_key_exists('test', $_REQUEST) && ValidateTestId($_REQUEST['test'])) {
            $id = $_REQUEST['test'];
            RestoreTest($id);
            $test = GetTestInfo($id);
            if ($test) {
                $test['runs']++;
                $run = $test['runs'];
                if ((array_key_exists('key', $test) && strlen($test['key']) || array_key_exists('k', $_REQUEST) && strlen($_REQUEST['k'])) && $_REQUEST['k'] !== $test['key']) {
                    $error = "API Key Doesn't match key for existing test";
                }
            } else {
                $error = "Invalid Test ID";
            }
        } else {
            $test = array('runs' => 1, 'discard' => 0, 'fvonly' => 1);
            $test['location'] = 'Imported';
开发者ID:sethblanchard,项目名称:webpagetest,代码行数:31,代码来源:import.php

示例9: DateTime

<?php

require_once './common.inc';
if (array_key_exists('original', $_REQUEST) && array_key_exists('optimized', $_REQUEST)) {
    $original = $_REQUEST['original'];
    $optimized = $_REQUEST['optimized'];
    if (ValidateTestId($original) && ValidateTestId($optimized)) {
        // Write out the fake testinfo (use the original test as a template)
        $today = new DateTime("now", new DateTimeZone('UTC'));
        $test = GetTestInfo($original);
        if (isset($test) && is_array($test) && count($test)) {
            $test['id'] = $today->format('ymd') . '_PSS_' . md5(uniqid(rand(), true));
            $test['path'] = './' . GetTestPath($test['id']);
            $test['batch'] = 1;
            $test['label'] = 'PageSpeed Service Comparison';
            if (array_key_exists('url', $test) && strlen($test['url'])) {
                $test['label'] .= ' for ' . $test['url'];
            }
            $test['view'] = 'pss';
            if (!is_dir($test['path'])) {
                mkdir($test['path'], 0777, true);
            }
            SaveTestInfo($test['id'], $test);
            // write out the bulk test data
            $tests = array();
            $tests['variations'] = array();
            $tests['urls'] = array();
            $tests['urls'][] = array('u' => $test['url'], 'l' => 'Original', 'id' => $original);
            $tests['urls'][] = array('u' => $test['url'], 'l' => 'Optimized', 'id' => $optimized);
            gz_file_put_contents("./{$test['path']}/bulk.json", json_encode($tests));
            // redirect
开发者ID:Pankajchandan,项目名称:WPT-server,代码行数:31,代码来源:create_pss.php


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