1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Minor, make Phriction migration a little more robust

On secure.phabricator.com, we have at least one page with a bad project slug
from long ago. Make the migration recover in this case.

Auditors: btrahan
This commit is contained in:
epriestley 2014-11-07 15:42:16 -08:00
parent c8d20d3c66
commit 3d44941373

View file

@ -27,21 +27,20 @@ foreach (new LiskMigrationIterator($table) as $doc) {
->withPhrictionSlugs($project_slugs)
->executeOne();
if ($project) {
$project_name = $project->getName();
echo "Migrating doc $id to project policy $project_name...\n";
$doc->setViewPolicy($project->getViewPolicy());
$doc->setEditPolicy($project->getEditPolicy());
$doc->save();
// non-project documents get the most open policy possible
} else {
continue;
}
}
echo "Migrating doc $id to default install policy...\n";
$doc->setViewPolicy($default_view_policy);
$doc->setEditPolicy($default_edit_policy);
$doc->save();
}
}
echo "Done.\n";