diff options
author | Romain LE DISEZ <romain.git@ledisez.net> | 2009-07-22 15:40:49 +0200 |
---|---|---|
committer | Romain LE DISEZ <romain.git@ledisez.net> | 2009-07-22 15:40:49 +0200 |
commit | 831bf63c236fe88624470d2906729e035e9dbfc8 (patch) | |
tree | 3cf3b35216bb1d9837c96c2c6ddde1b33160999d /modules/gallery/helpers | |
parent | 317b7b98c094386407251c2baf8f6e7c391c7bff (diff) |
Upgrade code to migrate the ACL from integer to boolean.
Related to 719c59e0402464a0e2b14915f6d10218ff5d4729
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r-- | modules/gallery/helpers/gallery_installer.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 28c1990f..db13307f 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -305,6 +305,24 @@ class gallery_installer { module::clear_var("gallery", "version"); module::set_version("gallery", $version = 7); } + + if ($version == 7) { + $groups = ORM::factory("group")->find_all(); + $permissions = ORM::factory("permission")->find_all(); + foreach($groups as $group) { + foreach($permissions as $permission) { + // Update access intents + $db->query("ALTER TABLE {access_intents} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT NULL"); + // Update access cache + if ($permission->name === "view") { + $db->query("ALTER TABLE {items} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) DEFAULT FALSE"); + } else { + $db->query("ALTER TABLE {access_caches} MODIFY COLUMN {$permission->name}_{$group->id} BINARY(1) NOT NULL DEFAULT FALSE"); + } + } + } + module::set_version("gallery", $version = 8); + } } static function uninstall() { |