diff --git a/src/Dev/FixFolderPermissionsHelper.php b/src/Dev/FixFolderPermissionsHelper.php index 2f7c8fe7..7d1895c9 100644 --- a/src/Dev/FixFolderPermissionsHelper.php +++ b/src/Dev/FixFolderPermissionsHelper.php @@ -24,11 +24,14 @@ class FixFolderPermissionsHelper */ public function run() { - SQLUpdate::create( - '"' . File::singleton()->baseTable() . '"', - ['CanViewType' => 'Inherit'], - ['ISNULL("CanViewType")', 'ClassName' => Folder::class] - )->execute(); + SQLUpdate::create() + ->setTable('"' . File::singleton()->baseTable() . '"') + ->setAssignments(['"CanViewType"' => 'Inherit']) + ->setWhere([ + '"CanViewType" IS NULL', + '"ClassName"' => Folder::class + ]) + ->execute(); // This part won't work if run from the CLI, because Apache and the CLI don't share the same cache. InheritedPermissionFlusher::flush(); diff --git a/tests/php/Dev/Tasks/FixFolderPermissionsHelperTest.php b/tests/php/Dev/Tasks/FixFolderPermissionsHelperTest.php index 48e9695e..341a50bc 100644 --- a/tests/php/Dev/Tasks/FixFolderPermissionsHelperTest.php +++ b/tests/php/Dev/Tasks/FixFolderPermissionsHelperTest.php @@ -18,9 +18,9 @@ public function testTask() $task = new FixFolderPermissionsHelper(); $updated = $task->run(); - $this->assertEquals('Inherit', Folder::get()->where(['Name' => 'ParentFolder'])->first()->CanViewType); - $this->assertEquals('Anyone', Folder::get()->where(['Name' => 'SubFolder'])->first()->CanViewType); - $this->assertEquals('Inherit', Folder::get()->where(['Name' => 'AnotherFolder'])->first()->CanViewType); + $this->assertEquals('Inherit', Folder::get()->filter('Name', 'ParentFolder')->first()->CanViewType); + $this->assertEquals('Anyone', Folder::get()->filter('Name', 'SubFolder')->first()->CanViewType); + $this->assertEquals('Inherit', Folder::get()->filter('Name', 'AnotherFolder')->first()->CanViewType); $this->assertEquals(2, $updated); } }