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

Make Phriction policy migration even more robust

We have at least one project with `null` as a viewPolicy. This should get
sorted out separately, but make the migration robust against it.

Auditors: btrahan
This commit is contained in:
epriestley 2014-11-07 15:44:19 -08:00
parent 3d44941373
commit 2e13a31722

View file

@ -28,10 +28,14 @@ foreach (new LiskMigrationIterator($table) as $doc) {
->executeOne();
if ($project) {
$view_policy = nonempty($project->getViewPolicy(), $default_view_policy);
$edit_policy = nonempty($project->getEditPolicy(), $default_edit_policy);
$project_name = $project->getName();
echo "Migrating doc $id to project policy $project_name...\n";
$doc->setViewPolicy($project->getViewPolicy());
$doc->setEditPolicy($project->getEditPolicy());
$doc->setViewPolicy($view_policy);
$doc->setEditPolicy($edit_policy);
$doc->save();
continue;
}