-
-
Save boombatower/835740 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* On Git migration day we have to clean out the existing tests of | |
* testable branches so they can be tested again. The ones that will already be | |
* there on QA are all not testable. | |
* | |
* This is a translation of the pseudocode in | |
* http://drupal.org/node/1057146#comment-4073288 | |
* | |
* It seems to work, and if I'm not mistaken it won't do any damage, but would | |
* appreciate review. | |
* | |
*/ | |
module_load_include('cron.inc', 'pift'); | |
$api_versions = pift_core_api_versions(); | |
$result = db_query('SELECT p.uri, p.nid from {project_projects} p, {pift_project} pp where pp.pid = p.nid'); | |
while ($row = db_fetch_array($result)) { | |
$projects[$row['nid']] = $row['uri']; | |
} | |
foreach ($projects as $nid => $shortname) { | |
$result = db_query('SELECT nid AS release_nid, tag FROM {project_release_nodes} WHERE pid = %d', $nid); | |
while ($row = db_fetch_array($result)) { | |
print "Processing release $shortname: " . $row['tag'] . "\n"; | |
if ($node = node_load($row['release_nid'])) { | |
$tids = array_keys($node->taxonomy); | |
if (array_key_exists($node->project_release['version_api_tid'], $api_versions)) { | |
$result = db_query('SELECT test_id, status, FROM_UNIXTIME(last_tested) AS last_tested FROM {pift_test} WHERE type = %d AND id = %d', PIFT_TYPE_RELEASE, $node->nid); | |
while ($row = db_fetch_array($result)) { | |
print " Requeueing {$row['test_id']} status={$row['status']} last_tested={$row['last_tested']}\n"; | |
pift_test_requeue($row['test_id']); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment