• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP exit_with_error函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

function main($post_data)
{
    $db = new Database();
    if (!$db->connect()) {
        exit_with_error('DatabaseConnectionFailure');
    }
    $report = json_decode($post_data, true);
    verify_slave($db, $report);
    $commits = array_get($report, 'commits', array());
    foreach ($commits as $commit_info) {
        if (!array_key_exists('repository', $commit_info)) {
            exit_with_error('MissingRepositoryName', array('commit' => $commit_info));
        }
        if (!array_key_exists('revision', $commit_info)) {
            exit_with_error('MissingRevision', array('commit' => $commit_info));
        }
        require_format('Revision', $commit_info['revision'], '/^[A-Za-z0-9 \\.]+$/');
        if (array_key_exists('author', $commit_info) && !is_array($commit_info['author'])) {
            exit_with_error('InvalidAuthorFormat', array('commit' => $commit_info));
        }
    }
    $db->begin_transaction();
    foreach ($commits as $commit_info) {
        $repository_id = $db->select_or_insert_row('repositories', 'repository', array('name' => $commit_info['repository']));
        if (!$repository_id) {
            $db->rollback_transaction();
            exit_with_error('FailedToInsertRepository', array('commit' => $commit_info));
        }
        $author = array_get($commit_info, 'author');
        $committer_id = NULL;
        if ($author) {
            $account = array_get($author, 'account');
            $committer_query = array('repository' => $repository_id, 'account' => $account);
            $committer_data = $committer_query;
            $name = array_get($author, 'name');
            if ($name) {
                $committer_data['name'] = $name;
            }
            $committer_id = $db->update_or_insert_row('committers', 'committer', $committer_query, $committer_data);
            if (!$committer_id) {
                $db->rollback_transaction();
                exit_with_error('FailedToInsertCommitter', array('committer' => $committer_data));
            }
        }
        $parent_revision = array_get($commit_info, 'parent');
        $parent_id = NULL;
        if ($parent_revision) {
            $parent_commit = $db->select_first_row('commits', 'commit', array('repository' => $repository_id, 'revision' => $parent_revision));
            if (!$parent_commit) {
                $db->rollback_transaction();
                exit_with_error('FailedToFindParentCommit', array('commit' => $commit_info));
            }
            $parent_id = $parent_commit['commit_id'];
        }
        $data = array('repository' => $repository_id, 'revision' => $commit_info['revision'], 'parent' => $parent_id, 'order' => array_get($commit_info, 'order'), 'time' => array_get($commit_info, 'time'), 'committer' => $committer_id, 'message' => array_get($commit_info, 'message'), 'reported' => true);
        $db->update_or_insert_row('commits', 'commit', array('repository' => $repository_id, 'revision' => $data['revision']), $data);
    }
    $db->commit_transaction();
    exit_with_success();
}
开发者ID:reaven15,项目名称:webkit,代码行数:60,代码来源:report-commits.php


示例2: main

