diff --git a/resources/sql/autopatches/20141107.phriction.policy.2.php b/resources/sql/autopatches/20141107.phriction.policy.2.php index b55b7ebe0b..9c0b8ad4d2 100644 --- a/resources/sql/autopatches/20141107.phriction.policy.2.php +++ b/resources/sql/autopatches/20141107.phriction.policy.2.php @@ -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";