BUGFIX: Fixed migration script for installation of subsite module. (from r89930)

This commit is contained in:
Tom Rix 2010-03-01 21:39:04 +00:00
parent f7abf23ac7
commit 034064ca65
1 changed files with 5 additions and 5 deletions

View File

@ -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');
}