示例#1
0
<?php

require_once 'JsonSchema.php';
require_once 'JsonSchemaUndefined.php';
Dbg::$quietMode = true;
if ($_REQUEST['schema']) {
    $schema = json_decode($_REQUEST['schema']);
    if (!$schema) {
        trigger_error('Could not parse the SCHEMA object.', E_USER_ERROR);
    }
} else {
    $schema = null;
}
$json = json_decode($_REQUEST['json']);
if (!$json) {
    trigger_error('Could not parse the JSON object.', E_USER_ERROR);
}
if ($_REQUEST['typeCastMode'] == 'true') {
    JsonSchema::$checkMode = JsonSchema::CHECK_MODE_TYPE_CAST;
}
$result = JsonSchema::validate($json, $schema);
header('Content-type: application/x-json');
echo json_encode($result);
示例#2
0
        $query = "SELECT count(*) FROM regtest_results WHERE platform = ? AND build_number = ? AND date = ?";
        $stmt_is_updated = $this->prepare($query);
        $stmt_is_updated->bind_param('sis', $platform, $build_number, $date);
        $res = $stmt_is_updated->execute();
        if ($res === false) {
            echo 'Execute failed: (' . $this->errno . ') ' . $this->error;
            return false;
        } else {
            $stmt_is_updated->bind_result($count);
            $stmt_is_updated->fetch();
            $stmt_is_updated->close();
            return $count > 0;
        }
    }
}
$dbg = new Dbg('log/regtest_dbg.log');
$ini = parse_ini_file('sdcc_rw.ini');
$regTestDb = new RegTestDB($ini['host'], $ini['username'], $ini['passwd'], $ini['dbname']);
if ($regTestDb->connect_error) {
    die('Connect failed: (' . $regTestDb->connect_errno . ') ' . $regTestDb->connect_error);
}
// walk through all directories in ./regression_test_results
$d = dir('./regression_test_results');
while (false !== ($entry = $d->read())) {
    //$dbg->dbg('Testing dir ' . $d->path . '/' . $entry);
    if (is_dir($d->path . '/' . $entry) && $entry[0] != '.') {
        $dbg->dbg('Processing dir ' . $d->path . '/' . $entry);
        $sd = dir($d->path . '/' . $entry);
        $platform = $entry;
        while (false !== ($sentry = $sd->read())) {
            //$dbg->dbg('  Testing file ' . $sd->path . '/' . $sentry);