1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 02:32:42 +01:00
phorge-phorge/resources/sql/autopatches/20180214.harbor.01.aborted.php

29 lines
623 B
PHP
Raw Normal View History

<?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());
}