1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-29 17:00:59 +01:00
phorge-phorge/resources/sql/autopatches/20180214.harbor.01.aborted.php
2018-02-17 04:36:25 -08:00

28 lines
623 B
PHP

<?php
$table = new HarbormasterBuildable();
$conn = $table->establishConnection('w');
foreach (new LiskMigrationIterator($table) as $buildable) {
if ($buildable->getBuildableStatus() !== 'building') {
continue;
}
$aborted = queryfx_one(
$conn,
'SELECT * FROM %T WHERE buildablePHID = %s AND buildStatus = %s
LIMIT 1',
id(new HarbormasterBuild())->getTableName(),
$buildable->getPHID(),
'aborted');
if (!$aborted) {
continue;
}
queryfx(
$conn,
'UPDATE %T SET buildableStatus = %s WHERE id = %d',
$table->getTableName(),
'failed',
$buildable->getID());
}