]> git.mjollnir.org Git - moodle.git/commitdiff
merged from MOODLE_19_STABLE: fixing lying phpdoc comments in role_cap_duplicate...
authormjollnir_ <mjollnir_>
Wed, 19 Dec 2007 23:32:53 +0000 (23:32 +0000)
committermjollnir_ <mjollnir_>
Wed, 19 Dec 2007 23:32:53 +0000 (23:32 +0000)
lib/accesslib.php

index 2a1dcc25a2a24641a7a4b71a62c7ca2323fc6fb8..7464aa2a0dd8ab123cc9230038dddba856eccc62 100755 (executable)
@@ -2277,12 +2277,17 @@ function get_system_context($cache=true) {
 
         if (!$context->id = insert_record('context', $context)) {
             // better something than nothing - let's hope it will work somehow
-            if (!defined('SYSCONTEXTID')) {
+            // DONT do it if we're cli because it's IMMUNTABLE.  Doing it during web installer works because
+            // each step is a new request
+            if (!defined('SYSCONTEXTID') && !defined('CLI_UPGRADE')) {
                 define('SYSCONTEXTID', 1);
+                $context->id   = SYSCONTEXTID;
+                $context->path = '/'.SYSCONTEXTID;
+            } else {
+                $context->id   = 0;
+                $context->path = '/0';
             }
             debugging('Can not create system context');
-            $context->id   = SYSCONTEXTID;
-            $context->path = '/'.SYSCONTEXTID;
             return $context;
         }
     }
@@ -5030,7 +5035,7 @@ function switch_roles($first, $second) {
 /**
  * duplicates all the base definitions of a role
  *
- * @param int $sourcerole id of role to copy from
+ * @param object $sourcerole role to copy from
  * @param int $targetrole id of role to copy to
  *
  * @return void