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:
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)
|
->withPhrictionSlugs($project_slugs)
|
||||||
->executeOne();
|
->executeOne();
|
||||||
|
|
||||||
$project_name = $project->getName();
|
if ($project) {
|
||||||
echo "Migrating doc $id to project policy $project_name...\n";
|
$project_name = $project->getName();
|
||||||
$doc->setViewPolicy($project->getViewPolicy());
|
echo "Migrating doc $id to project policy $project_name...\n";
|
||||||
$doc->setEditPolicy($project->getEditPolicy());
|
$doc->setViewPolicy($project->getViewPolicy());
|
||||||
$doc->save();
|
$doc->setEditPolicy($project->getEditPolicy());
|
||||||
|
$doc->save();
|
||||||
// non-project documents get the most open policy possible
|
continue;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
echo "Migrating doc $id to default install policy...\n";
|
|
||||||
$doc->setViewPolicy($default_view_policy);
|
|
||||||
$doc->setEditPolicy($default_edit_policy);
|
|
||||||
$doc->save();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "Migrating doc $id to default install policy...\n";
|
||||||
|
$doc->setViewPolicy($default_view_policy);
|
||||||
|
$doc->setEditPolicy($default_edit_policy);
|
||||||
|
$doc->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Done.\n";
|
echo "Done.\n";
|
||||||
|
|
Loading…
Reference in a new issue