From 034064ca65d0a0e19c07d1d12486b8e09489cf4a Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 1 Mar 2010 21:39:04 +0000 Subject: [PATCH] BUGFIX: Fixed migration script for installation of subsite module. (from r89930) --- code/GroupSubsites.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/GroupSubsites.php b/code/GroupSubsites.php index 3f29fb6..2880d91 100644 --- a/code/GroupSubsites.php +++ b/code/GroupSubsites.php @@ -34,7 +34,7 @@ class GroupSubsites extends DataObjectDecorator implements PermissionProvider { // Detection of SubsiteID field is the trigger for old-style-subsiteID migration if(isset($groupFields['SubsiteID'])) { // Migrate subsite-specific data - DB::query('INSERT INTO "Group_Subsites" ("GroupID", "SubsiteID") + DB::query('INSERT INTO "Group_Subsites" ("GroupID", "SubsiteID") SELECT "ID", "SubsiteID" FROM "Group" WHERE "SubsiteID" > 0'); // Migrate global-access data @@ -45,10 +45,10 @@ class GroupSubsites extends DataObjectDecorator implements PermissionProvider { // No subsite access on anything means that we've just installed the subsites module. // Make all previous groups global-access groups - } else if(!DB::query('SELECT "ID" FROM "Group" WHERE "AccessAllSubsites" = 1 - OR "Group_Subsites"."GroupID" IS NOT NULL - LEFT JOIN "Group_Subsites" ON "Group_Subsites"."GroupID" = "Group"."ID" - AND "Group_Subsites"."SubsiteID" > 0')->value()) { + } else if(!DB::query('SELECT "Group"."ID" FROM "Group" + LEFT JOIN "Group_Subsites" ON "Group_Subsites"."GroupID" = "Group"."ID" AND "Group_Subsites"."SubsiteID" > 0 + WHERE "AccessAllSubsites" = 1 + OR "Group_Subsites"."GroupID" IS NOT NULL ')->value()) { DB::query('UPDATE "Group" SET "AccessAllSubsites" = 1'); }