function main($path)
{
    if (count($path) > 1) {
        exit_with_error('InvalidRequest');
    }
    $db = new Database();
    if (!$db->connect()) {
        exit_with_error('DatabaseConnectionFailure');
    }
    $task_id = array_get($_GET, 'task');
    $query = array();
    if ($task_id) {
        $triggerable = find_triggerable_for_task($db, $task_id);
        if (!$triggerable) {
            exit_with_error('TriggerableNotFoundForTask', array('task' => $task_id));
        }
        $query['id'] = $triggerable['id'];
    }
    $id_to_triggerable = array();
    foreach ($db->select_rows('build_triggerables', 'triggerable', $query) as $row) {
        $id = $row['triggerable_id'];
        $repositories = array();
        $id_to_triggerable[$id] = array('id' => $id, 'name' => $row['triggerable_name'], 'acceptedRepositories' => &$repositories);
    }
    foreach ($db->select_rows('triggerable_repositories', 'trigrepo', array()) as $row) {
        $triggerable = array_get($id_to_triggerable, $row['trigrepo_triggerable']);
        if ($triggerable) {
            array_push($triggerable['acceptedRepositories'], $row['trigrepo_repository']);
        }
    }
    exit_with_success(array('triggerables' => array_values($id_to_triggerable)));
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:32,代码来源:triggerables.php


示例3: main

function main($post_data)
{
    set_exit_detail('failureStored', false);
    $db = new Database();
    if (!$db->connect()) {
        exit_with_error('DatabaseConnectionFailure');
    }
    // Convert all floating points to strings to avoid parsing them in PHP.
    // FIXME: Do this conversion in the submission scripts themselves.
    $parsed_json = json_decode(preg_replace('/(?<=[\\s,\\[])(\\d+(\\.\\d+)?)(\\s*[,\\]])/', '"$1"$3', $post_data), true);
    if (!$parsed_json) {
        exit_with_error('FailedToParseJSON');
    }
    set_exit_detail('processedRuns', 0);
    foreach ($parsed_json as $i => $report) {
        $processor = new ReportProcessor($db);
        $processor->process($report);
        set_exit_detail('processedRuns', $i + 1);
    }
    $generator = new ManifestGenerator($db);
    if (!$generator->generate()) {
        exit_with_error('FailedToGenerateManifest');
    } else {
        if (!$generator->store()) {
            exit_with_error('FailedToStoreManifest');
        }
    }
    exit_with_success();
}
开发者ID:fka2004,项目名称:webkit,代码行数:29,代码来源:report.php


示例4: commit_sets_from_root_sets

function commit_sets_from_root_sets($db, $root_sets)
{
    $repository_name_to_id = array();
    foreach ($db->fetch_table('repositories') as $row) {
        $repository_name_to_id[$row['repository_name']] = $row['repository_id'];
    }
    $commit_sets = array();
    foreach ($root_sets as $repository_name => $revisions) {
        $repository_id = array_get($repository_name_to_id, $repository_name);
        if (!$repository_id) {
            exit_with_error('RepositoryNotFound', array('name' => $repository_name));
        }
        foreach ($revisions as $i => $revision) {
            $commit = $db->select_first_row('commits', 'commit', array('repository' => $repository_id, 'revision' => $revision));
            if (!$commit) {
                exit_with_error('RevisionNotFound', array('repository' => $repository_name, 'revision' => $revision));
            }
            array_set_default($commit_sets, $i, array());
            array_push($commit_sets[$i], $commit['commit_id']);
        }
    }
    $commit_count_per_set = count($commit_sets[0]);
    foreach ($commit_sets as $commits) {
        if ($commit_count_per_set != count($commits)) {
            exit_with_error('InvalidRootSets', array('rootSets' => $root_sets));
        }
    }
    return $commit_sets;
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:29,代码来源:create-test-group.php


示例5: main

function main()
{
    $data = ensure_privileged_api_data_and_token();
    $test_group_id = array_get($data, 'group');
    if (!$test_group_id) {
        exit_with_error('TestGroupNotSpecified');
    }
    $values = array();
    if (array_key_exists('name', $data)) {
        $values['name'] = $data['name'];
    }
    if (array_key_exists('hidden', $data)) {
        $values['hidden'] = Database::to_database_boolean($data['hidden']);
    }
    if (!$values) {
        exit_with_error('NothingToUpdate');
    }
    $db = connect();
    $db->begin_transaction();
    if (!$db->update_row('analysis_test_groups', 'testgroup', array('id' => $test_group_id), $values)) {
        $db->rollback_transaction();
        exit_with_error('FailedToUpdateTestGroup', array('id' => $test_group_id, 'values' => $values));
    }
    if (array_get($data, 'hidden')) {
        $db->query_and_get_affected_rows('UPDATE build_requests SET request_status = $1
            WHERE request_group = $2 AND request_status = $3', array('canceled', $test_group_id, 'pending'));
    }
    $db->commit_transaction();
    exit_with_success();
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:30,代码来源:update-test-group.php


示例6: main

function main()
{
    $data = ensure_privileged_api_data_and_token();
    $analysis_task_id = array_get($data, 'task');
    $bug_tracker_id = array_get($data, 'bugTracker');
    $bug_number = array_get($data, 'number');
    $bug_id = array_get($data, 'bugToDelete');
    $db = connect();
    $db->begin_transaction();
    if ($bug_id) {
        require_format('BugToDelete', $bug_id, '/^\\d+$/');
        $count = $db->query_and_get_affected_rows("DELETE FROM bugs WHERE bug_id = \$1", array($bug_id));
        if ($count != 1) {
            $db->rollback_transaction();
            exit_with_error('UnexpectedNumberOfAffectedRows', array('affectedRows' => $count));
        }
    } else {
        require_format('AnalysisTask', $analysis_task_id, '/^\\d+$/');
        require_format('BugTracker', $bug_tracker_id, '/^\\d+$/');
        require_format('BugNumber', $bug_number, '/^\\d+$/');
        $bug_id = $db->insert_row('bugs', 'bug', array('task' => $analysis_task_id, 'tracker' => $bug_tracker_id, 'number' => $bug_number));
    }
    $db->commit_transaction();
    exit_with_success(array('bugId' => $bug_id));
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:25,代码来源:associate-bug.php


示例7: fetch_and_push_bugs_to_tasks

function fetch_and_push_bugs_to_tasks($db, &$tasks)
{
    $task_ids = array();
    $task_by_id = array();
    foreach ($tasks as &$task) {
        array_push($task_ids, $task['id']);
        $task_by_id[$task['id']] =& $task;
    }
    $bugs = $db->query_and_fetch_all('SELECT bug_id AS "id", bug_task AS "task", bug_tracker AS "bugTracker", bug_number AS "number"
        FROM bugs WHERE bug_task = ANY ($1)', array('{' . implode(', ', $task_ids) . '}'));
    if (!is_array($bugs)) {
        exit_with_error('FailedToFetchBugs');
    }
    foreach ($bugs as $bug) {
        $associated_task =& $task_by_id[$bug['task']];
        array_push($associated_task['bugs'], $bug['id']);
    }
    $task_build_counts = $db->query_and_fetch_all('SELECT
        testgroup_task AS "task",
        count(testgroup_id) as "total",
        sum(case when request_status = \'failed\' or request_status = \'completed\' then 1 else 0 end) as "finished"
        FROM analysis_test_groups, build_requests
        WHERE request_group = testgroup_id AND testgroup_task = ANY($1) GROUP BY testgroup_task', array('{' . implode(', ', $task_ids) . '}'));
    if (!is_array($task_build_counts)) {
        exit_with_error('FailedToFetchTestGroups');
    }
    foreach ($task_build_counts as $build_count) {
        $task =& $task_by_id[$build_count['task']];
        $task['buildRequestCount'] = $build_count['total'];
        $task['finishedBuildRequestCount'] = $build_count['finished'];
    }
    return $bugs;
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:33,代码来源:analysis-tasks.php


示例8: main

function main()
{
    $program_start_time = microtime(true);
    $arguments = validate_arguments($_GET, array('platform' => 'int', 'metric' => 'int', 'testGroup' => 'int?', 'startTime' => 'int?', 'endTime' => 'int?'));
    $platform_id = $arguments['platform'];
    $metric_id = $arguments['metric'];
    $start_time = $arguments['startTime'];
    $end_time = $arguments['endTime'];
    if (!!$start_time != !!$end_time) {
        exit_with_error('InvalidTimeRange', array('startTime' => $start_time, 'endTime' => $end_time));
    }
    $db = new Database();
    if (!$db->connect()) {
        exit_with_error('DatabaseConnectionFailure');
    }
    $fetcher = new MeasurementSetFetcher($db);
    if (!$fetcher->fetch_config_list($platform_id, $metric_id)) {
        exit_with_error('ConfigurationNotFound', array('platform' => $platform_id, 'metric' => $metric_id));
    }
    $cluster_count = 0;
    while (!$fetcher->at_end()) {
        $content = $fetcher->fetch_next_cluster();
        $cluster_count++;
        if ($fetcher->at_end()) {
            $cache_filename = "measurement-set-{$platform_id}-{$metric_id}.json";
            $content['clusterCount'] = $cluster_count;
            $content['elapsedTime'] = (microtime(true) - $program_start_time) * 1000;
        } else {
            $cache_filename = "measurement-set-{$platform_id}-{$metric_id}-{$content['endTime']}.json";
        }
        $json = success_json($content);
        generate_data_file($cache_filename, $json);
    }
    echo $json;
}
开发者ID:EthanK28,项目名称:webkit,代码行数:35,代码来源:measurement-set.php


示例9: ensure_config_from_runs

function ensure_config_from_runs($db, $start_run, $end_run)
{
    $range = array('startRun' => $start_run, 'endRun' => $end_run);
    if ($start_run['run_config'] != $end_run['run_config']) {
        exit_with_error('RunConfigMismatch', $range);
    }
    return ensure_row_by_id($db, 'test_configurations', 'config', $start_run['run_config'], 'ConfigNotFound', $range);
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:8,代码来源:create-analysis-task.php


示例10: main

function main($paths)
{
    if (count($paths) < 1 || count($paths) > 2) {
        exit_with_error('InvalidRequest');
    }
    $db = new Database();
    if (!$db->connect()) {
        exit_with_error('DatabaseConnectionFailure');
    }
    $fetcher = new CommitLogFetcher($db);
    if (!is_numeric($paths[0])) {
        $repository_id = $fetcher->repository_id_from_name($paths[0]);
        if (!$repository_id) {
            exit_with_error('RepositoryNotFound', array('repositoryName' => $paths[0]));
        }
    } else {
        $repository_id = intval($paths[0]);
    }
    $filter = array_get($paths, 1);
    $commits = array();
    if (!$filter) {
        $keyword = array_get($_GET, 'keyword');
        $from = array_get($_GET, 'from');
        $to = array_get($_GET, 'to');
        $commits = $fetcher->fetch_between($repository_id, $from, $to, $keyword);
    } else {
        if ($filter == 'oldest') {
            $commits = $fetcher->fetch_oldest($repository_id);
        } else {
            if ($filter == 'latest') {
                $commits = $fetcher->fetch_latest($repository_id);
            } else {
                if ($filter == 'last-reported') {
                    $commits = $fetcher->fetch_last_reported($repository_id);
                } else {
                    if (ctype_alnum($filter)) {
                        $commits = $fetcher->fetch_revision($repository_id, $filter);
                    } else {
                        $matches = array();
                        if (!preg_match('/([A-Za-z0-9]+)[\\:\\-]([A-Za-z0-9]+)/', $filter, $matches)) {
                            exit_with_error('UnknownFilter', array('repositoryName' => $repository_name, 'filter' => $filter));
                        }
                        $commits = $fetcher->fetch_between($repository_id, $matches[1], $matches[2]);
                    }
                }
            }
        }
    }
    if (!is_array($commits)) {
        exit_with_error('FailedToFetchCommits', array('repository' => $repository_id, 'filter' => $filter));
    }
    exit_with_success(array('commits' => $commits));
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:53,代码来源:commits.php


示例11: main

function main($path)
{
    $db = new Database();
    if (!$db->connect()) {
        exit_with_error('DatabaseConnectionFailure');
    }
    if (count($path) > 1) {
        exit_with_error('InvalidRequest');
    }
    $build_requests_fetcher = new BuildRequestsFetcher($db);
    if (count($path) > 0 && $path[0]) {
        $group_id = intval($path[0]);
        $group = $db->select_first_row('analysis_test_groups', 'testgroup', array('id' => $group_id));
        if (!$group) {
            exit_with_error('GroupNotFound', array('id' => $group_id));
        }
        $test_groups = array($group);
        $build_requests_fetcher->fetch_for_group($group_id);
    } else {
        $task_id = array_get($_GET, 'task');
        if (!$task_id) {
            exit_with_error('TaskIdNotSpecified');
        }
        $test_groups = $db->select_rows('analysis_test_groups', 'testgroup', array('task' => $task_id));
        if (!is_array($test_groups)) {
            exit_with_error('FailedToFetchTestGroups');
        }
        $build_requests_fetcher->fetch_for_task($task_id);
    }
    if (!$build_requests_fetcher->has_results()) {
        exit_with_error('FailedToFetchBuildRequests');
    }
    $test_groups = array_map("format_test_group", $test_groups);
    $group_by_id = array();
    foreach ($test_groups as &$group) {
        $group_id = $group['id'];
        $group_by_id[$group_id] =& $group;
        $platforms = $db->query_and_fetch_all('SELECT DISTINCT(config_platform)
            FROM test_configurations, test_runs, build_requests
            WHERE run_config = config_id AND run_build = request_build AND request_group = $1', array($group_id));
        if ($platforms) {
            $group['platform'] = $platforms[0]['config_platform'];
        }
    }
    $build_requests = $build_requests_fetcher->results();
    foreach ($build_requests as $request) {
        $request_group =& $group_by_id[$request['testGroup']];
        array_push($request_group['buildRequests'], $request['id']);
        array_push($request_group['rootSets'], $request['rootSet']);
    }
    exit_with_success(array('testGroups' => $test_groups, 'buildRequests' => $build_requests, 'rootSets' => $build_requests_fetcher->root_sets(), 'roots' => $build_requests_fetcher->roots()));
}
开发者ID:emutavchi,项目名称:WebKitForWayland,代码行数:52,代码来源:test-groups.php


示例12: require_existence_of

function require_existence_of($array, $list_of_arguments, $prefix = '')
{
    if ($prefix) {
        $prefix .= '_';
    }
    foreach ($list_of_arguments as $key => $pattern) {
        $name = camel_case_words_separated_by_underscore($prefix . $key);
        if (!array_key_exists($key, $array)) {
            exit_with_error($name . 'NotSpecified');
        }
        require_format($name, $array[$key], $pattern);
    }
}
开发者ID:nickooms,项目名称:webkit,代码行数:13,代码来源:json-shared.php


示例13: __construct

 public function __construct($jsonFileLocation, $outputFile)
 {
     $this->jsonFileLocation = $jsonFileLocation;
     $this->json = json_decode(file_get_contents(realpath($jsonFileLocation)), true);
     $this->out = fopen($outputFile, 'w');
     if (!is_array($this->json)) {
         fclose($this->out);
         exit_with_error('invalid json file');
     }
     if ($this->out === false) {
         exit_with_error('could not open output file ./InitializerExtension.swift');
     }
 }
开发者ID:CKalnasy,项目名称:ApiSwift,代码行数:13,代码来源:Init.php


示例14: main

function main()
{
    $db = new Database();
    if (!$db->connect()) {
        exit_with_error('DatabaseConnectionFailure');
    }
    $generator = new ManifestGenerator($db);
    if (!$generator->generate()) {
        exit_with_error('FailedToGenerateManifest');
    }
    if (!$generator->store()) {
        exit_with_error('FailedToStoreManifest');
    }
    exit_with_success($generator->manifest());
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:15,代码来源:manifest.php


示例15: main

function main($path)
{
    if (count($path) != 1) {
        exit_with_error('InvalidRequest');
    }
    $parts = explode('-', $path[0]);
    if (count($parts) != 2) {
        exit_with_error('InvalidRequest');
    }
    $db = new Database();
    if (!$db->connect()) {
        exit_with_error('DatabaseConnectionFailure');
    }
    $platform_id = intval($parts[0]);
    $metric_id = intval($parts[1]);
    $config_rows = $db->query_and_fetch_all('SELECT *
        FROM test_configurations WHERE config_metric = $1 AND config_platform = $2', array($metric_id, $platform_id));
    if (!$config_rows) {
        exit_with_error('ConfigurationNotFound');
    }
    $test_group_id = array_get($_GET, 'testGroup');
    $should_cache = array_get($_GET, 'cache');
    if ($test_group_id) {
        $test_group_id = intval($test_group_id);
    } else {
        if ($should_cache) {
            // Only v1 UI needs caching.
            $maxage = config('jsonCacheMaxAge');
            header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $maxage) . ' GMT');
            header("Cache-Control: maxage={$maxage}");
        }
    }
    $generator = new RunsGenerator($config_rows);
    foreach ($config_rows as $config) {
        if ($test_group_id) {
            $raw_runs = fetch_runs_for_config_and_test_group($db, $config, $test_group_id);
        } else {
            $raw_runs = fetch_runs_for_config($db, $config);
        }
        $generator->add_runs($config['config_type'], $raw_runs);
    }
    $content = success_json($generator->results());
    if (!$test_group_id) {
        generate_data_file("{$platform_id}-{$metric_id}.json", $content);
    }
    echo $content;
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:47,代码来源:runs.php


示例16: main

function main()
{
    require_existence_of($_GET, array('builder' => '/^[A-Za-z0-9 \\(\\)\\-_]+$/'));
    $builder_name = $_GET['builder'];
    $db = connect();
    $builder_row = $db->select_first_row('builders', NULL, array('name' => $builder_name));
    if (!$builder_row) {
        exit_with_error('BuilderNotFound');
    }
    $builder_id = $builder_row['id'];
    $generator = new ResultsJSONGenerator($db, $builder_id);
    if ($generator->generate()) {
        exit_with_success();
    } else {
        exit_with_error('ResultsNotFound');
    }
}
开发者ID:kodybrown,项目名称:webkit,代码行数:17,代码来源:failing-tests.php


示例17: main

function main($post_data)
{
    set_exit_detail('failureStored', false);
    $maintenance_mode = config('maintenanceMode');
    if ($maintenance_mode && !config('maintenanceDirectory')) {
        exit_with_error('MaintenanceDirectoryNotSet');
    }
    $db = new Database();
    if (!$maintenance_mode && !$db->connect()) {
        exit_with_error('DatabaseConnectionFailure');
    }
    // Convert all floating points to strings to avoid parsing them in PHP.
    // FIXME: Do this conversion in the submission scripts themselves.
    $parsed_json = json_decode(preg_replace('/(?<=[\\s,\\[])(\\d+(\\.\\d+)?)(\\s*[,\\]])/', '"$1"$3', $post_data), true);
    if (!$parsed_json) {
        exit_with_error('FailedToParseJSON');
    }
    set_exit_detail('processedRuns', 0);
    foreach ($parsed_json as $i => $report) {
        if (!$maintenance_mode) {
            $processor = new ReportProcessor($db);
            $processor->process($report);
        }
        set_exit_detail('processedRuns', $i + 1);
    }
    if ($maintenance_mode) {
        $files = scandir(config_path('maintenanceDirectory', ''));
        $i = 0;
        $filename = '';
        do {
            $i++;
            $filename = "{$i}.json";
        } while (in_array($filename, $files));
        file_put_contents(config_path('maintenanceDirectory', $filename), $post_data, LOCK_EX);
    } else {
        $generator = new ManifestGenerator($db);
        if (!$generator->generate()) {
            exit_with_error('FailedToGenerateManifest');
        } else {
            if (!$generator->store()) {
                exit_with_error('FailedToStoreManifest');
            }
        }
    }
    exit_with_success();
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:46,代码来源:report.php


示例18: main

function main()
{
    $data = ensure_privileged_api_data_and_token();
    $run_id = array_get($data, 'run');
    if (!$run_id) {
        exit_with_error('MissingRunId');
    }
    $db = connect();
    $run = $db->select_first_row('test_runs', 'run', array('id' => $run_id));
    if (!$run) {
        exit_with_error('InvalidRun', array('run' => $run_id));
    }
    $marked_outlier = array_get($data, 'markedOutlier');
    $db->begin_transaction();
    $db->update_row('test_runs', 'run', array('id' => $run_id), array('id' => $run_id, 'marked_outlier' => $marked_outlier ? 't' : 'f'));
    $db->commit_transaction();
    exit_with_success();
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:18,代码来源:update-run-status.php


示例19: main

function main()
{
    $data = ensure_privileged_api_data_and_token();
    $analysis_task_id = array_get($data, 'task');
    if (!$analysis_task_id) {
        exit_with_error('AnalysisTaskNotSpecified');
    }
    $values = array();
    if (array_key_exists('name', $data)) {
        $values['name'] = $data['name'];
    }
    if (array_key_exists('result', $data)) {
        require_match_one_of_values('Result', $data['result'], array(null, 'progression', 'regression', 'unchanged', 'inconclusive'));
        $values['result'] = $data['result'];
    }
    if (array_key_exists('needed', $data)) {
        $needed = $data['needed'];
        if ($needed === null) {
            $values['needed'] = null;
        } else {
            if (in_array($needed, array(0, false))) {
                $values['needed'] = Database::to_database_boolean(false);
            } else {
                if (in_array($needed, array(1, true))) {
                    $values['needed'] = Database::to_database_boolean(true);
                } else {
                    exit_with_error('InvalidValueForFeedback', array('value' => $data['needed']));
                }
            }
        }
    }
    if (!$values) {
        exit_with_error('NothingToUpdate');
    }
    $db = connect();
    $db->begin_transaction();
    if (!$db->update_row('analysis_tasks', 'task', array('id' => $analysis_task_id), $values)) {
        $db->rollback_transaction();
        exit_with_error('FailedToUpdateTask', array('id' => $analysis_task_id, 'values' => $values));
    }
    $db->commit_transaction();
    exit_with_success();
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:43,代码来源:update-analysis-task.php


示例20: main

function main()
{
    $data = ensure_privileged_api_data_and_token();
    $analysis_task_id = array_get($data, 'task');
    $repository_id = array_get($data, 'repository');
    $revision = array_get($data, 'revision');
    $kind = array_get($data, 'kind');
    $commit_id_to_diassociate = array_get($data, 'commit');
    $db = connect();
    $db->begin_transaction();
    require_format('AnalysisTask', $analysis_task_id, '/^\\d+$/');
    if ($commit_id_to_diassociate) {
        require_format('Commit', $commit_id_to_diassociate, '/^\\d*$/');
        $count = $db->query_and_get_affected_rows("DELETE FROM task_commits WHERE taskcommit_task = \$1 AND taskcommit_commit = \$2", array($analysis_task_id, $commit_id_to_diassociate));
        if ($count != 1) {
            $db->rollback_transaction();
            exit_with_error('UnexpectedNumberOfAffectedRows', array('affectedRows' => $count));
        }
    } else {
        require_format('Repository', $repository_id, '/^\\d+$/');
        require_format('Kind', $kind, '/^(cause|fix)$/');
        $commit_info = array('repository' => $repository_id, 'revision' => $revision);
        $commit_rows = $db->query_and_fetch_all('SELECT commit_id FROM commits WHERE commit_repository = $1 AND commit_revision LIKE $2 LIMIT 2', array($repository_id, '%' . Database::escape_for_like($revision) . '%'));
        if (count($commit_rows) > 1) {
            $db->rollback_transaction();
            exit_with_error('AmbiguousRevision', $commit_info);
        } else {
            if (!$commit_rows) {
                $db->rollback_transaction();
                exit_with_error('CommitNotFound', $commit_info);
            }
        }
        $commit_id = $commit_rows[0]['commit_id'];
        $association = array('task' => $analysis_task_id, 'commit' => $commit_id, 'is_fix' => Database::to_database_boolean($kind == 'fix'));
        $commit_id = $db->update_or_insert_row('task_commits', 'taskcommit', array('task' => $analysis_task_id, 'commit' => $commit_id), $association, 'commit');
        if (!$commit_id) {
            $db->rollback_transaction();
            exit_with_error('FailedToAssociateCommit', $association);
        }
    }
    $db->commit_transaction();
    exit_with_success();
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:43,代码来源:associate-commit.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP exit_with_success函数代码示例发布时间:2022-05-15
下一篇:
PHP exit_permission_denied函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap