mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 09:05:55 +00:00
BUGFIX: Fixed migration script for installation of subsite module. (from r89930)
This commit is contained in:
parent
f7abf23ac7
commit
034064ca65
@ -34,7 +34,7 @@ class GroupSubsites extends DataObjectDecorator implements PermissionProvider {
|
|||||||
// Detection of SubsiteID field is the trigger for old-style-subsiteID migration
|
// Detection of SubsiteID field is the trigger for old-style-subsiteID migration
|
||||||
if(isset($groupFields['SubsiteID'])) {
|
if(isset($groupFields['SubsiteID'])) {
|
||||||
// Migrate subsite-specific data
|
// 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');
|
SELECT "ID", "SubsiteID" FROM "Group" WHERE "SubsiteID" > 0');
|
||||||
|
|
||||||
// Migrate global-access data
|
// 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.
|
// No subsite access on anything means that we've just installed the subsites module.
|
||||||
// Make all previous groups global-access groups
|
// Make all previous groups global-access groups
|
||||||
} else if(!DB::query('SELECT "ID" FROM "Group" WHERE "AccessAllSubsites" = 1
|
} else if(!DB::query('SELECT "Group"."ID" FROM "Group"
|
||||||
OR "Group_Subsites"."GroupID" IS NOT NULL
|
LEFT JOIN "Group_Subsites" ON "Group_Subsites"."GroupID" = "Group"."ID" AND "Group_Subsites"."SubsiteID" > 0
|
||||||
LEFT JOIN "Group_Subsites" ON "Group_Subsites"."GroupID" = "Group"."ID"
|
WHERE "AccessAllSubsites" = 1
|
||||||
AND "Group_Subsites"."SubsiteID" > 0')->value()) {
|
OR "Group_Subsites"."GroupID" IS NOT NULL ')->value()) {
|
||||||
|
|
||||||
DB::query('UPDATE "Group" SET "AccessAllSubsites" = 1');
|
DB::query('UPDATE "Group" SET "AccessAllSubsites" = 1');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user