mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +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:
parent
c8d20d3c66
commit
3d44941373
1 changed files with 13 additions and 14 deletions
|
@ -27,21 +27,20 @@ foreach (new LiskMigrationIterator($table) as $doc) {
|
|||
->withPhrictionSlugs($project_slugs)
|
||||
->executeOne();
|
||||
|
||||
$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 {
|
||||
|
||||
echo "Migrating doc $id to default install policy...\n";
|
||||
$doc->setViewPolicy($default_view_policy);
|
||||
$doc->setEditPolicy($default_edit_policy);
|
||||
$doc->save();
|
||||
|
||||
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();
|
||||
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";
|
||||
|
|
Loading…
Reference in a new issue