本文整理汇总了PHP中exit_with_success函数的典型用法代码示例。如果您正苦于以下问题:PHP exit_with_success函数的具体用法?PHP exit_with_success怎么用?PHP exit_with_success使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了exit_with_success函数的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($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
示例3: 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
示例4: 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
示例5: 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
示例6: main
function main($id, $path, $post_data)
{
if (!$id && (count($path) < 1 || count($path) > 2)) {
exit_with_error('InvalidRequest');
}
$db = new Database();
if (!$db->connect()) {
exit_with_error('DatabaseConnectionFailure');
}
$report = $post_data ? json_decode($post_data, true) : array();
$updates = array_get($report, 'buildRequestUpdates');
if ($updates) {
verify_slave($db, $report);
update_builds($db, $updates);
}
$requests_fetcher = new BuildRequestsFetcher($db);
if ($id) {
$requests_fetcher->fetch_request($id);
} else {
$triggerable_query = array('name' => array_get($path, 0));
$triggerable = $db->select_first_row('build_triggerables', 'triggerable', $triggerable_query);
if (!$triggerable) {
exit_with_error('TriggerableNotFound', $triggerable_query);
}
$requests_fetcher->fetch_incomplete_requests_for_triggerable($triggerable['triggerable_id']);
}
exit_with_success(array('buildRequests' => $requests_fetcher->results_with_resolved_ids(), 'rootSets' => $requests_fetcher->root_sets(), 'roots' => $requests_fetcher->roots(), 'updates' => $updates));
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:28,代码来源:build-requests.php
示例7: 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');
}
if (!is_numeric($paths[0])) {
$repository_name = $paths[0];
$repository_row = $db->select_first_row('repositories', 'repository', array('name' => $repository_name));
if (!$repository_row) {
exit_with_error('RepositoryNotFound', array('repositoryName' => $repository_name));
}
$repository_id = $repository_row['repository_id'];
} else {
$repository_id = intval($paths[0]);
}
$filter = array_get($paths, 1);
$single_commit = NULL;
$commits = array();
if (!$filter) {
$keyword = array_get($_GET, 'keyword');
$from = array_get($_GET, 'from');
$to = array_get($_GET, 'to');
$commits = fetch_commits_between($db, $repository_id, $from, $to, $keyword);
} else {
if ($filter == 'oldest') {
$single_commit = $db->select_first_row('commits', 'commit', array('repository' => $repository_id), 'time');
} else {
if ($filter == 'latest') {
$single_commit = $db->select_last_row('commits', 'commit', array('repository' => $repository_id), 'time');
} else {
if ($filter == 'last-reported') {
$single_commit = $db->select_last_row('commits', 'commit', array('repository' => $repository_id, 'reported' => true), 'time');
} else {
if (ctype_alnum($filter)) {
$single_commit = commit_from_revision($db, $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 = fetch_commits_between($db, $repository_id, $matches[1], $matches[2]);
}
}
}
}
}
if ($single_commit) {
$committer = $db->select_first_row('committers', 'committer', array('id' => $single_commit['commit_committer']));
exit_with_success(array('commits' => array(format_commit($single_commit, $committer))));
}
exit_with_success(array('commits' => $commits));
}
开发者ID:rhythmkay,项目名称:webkit,代码行数:56,代码来源:commits.php
示例8: 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
示例9: 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
示例10: main
function main()
{
$db = connect();
$data = ensure_privileged_api_data_and_token_or_slave($db);
$author = remote_user_name($data);
$name = array_get($data, 'name');
$start_run_id = array_get($data, 'startRun');
$end_run_id = array_get($data, 'endRun');
$segmentation_name = array_get($data, 'segmentationStrategy');
$test_range_name = array_get($data, 'testRangeStrategy');
if (!$name) {
exit_with_error('MissingName', array('name' => $name));
}
$range = array('startRunId' => $start_run_id, 'endRunId' => $end_run_id);
if (!$start_run_id || !$end_run_id) {
exit_with_error('MissingRange', $range);
}
$start_run = ensure_row_by_id($db, 'test_runs', 'run', $start_run_id, 'InvalidStartRun', $range);
$end_run = ensure_row_by_id($db, 'test_runs', 'run', $end_run_id, 'InvalidEndRun', $range);
$config = ensure_config_from_runs($db, $start_run, $end_run);
$start_run_time = time_for_run($db, $start_run_id);
$end_run_time = time_for_run($db, $end_run_id);
if (!$start_run_time || !$end_run_time) {
exit_with_error('InvalidTimeRange', array('startTime' => $start_run_time, 'endTime' => $end_run_time));
}
$db->begin_transaction();
$segmentation_id = NULL;
if ($segmentation_name) {
$segmentation_id = $db->select_or_insert_row('analysis_strategies', 'strategy', array('name' => $segmentation_name));
if (!$segmentation_id) {
$db->rollback_transaction();
exit_with_error('CannotFindOrInsertSegmentationStrategy', array('segmentationStrategy' => $segmentation_name));
}
}
$test_range_id = NULL;
if ($test_range_name) {
$test_range_id = $db->select_or_insert_row('analysis_strategies', 'strategy', array('name' => $test_range_name));
if (!$test_range_id) {
$db->rollback_transaction();
exit_with_error('CannotFindOrInsertTestRangeStrategy', array('testRangeStrategy' => $test_range_name));
}
}
$duplicate = $db->select_first_row('analysis_tasks', 'task', array('start_run' => $start_run_id, 'end_run' => $end_run_id));
if ($duplicate) {
$db->rollback_transaction();
exit_with_error('DuplicateAnalysisTask', array('duplicate' => $duplicate));
}
$task_id = $db->insert_row('analysis_tasks', 'task', array('name' => $name, 'author' => $author, 'platform' => $config['config_platform'], 'metric' => $config['config_metric'], 'start_run' => $start_run_id, 'start_run_time' => $start_run_time, 'end_run' => $end_run_id, 'end_run_time' => $end_run_time, 'segmentation' => $segmentation_id, 'test_range' => $test_range_id));
$db->commit_transaction();
exit_with_success(array('taskId' => $task_id));
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:51,代码来源:create-analysis-task.php
示例11: 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
示例12: main
function main()
{
$db = connect();
$data = ensure_privileged_api_data_and_token_or_slave($db);
$author = remote_user_name($data);
$task_id = array_get($data, 'task');
$name = array_get($data, 'name');
$root_sets = array_get($data, 'rootSets');
$repetition_count = intval(array_get($data, 'repetitionCount', 1));
if (!$name) {
exit_with_error('MissingName');
}
if (!$root_sets) {
exit_with_error('MissingRootSets');
}
if ($repetition_count < 1) {
exit_with_error('InvalidRepetitionCount', array('repetitionCount' => $repetition_count));
}
$task = $db->select_first_row('analysis_tasks', 'task', array('id' => $task_id));
if (!$task) {
exit_with_error('InvalidTask', array('task' => $task_id));
}
$triggerable = find_triggerable_for_task($db, $task_id);
if (!$triggerable) {
exit_with_error('TriggerableNotFoundForTask', array('task' => $task_id));
}
$commit_sets = commit_sets_from_root_sets($db, $root_sets);
$db->begin_transaction();
$root_set_id_list = array();
foreach ($commit_sets as $commit_list) {
$root_set_id = $db->insert_row('root_sets', 'rootset', array());
foreach ($commit_list as $commit) {
$db->insert_row('roots', 'root', array('set' => $root_set_id, 'commit' => $commit), 'commit');
}
array_push($root_set_id_list, $root_set_id);
}
$group_id = $db->insert_row('analysis_test_groups', 'testgroup', array('task' => $task['task_id'], 'name' => $name, 'author' => $author));
$order = 0;
for ($i = 0; $i < $repetition_count; $i++) {
foreach ($root_set_id_list as $root_set_id) {
$db->insert_row('build_requests', 'request', array('triggerable' => $triggerable['id'], 'platform' => $triggerable['platform'], 'test' => $triggerable['test'], 'group' => $group_id, 'order' => $order, 'root_set' => $root_set_id));
$order++;
}
}
$db->commit_transaction();
exit_with_success(array('testGroupId' => $group_id));
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:47,代码来源:create-test-group.php
示例13: 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
示例14: main
function main($path)
{
$db = new Database();
if (!$db->connect()) {
exit_with_error('DatabaseConnectionFailure');
}
if (count($path) > 1) {
exit_with_error('InvalidRequest');
}
$build_request_id = array_get($_GET, 'buildRequest');
$task_id = count($path) > 0 && $path[0] ? $path[0] : array_get($_GET, 'id');
if ($build_request_id) {
$tasks = $db->query_and_fetch_all('SELECT analysis_tasks.* FROM build_requests, analysis_test_groups, analysis_tasks
WHERE request_id = $1 AND request_group = testgroup_id AND testgroup_task = task_id', array(intval($build_request_id)));
if (!$tasks) {
exit_with_error('TaskNotFound', array('buildRequest' => $build_request_id));
}
} else {
if ($task_id) {
$task_id = intval($task_id);
$task = $db->select_first_row('analysis_tasks', 'task', array('id' => $task_id));
if (!$task) {
exit_with_error('TaskNotFound', array('id' => $task_id));
}
$tasks = array($task);
} else {
$metric_id = array_get($_GET, 'metric');
$platform_id = array_get($_GET, 'platform');
if (!!$metric_id != !!$platform_id) {
exit_with_error('InvalidArguments', array('metricId' => $metric_id, 'platformId' => $platform_id));
}
if ($metric_id) {
$tasks = $db->select_rows('analysis_tasks', 'task', array('platform' => $platform_id, 'metric' => $metric_id));
} else {
// FIXME: Limit the number of tasks we fetch.
$tasks = array_reverse($db->fetch_table('analysis_tasks', 'task_created_at'));
}
if (!is_array($tasks)) {
exit_with_error('FailedToFetchTasks');
}
}
}
$tasks = array_map("format_task", $tasks);
$bugs = fetch_and_push_bugs_to_tasks($db, $tasks);
exit_with_success(array('analysisTasks' => $tasks, 'bugs' => $bugs));
}
开发者ID:kiranchandramohan,项目名称:webkit,代码行数:46,代码来源:analysis-tasks.php
示例15: 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
示例16: 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
示例17: 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
示例18: 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
示例19: main
function main()
{
$program_start_time = microtime(true);
$arguments = validate_arguments($_GET, array('platform' => 'int?', 'metric' => 'int?', 'analysisTask' => 'int?'));
$platform_id = $arguments['platform'];
$metric_id = $arguments['metric'];
$task_id = $arguments['analysisTask'];
if (!($platform_id && $metric_id && !$task_id || $task_id && !$platform_id && !$metric_id)) {
exit_with_error('AmbiguousRequest');
}
$db = new Database();
if (!$db->connect()) {
exit_with_error('DatabaseConnectionFailure');
}
if ($task_id) {
$fetcher = new AnalysisResultsFetcher($db, $task_id);
exit_with_success($fetcher->fetch());
}
$fetcher = new MeasurementSetFetcher($db);
if (!$fetcher->fetch_config_list($platform_id, $metric_id)) {
exit_with_error('ConfigurationNotFound', array('platform' => $platform_id, 'metric' => $metric_id));
}
if ($fetcher->at_end()) {
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
exit(404);
}
$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:Comcast,项目名称:WebKitForWayland,代码行数:42,代码来源:measurement-set.php
示例20: 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);
$triggerable_name = array_get($report, 'triggerable');
$triggerable = $db->select_first_row('build_triggerables', 'triggerable', array('name' => $triggerable_name));
if (!$triggerable) {
exit_with_error('TriggerableNotFound', array('triggerable' => $triggerable_name));
}
$triggerable_id = $triggerable['triggerable_id'];
$configurations = array_get($report, 'configurations');
if (!is_array($configurations)) {
exit_with_error('InvalidConfigurations', array('configurations' => $configurations));
}
foreach ($configurations as $entry) {
if (!is_array($entry) || !array_key_exists('test', $entry) || !array_key_exists('platform', $entry)) {
exit_with_error('InvalidConfigurationEntry', array('configurationEntry' => $entry));
}
}
$db->begin_transaction();
if ($db->query_and_get_affected_rows('DELETE FROM triggerable_configurations WHERE trigconfig_triggerable = $1', array($triggerable_id)) === false) {
$db->rollback_transaction();
exit_with_error('FailedToDeleteExistingConfigurations', array('triggerable' => $triggerable_id));
}
foreach ($configurations as $entry) {
$config_info = array('test' => $entry['test'], 'platform' => $entry['platform'], 'triggerable' => $triggerable_id);
if (!$db->insert_row('triggerable_configurations', 'trigconfig', $config_info, null)) {
$db->rollback_transaction();
exit_with_error('FailedToInsertConfiguration', array('entry' => $entry));
}
}
$db->commit_transaction();
exit_with_success();
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:38,代码来源:update-triggerable.php
注:本文中的exit_with_success函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论