Ejemplo n.º 1
0
function delete_run($run_id, $build_id)
{
    global $db;
    $db->begin_transaction();
    $build_counts = $db->query_and_fetch_all('SELECT COUNT(*) FROM test_runs WHERE run_build = $1', array($build_id));
    if (!$build_counts) {
        $db->rollback_transaction();
        return notice("Failed to obtain the number of runs for the build {$build_id}");
    }
    if ($build_counts[0]['count'] != 1) {
        $db->rollback_transaction();
        return notice("The build {$build_id} doesn't have exactly one run. Either the build id is wrong or it's not a synthetic build.");
    }
    $removed_runs = $db->query_and_fetch_all('DELETE FROM test_runs WHERE run_id = $1 RETURNING run_build', array($run_id));
    if (!$removed_runs || count($removed_runs) != 1) {
        $db->rollback_transaction();
        return notice("Failed to delete the run {$run_id}.");
    }
    $associated_build = $removed_runs[0]['run_build'];
    if ($associated_build != $build_id) {
        $db->rollback_transaction();
        return notice("Failed to delete the run {$run_id} because it was associated with the build {$associated_build} instead of the build {$build_id}");
    }
    $removed_builds = $db->query_and_get_affected_rows('DELETE FROM builds WHERE build_id = $1', array($build_id));
    if (!$removed_runs || count($removed_runs) != 1) {
        $db->rollback_transaction();
        return notice("Failed to delete the build {$build_id}.");
    }
    $db->commit_transaction();
    regenerate_manifest();
}
Ejemplo n.º 2
0
    if ($db->query_and_get_affected_rows('UPDATE analysis_tasks SET task_platform = $1 WHERE task_platform = $2', array($destination_platform, $platform_to_merge)) === FALSE) {
        $db->rollback_transaction();
        return notice('Failed to migrate analysis tasks.');
    }
    $db->query_and_get_affected_rows('DELETE FROM triggerable_configurations WHERE trigconfig_platform = $1', array($platform_to_merge));
    if ($db->query_and_get_affected_rows('UPDATE build_requests SET request_platform = $1 WHERE request_platform = $2', array($destination_platform, $platform_to_merge)) === FALSE) {
        $db->rollback_transaction();
        return notice('Failed to migrate build requests.');
    }
    $db->query_and_get_affected_rows('DELETE FROM platforms WHERE platform_id = $1', array($platform_to_merge));
    $db->commit_transaction();
}
if ($db) {
    if ($action == 'update') {
        if (update_field('platforms', 'platform', 'name') || update_field('platforms', 'platform', 'hidden')) {
            regenerate_manifest();
        } else {
            notice('Invalid parameters.');
        }
    } else {
        if ($action == 'merge') {
            merge_platforms(intval($_POST['id']), intval($_POST['destination']));
        }
    }
    $platforms = $db->fetch_table('platforms', 'platform_name');
    function merge_list($platform_row)
    {
        global $db;
        global $platforms;
        $id = $platform_row['platform_id'];
        $content = <<<END
Ejemplo n.º 3
0
<?php

require_once '../include/admin-header.php';
require_once '../include/manifest.php';
if ($db) {
    if (regenerate_manifest()) {
        notice("Regenerated the manifest");
    }
}
require '../include/admin-footer.php';