2013-07-18 01:43:37 +02:00
|
|
|
<?php
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Archiving projects with no members...')."\n";
|
2013-07-18 01:43:37 +02:00
|
|
|
|
|
|
|
$table = new PhabricatorProject();
|
|
|
|
$table->openTransaction();
|
|
|
|
|
|
|
|
foreach (new LiskMigrationIterator($table) as $project) {
|
|
|
|
$members = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
|
|
|
$project->getPHID(),
|
2015-01-02 00:10:58 +01:00
|
|
|
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST);
|
2013-07-18 01:43:37 +02:00
|
|
|
|
|
|
|
if (count($members)) {
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht(
|
2013-07-18 01:43:37 +02:00
|
|
|
'Project "%s" has %d members; skipping.',
|
|
|
|
$project->getName(),
|
|
|
|
count($members)), "\n";
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($project->getStatus() == PhabricatorProjectStatus::STATUS_ARCHIVED) {
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht(
|
2013-07-18 01:43:37 +02:00
|
|
|
'Project "%s" already archived; skipping.',
|
|
|
|
$project->getName()), "\n";
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Archiving project "%s"...', $project->getName())."\n";
|
2013-07-18 01:43:37 +02:00
|
|
|
queryfx(
|
|
|
|
$table->establishConnection('w'),
|
|
|
|
'UPDATE %T SET status = %s WHERE id = %d',
|
|
|
|
$table->getTableName(),
|
|
|
|
PhabricatorProjectStatus::STATUS_ARCHIVED,
|
|
|
|
$project->getID());
|
|
|
|
}
|
|
|
|
|
|
|
|
$table->saveTransaction();
|
2015-05-22 09:27:56 +02:00
|
|
|
echo "\n".pht('Done.')."\n";
|