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;
}
}
/**
* 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