From 8d158ed44f9c298b04e7130720977e52fbf9730c Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 12 Sep 2006 07:10:49 +0000 Subject: [PATCH] Reload the guest role using new defaults --- lib/db/mysql.php | 14 +++++++++++++- lib/db/postgres7.php | 12 ++++++++++++ mod/assignment/version.php | 2 +- mod/chat/version.php | 2 +- mod/choice/version.php | 2 +- mod/data/version.php | 2 +- mod/exercise/version.php | 2 +- mod/forum/version.php | 2 +- mod/glossary/version.php | 2 +- mod/hotpot/version.php | 2 +- mod/journal/version.php | 2 +- mod/label/version.php | 2 +- mod/lams/version.php | 2 +- mod/lesson/version.php | 2 +- mod/quiz/version.php | 2 +- mod/resource/version.php | 2 +- mod/scorm/version.php | 2 +- mod/survey/version.php | 2 +- mod/wiki/version.php | 2 +- mod/workshop/version.php | 2 +- version.php | 2 +- 21 files changed, 44 insertions(+), 20 deletions(-) diff --git a/lib/db/mysql.php b/lib/db/mysql.php index fa3e6f1771..fdc23462c0 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -2186,6 +2186,7 @@ function main_upgrade($oldversion=0) { execute_sql("ALTER TABLE {$CFG->prefix}course_sections CHANGE sequence sequence text NULL AFTER section"); } + // table to keep track of course page access times, used in online participants block, and participants list if ($oldversion < 2006091200) { execute_sql("CREATE TABLE {$CFG->prefix}user_lastaccess ( @@ -2199,7 +2200,18 @@ function main_upgrade($oldversion=0) { PRIMARY KEY (`id`) )TYPE=MYISAM COMMENT ='time user last accessed any page in a course';", true); } - + + if ($oldversion < 2006091211) { // Reload the guest roles completely with new defaults + if ($guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) { + delete_records('capabilities'); + $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + foreach ($guestroles as $guestrole) { + delete_records('role_capabilities', 'roleid', $guestrole->id); + assign_capability('moodle/legacy:guest', CAP_ALLOW, $guestrole->id, $sitecontext->id); + } + } + } + return $result; } diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index 44ef464074..0f27ecaeaf 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -1800,6 +1800,18 @@ function main_upgrade($oldversion=0) { execute_sql("CREATE UNIQUE INDEX {$CFG->prefix}user_lastaccess_useridcourseid_idx ON {$CFG->prefix}user_lastaccess (userid, courseid);", true); } + + if ($oldversion < 2006091211) { // Reload the guest roles completely with new defaults + if ($guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) { + delete_records('capabilities'); + $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); + foreach ($guestroles as $guestrole) { + delete_records('role_capabilities', 'roleid', $guestrole->id); + assign_capability('moodle/legacy:guest', CAP_ALLOW, $guestrole->id, $sitecontext->id); + } + } + } + return $result; } diff --git a/mod/assignment/version.php b/mod/assignment/version.php index 85ee874603..b05f960bde 100644 --- a/mod/assignment/version.php +++ b/mod/assignment/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080900; +$module->version = 2006091200; $module->requires = 2006080900; // Requires this Moodle version $module->cron = 60; diff --git a/mod/chat/version.php b/mod/chat/version.php index 5edab92c8d..7047231e56 100644 --- a/mod/chat/version.php +++ b/mod/chat/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080900; // The (date) version of this module +$module->version = 2006091200; // The (date) version of this module $module->requires = 2006080900; // Requires this Moodle version $module->cron = 300; // How often should cron check this module (seconds)? diff --git a/mod/choice/version.php b/mod/choice/version.php index b9e78c1941..6f51c4a531 100644 --- a/mod/choice/version.php +++ b/mod/choice/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080900; +$module->version = 2006091200; $module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; diff --git a/mod/data/version.php b/mod/data/version.php index ab7009d64d..08d22db307 100644 --- a/mod/data/version.php +++ b/mod/data/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006081700; +$module->version = 2006091200; $module->requires = 2006080900; // Requires this Moodle version $module->cron = 60; diff --git a/mod/exercise/version.php b/mod/exercise/version.php index 1e54d56e09..08d22db307 100644 --- a/mod/exercise/version.php +++ b/mod/exercise/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080900; +$module->version = 2006091200; $module->requires = 2006080900; // Requires this Moodle version $module->cron = 60; diff --git a/mod/forum/version.php b/mod/forum/version.php index 6faadfdca1..3f3250b3c6 100644 --- a/mod/forum/version.php +++ b/mod/forum/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006082700; +$module->version = 2006091200; $module->requires = 2006082600; // Requires this Moodle version $module->cron = 60; diff --git a/mod/glossary/version.php b/mod/glossary/version.php index ec6ad12f40..f439db0cff 100644 --- a/mod/glossary/version.php +++ b/mod/glossary/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006090400; +$module->version = 2006091200; $module->requires = 2006082600; // Requires this Moodle version $module->cron = 0; // Period for cron to check this module (secs) diff --git a/mod/hotpot/version.php b/mod/hotpot/version.php index b6dbdef88b..6ccfd3203d 100644 --- a/mod/hotpot/version.php +++ b/mod/hotpot/version.php @@ -3,7 +3,7 @@ /// Code fragment to define the version of hotpot /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006083101; // release date of this version (see note below) +$module->version = 2006091200; // release date of this version (see note below) $module->release = 'v2.2.0'; // human-friendly version name (used in mod/hotpot/lib.php) $module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; // period for cron to check this module (secs) diff --git a/mod/journal/version.php b/mod/journal/version.php index 1e54d56e09..08d22db307 100644 --- a/mod/journal/version.php +++ b/mod/journal/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080900; +$module->version = 2006091200; $module->requires = 2006080900; // Requires this Moodle version $module->cron = 60; diff --git a/mod/label/version.php b/mod/label/version.php index f2373372f7..4b732f5fe9 100644 --- a/mod/label/version.php +++ b/mod/label/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080900; // The current module version (Date: YYYYMMDDXX) +$module->version = 2006091200; // The current module version (Date: YYYYMMDDXX) $module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; // Period for cron to check this module (secs) diff --git a/mod/lams/version.php b/mod/lams/version.php index 7f4e96ace4..0557a37f92 100644 --- a/mod/lams/version.php +++ b/mod/lams/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006091100; // The current module version (Date: YYYYMMDDXX) +$module->version = 2006091200; // The current module version (Date: YYYYMMDDXX) $module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; // Period for cron to check this module (secs) diff --git a/mod/lesson/version.php b/mod/lesson/version.php index d5ace47412..7858dc965b 100644 --- a/mod/lesson/version.php +++ b/mod/lesson/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006090700; // The current module version (Date: YYYYMMDDXX) +$module->version = 2006091200; // The current module version (Date: YYYYMMDDXX) $module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; // Period for cron to check this module (secs) diff --git a/mod/quiz/version.php b/mod/quiz/version.php index be8dcd05a3..02b0c6f8cf 100644 --- a/mod/quiz/version.php +++ b/mod/quiz/version.php @@ -5,7 +5,7 @@ // This fragment is called by moodle_needs_upgrading() and /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006082500; // The (date) version of this module +$module->version = 2006091200; // The (date) version of this module $module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; // How often should cron check this module (seconds)? diff --git a/mod/resource/version.php b/mod/resource/version.php index b9e78c1941..6f51c4a531 100644 --- a/mod/resource/version.php +++ b/mod/resource/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080900; +$module->version = 2006091200; $module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; diff --git a/mod/scorm/version.php b/mod/scorm/version.php index c31c652837..319b8e93ef 100755 --- a/mod/scorm/version.php +++ b/mod/scorm/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080900; // The (date) version of this module +$module->version = 2006091200; // The (date) version of this module $module->requires = 2006080900; // The version of Moodle that is required $module->cron = 0; // How often should cron check this module (seconds)? diff --git a/mod/survey/version.php b/mod/survey/version.php index b9e78c1941..6f51c4a531 100644 --- a/mod/survey/version.php +++ b/mod/survey/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080900; +$module->version = 2006091200; $module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; diff --git a/mod/wiki/version.php b/mod/wiki/version.php index 751953c29e..42b8d58679 100644 --- a/mod/wiki/version.php +++ b/mod/wiki/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006091003; // The current module version (Date: YYYYMMDDXX) +$module->version = 2006091200; // The current module version (Date: YYYYMMDDXX) $module->requires = 2006080900; // The current module version (Date: YYYYMMDDXX) $module->cron = 0; // Period for cron to check this module (secs) diff --git a/mod/workshop/version.php b/mod/workshop/version.php index 54a4e0bf6c..08d22db307 100644 --- a/mod/workshop/version.php +++ b/mod/workshop/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006090500; +$module->version = 2006091200; $module->requires = 2006080900; // Requires this Moodle version $module->cron = 60; diff --git a/version.php b/version.php index d9f6b19588..0b8ebb3416 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2006090600; // YYYYMMDD = date + $version = 2006091211; // YYYYMMDD = date // XY = increments within a single day $release = '1.7 dev'; // Human-friendly version name -- 2.39.5