mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
Merge branch 'MDL-40402-master2' of git://github.com/ankitagarwal/moodle
This commit is contained in:
commit
a13ee8e18a
@ -190,7 +190,7 @@ function print_report_tree($contextid, $contexts, $allroles) {
|
||||
|
||||
// Start the list item, and print the context name as a link to the place to
|
||||
// make changes.
|
||||
if ($contextid == get_system_context()->id) {
|
||||
if ($contextid == context_system::instance()->id) {
|
||||
$url = "$CFG->wwwroot/$CFG->admin/roles/manage.php";
|
||||
$title = get_string('changeroles', 'tool_capability');
|
||||
} else {
|
||||
|
@ -26,7 +26,7 @@ require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/filter_form.php');
|
||||
|
||||
require_login(SITEID, false);
|
||||
require_capability('tool/customlang:edit', get_system_context());
|
||||
require_capability('tool/customlang:edit', context_system::instance());
|
||||
|
||||
$lng = required_param('lng', PARAM_LANG);
|
||||
$currentpage = optional_param('p', 0, PARAM_INT);
|
||||
|
@ -30,7 +30,7 @@ require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
require_login(SITEID, false);
|
||||
require_capability('tool/customlang:view', get_system_context());
|
||||
require_capability('tool/customlang:view', context_system::instance());
|
||||
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
$confirm = optional_param('confirm', false, PARAM_BOOL);
|
||||
@ -42,7 +42,7 @@ $langs = get_string_manager()->get_list_of_translations();
|
||||
// pre-output actions
|
||||
if ($action === 'checkout') {
|
||||
require_sesskey();
|
||||
require_capability('tool/customlang:edit', get_system_context());
|
||||
require_capability('tool/customlang:edit', context_system::instance());
|
||||
if (empty($lng)) {
|
||||
print_error('missingparameter');
|
||||
}
|
||||
@ -66,7 +66,7 @@ if ($action === 'checkout') {
|
||||
|
||||
if ($action === 'checkin') {
|
||||
require_sesskey();
|
||||
require_capability('tool/customlang:edit', get_system_context());
|
||||
require_capability('tool/customlang:edit', context_system::instance());
|
||||
if (empty($lng)) {
|
||||
print_error('missingparameter');
|
||||
}
|
||||
@ -119,7 +119,7 @@ if ($numofmodified != 0) {
|
||||
}
|
||||
|
||||
$menu = array();
|
||||
if (has_capability('tool/customlang:edit', get_system_context())) {
|
||||
if (has_capability('tool/customlang:edit', context_system::instance())) {
|
||||
$menu['checkout'] = array(
|
||||
'title' => get_string('checkout', 'tool_customlang'),
|
||||
'url' => new moodle_url($PAGE->url, array('action' => 'checkout', 'lng' => $lng)),
|
||||
|
@ -39,7 +39,7 @@ if (!debugging('', DEBUG_DEVELOPER)) {
|
||||
}
|
||||
|
||||
$PAGE->set_url('/admin/tool/generator/index.php');
|
||||
$PAGE->set_context(get_system_context());
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_pagelayout('base');
|
||||
$generator = new generator_web();
|
||||
$generator->setup();
|
||||
|
@ -146,7 +146,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
}
|
||||
|
||||
// check remote login permissions
|
||||
if (! has_capability('moodle/site:mnetlogintoremote', get_system_context())
|
||||
if (! has_capability('moodle/site:mnetlogintoremote', context_system::instance())
|
||||
or is_mnet_remote_user($USER)
|
||||
or isguestuser()
|
||||
or !isloggedin()) {
|
||||
|
2
cache/locallib.php
vendored
2
cache/locallib.php
vendored
@ -903,7 +903,7 @@ abstract class cache_administration_helper extends cache_helper {
|
||||
*/
|
||||
public static function get_store_instance_actions($name, array $storedetails) {
|
||||
$actions = array();
|
||||
if (has_capability('moodle/site:config', get_system_context())) {
|
||||
if (has_capability('moodle/site:config', context_system::instance())) {
|
||||
$baseurl = new moodle_url('/cache/admin.php', array('store' => $name, 'sesskey' => sesskey()));
|
||||
if (empty($storedetails['default'])) {
|
||||
$actions[] = array(
|
||||
|
@ -1469,7 +1469,7 @@ function calendar_set_filters(array $courseeventsfrom, $ignorefilters = false) {
|
||||
}
|
||||
}
|
||||
if ($group === false) {
|
||||
if (!empty($CFG->calendar_adminseesall) && has_any_capability($allgroupscaps, get_system_context())) {
|
||||
if (!empty($CFG->calendar_adminseesall) && has_any_capability($allgroupscaps, context_system::instance())) {
|
||||
$group = true;
|
||||
} else if ($isloggedin) {
|
||||
$groupids = array();
|
||||
@ -1790,7 +1790,7 @@ function calendar_set_event_type_display($type, $display = null, $user = null) {
|
||||
function calendar_get_allowed_types(&$allowed, $course = null) {
|
||||
global $USER, $CFG, $DB;
|
||||
$allowed = new stdClass();
|
||||
$allowed->user = has_capability('moodle/calendar:manageownentries', get_system_context());
|
||||
$allowed->user = has_capability('moodle/calendar:manageownentries', context_system::instance());
|
||||
$allowed->groups = false; // This may change just below
|
||||
$allowed->courses = false; // This may change just below
|
||||
$allowed->site = has_capability('moodle/calendar:manageentries', context_course::instance(SITEID));
|
||||
|
@ -57,7 +57,7 @@ if ($id) {
|
||||
}
|
||||
$context = context_coursecat::instance($parent);
|
||||
} else {
|
||||
$context = get_system_context();
|
||||
$context = context_system::instance();
|
||||
}
|
||||
$PAGE->set_context($context);
|
||||
$category = new stdClass();
|
||||
|
@ -16,7 +16,7 @@ class editcategory_form extends moodleform {
|
||||
|
||||
// get list of categories to use as parents, with site as the first one
|
||||
$options = array();
|
||||
if (has_capability('moodle/category:manage', get_system_context()) || $category->parent == 0) {
|
||||
if (has_capability('moodle/category:manage', context_system::instance()) || $category->parent == 0) {
|
||||
$options[0] = get_string('top');
|
||||
}
|
||||
if ($category->id) {
|
||||
|
@ -426,7 +426,7 @@ class core_enrol_external extends external_api {
|
||||
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
|
||||
$coursecontext = context_course::instance($courseid, IGNORE_MISSING);
|
||||
if ($courseid == SITEID) {
|
||||
$context = get_system_context();
|
||||
$context = context_system::instance();
|
||||
} else {
|
||||
$context = $coursecontext;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@
|
||||
$PAGE->set_url('/error/');
|
||||
$PAGE->set_title($site->fullname .':Error');
|
||||
$PAGE->set_heading($site->fullname .': Error 404');
|
||||
$PAGE->set_context(get_system_context());
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->navbar->add('Error 404 - File not Found');
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->box(get_string('pagenotexist', 'error'). '<br />'.s($requesturi), 'generalbox boxaligncenter');
|
||||
|
@ -80,7 +80,7 @@ class core_files_external extends external_api {
|
||||
$browser = get_file_browser();
|
||||
|
||||
if (empty($fileinfo['contextid'])) {
|
||||
$context = get_system_context();
|
||||
$context = context_system::instance();
|
||||
} else {
|
||||
$context = context::instance_by_id($fileinfo['contextid']);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*
|
||||
* @category grading
|
||||
* @example $manager = get_grading_manager($areaid);
|
||||
* @example $manager = get_grading_manager(get_system_context());
|
||||
* @example $manager = get_grading_manager(context_system::instance());
|
||||
* @example $manager = get_grading_manager($context, 'mod_assignment', 'submission');
|
||||
* @param stdClass|int|null $context_or_areaid if $areaid is passed, no other parameter is needed
|
||||
* @param string|null $component the frankenstyle name of the component
|
||||
|
@ -6005,7 +6005,7 @@ class context_system extends context {
|
||||
|
||||
|
||||
try {
|
||||
// we ignore the strictness completely because system context must except except during install
|
||||
// We ignore the strictness completely because system context must exist except during install.
|
||||
$record = $DB->get_record('context', array('contextlevel'=>CONTEXT_SYSTEM), '*', MUST_EXIST);
|
||||
} catch (dml_exception $e) {
|
||||
//table or record does not exist
|
||||
@ -7229,46 +7229,6 @@ class context_block extends context {
|
||||
// before removing devs will be warned with a debugging message first,
|
||||
// then we will add error message and only after that we can remove the functions
|
||||
// completely.
|
||||
|
||||
|
||||
/**
|
||||
* Not available any more, use load_temp_course_role() instead.
|
||||
*
|
||||
* @deprecated since 2.2
|
||||
* @param stdClass $context
|
||||
* @param int $roleid
|
||||
* @param array $accessdata
|
||||
* @return array
|
||||
*/
|
||||
function load_temp_role($context, $roleid, array $accessdata) {
|
||||
debugging('load_temp_role() is deprecated, please use load_temp_course_role() instead, temp role not loaded.');
|
||||
return $accessdata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not available any more, use remove_temp_course_roles() instead.
|
||||
*
|
||||
* @deprecated since 2.2
|
||||
* @param stdClass $context
|
||||
* @param array $accessdata
|
||||
* @return array access data
|
||||
*/
|
||||
function remove_temp_roles($context, array $accessdata) {
|
||||
debugging('remove_temp_role() is deprecated, please use remove_temp_course_roles() instead.');
|
||||
return $accessdata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns system context or null if can not be created yet.
|
||||
*
|
||||
* @deprecated since 2.2, use context_system::instance()
|
||||
* @param bool $cache use caching
|
||||
* @return context system context (null if context table not created yet)
|
||||
*/
|
||||
function get_system_context($cache = true) {
|
||||
return context_system::instance(0, IGNORE_MISSING, $cache);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive function which, given a context, find all parent context ids,
|
||||
* and return the array in reverse order, i.e. parent first, then grand
|
||||
|
@ -6959,7 +6959,7 @@ class admin_setting_managerepository extends admin_setting {
|
||||
// Calculate number of instances in order to display them for the Moodle administrator
|
||||
if (!empty($instanceoptionnames)) {
|
||||
$params = array();
|
||||
$params['context'] = array(get_system_context());
|
||||
$params['context'] = array(context_system::instance());
|
||||
$params['onlyvisible'] = false;
|
||||
$params['type'] = $typename;
|
||||
$admininstancenumber = count(repository::static_function($typename, 'get_instances', $params));
|
||||
@ -7117,7 +7117,7 @@ class admin_setting_enablemobileservice extends admin_setting_configcheckbox {
|
||||
$assign = true;
|
||||
}
|
||||
if (!empty($assign)) {
|
||||
$systemcontext = get_system_context();
|
||||
$systemcontext = context_system::instance();
|
||||
assign_capability('webservice/xmlrpc:use', $permission, $CFG->defaultuserroleid, $systemcontext->id, true);
|
||||
assign_capability('webservice/rest:use', $permission, $CFG->defaultuserroleid, $systemcontext->id, true);
|
||||
}
|
||||
|
@ -4899,3 +4899,32 @@ function get_context_instance_by_id($id, $strictness = IGNORE_MISSING) {
|
||||
debugging('get_context_instance_by_id() is deprecated, please use context::instance_by_id($id) instead.', DEBUG_DEVELOPER);
|
||||
return context::instance_by_id($id, $strictness);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 2.2
|
||||
* @see load_temp_course_role()
|
||||
*/
|
||||
function load_temp_role($context, $roleid, array $accessdata) {
|
||||
throw new coding_exception('load_temp_role() can not be used any more, please use load_temp_course_role()');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Moodle 2.2
|
||||
* @see remove_temp_course_roles()
|
||||
*/
|
||||
function remove_temp_roles($context, array $accessdata) {
|
||||
throw new coding_exception('remove_temp_roles() can not be used any more, please use remove_temp_course_roles()');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns system context or null if can not be created yet.
|
||||
*
|
||||
* @see context_system::instance()
|
||||
* @deprecated since 2.2
|
||||
* @param bool $cache use caching
|
||||
* @return context system context (null if context table not created yet)
|
||||
*/
|
||||
function get_system_context($cache = true) {
|
||||
debugging('get_system_context() is deprecated, please use context_system::instance() instead.', DEBUG_DEVELOPER);
|
||||
return context_system::instance(0, IGNORE_MISSING, $cache);
|
||||
}
|
||||
|
@ -1725,7 +1725,7 @@ class global_navigation extends navigation_node {
|
||||
$categoryname = format_string($category->name, true, array('context' => $context));
|
||||
$categorynode = $parent->add($categoryname, $url, $nodetype, $categoryname, $category->id);
|
||||
if (empty($category->visible)) {
|
||||
if (has_capability('moodle/category:viewhiddencategories', get_system_context())) {
|
||||
if (has_capability('moodle/category:viewhiddencategories', context_system::instance())) {
|
||||
$categorynode->hidden = true;
|
||||
} else {
|
||||
$categorynode->display = false;
|
||||
@ -2484,7 +2484,7 @@ class global_navigation extends navigation_node {
|
||||
$coursenode->add('frontpageloaded', null, self::TYPE_CUSTOM, null, 'frontpageloaded')->display = false;
|
||||
|
||||
//Participants
|
||||
if (has_capability('moodle/course:viewparticipants', get_system_context())) {
|
||||
if (has_capability('moodle/course:viewparticipants', context_system::instance())) {
|
||||
$coursenode->add(get_string('participants'), new moodle_url('/user/index.php?id='.$course->id), self::TYPE_CUSTOM, get_string('participants'), 'participants');
|
||||
}
|
||||
|
||||
@ -3913,7 +3913,7 @@ class settings_navigation extends navigation_node {
|
||||
}
|
||||
|
||||
$coursecontext = context_course::instance($course->id); // Course context
|
||||
$systemcontext = get_system_context();
|
||||
$systemcontext = context_system::instance();
|
||||
$currentuser = ($USER->id == $userid);
|
||||
|
||||
if ($currentuser) {
|
||||
@ -4059,7 +4059,7 @@ class settings_navigation extends navigation_node {
|
||||
$enablemanagetokens = true;
|
||||
} else if (!is_siteadmin($USER->id)
|
||||
&& !empty($CFG->enablewebservices)
|
||||
&& has_capability('moodle/webservice:createtoken', get_system_context()) ) {
|
||||
&& has_capability('moodle/webservice:createtoken', context_system::instance()) ) {
|
||||
$enablemanagetokens = true;
|
||||
}
|
||||
// Security keys
|
||||
|
@ -717,7 +717,7 @@ initialise_fullme();
|
||||
// define SYSCONTEXTID in config.php if you want to save some queries,
|
||||
// after install it must match the system context record id.
|
||||
if (!defined('SYSCONTEXTID')) {
|
||||
get_system_context();
|
||||
context_system::instance();
|
||||
}
|
||||
|
||||
// Defining the site - aka frontpage course
|
||||
|
@ -2372,6 +2372,8 @@ class accesslib_testcase extends advanced_testcase {
|
||||
$this->assertDebuggingCalled('get_context_instance() is deprecated, please use context_xxxx::instance() instead.', DEBUG_DEVELOPER);
|
||||
get_context_instance_by_id($record->id);
|
||||
$this->assertDebuggingCalled('get_context_instance_by_id() is deprecated, please use context::instance_by_id($id) instead.', DEBUG_DEVELOPER);
|
||||
get_system_context();
|
||||
$this->assertDebuggingCalled('get_system_context() is deprecated, please use context_system::instance() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
$DB->delete_records('context', array('contextlevel'=>CONTEXT_BLOCK));
|
||||
create_contexts();
|
||||
|
@ -2283,7 +2283,7 @@ class moodlelib_testcase extends advanced_testcase {
|
||||
$this->assertEquals(convert_to_array($obj), (array)$obj);
|
||||
|
||||
// check that context object (with iterator) is converted to array properly
|
||||
$obj = get_system_context();
|
||||
$obj = context_system::instance();
|
||||
$ar = array(
|
||||
'id' => $obj->id,
|
||||
'contextlevel' => $obj->contextlevel,
|
||||
|
@ -6,6 +6,8 @@ information provided here is intended especially for developers.
|
||||
* Use core_text::* instead of textlib:: and also core_collator::* instead of collatorlib::*.
|
||||
* get_context_instance() is deprecated, please use use context_xxxx::instance().
|
||||
* get_context_instance_by_id() is deprecated, please use context::instance_by_id($id).
|
||||
* load_temp_role() and remove_temp_roles() can not be used any more.
|
||||
* get_system_context() is deprecated, please use context_system::instance().
|
||||
|
||||
=== 2.5.1 ===
|
||||
|
||||
|
@ -146,9 +146,9 @@ if (!empty($user)) {
|
||||
if (count($tokens) > 0) {
|
||||
$token = array_pop($tokens);
|
||||
} else {
|
||||
if ( ($serviceshortname == MOODLE_OFFICIAL_MOBILE_SERVICE and has_capability('moodle/webservice:createmobiletoken', get_system_context()))
|
||||
if ( ($serviceshortname == MOODLE_OFFICIAL_MOBILE_SERVICE and has_capability('moodle/webservice:createmobiletoken', context_system::instance()))
|
||||
//Note: automatically token generation is not available to admin (they must create a token manually)
|
||||
or (!is_siteadmin($user) && has_capability('moodle/webservice:createtoken', get_system_context()))) {
|
||||
or (!is_siteadmin($user) && has_capability('moodle/webservice:createtoken', context_system::instance()))) {
|
||||
// if service doesn't exist, dml will throw exception
|
||||
$service_record = $DB->get_record('external_services', array('shortname'=>$serviceshortname, 'enabled'=>1), '*', MUST_EXIST);
|
||||
// create a new token
|
||||
|
@ -40,7 +40,7 @@ if (!$service->is_available()) {
|
||||
die();
|
||||
}
|
||||
|
||||
$roamingusers = get_users_by_capability(get_system_context(), 'moodle/site:mnetlogintoremote', 'u.id');
|
||||
$roamingusers = get_users_by_capability(context_system::instance(), 'moodle/site:mnetlogintoremote', 'u.id');
|
||||
if (empty($roamingusers)) {
|
||||
$capname = get_string('site:mnetlogintoremote', 'role');
|
||||
$url = new moodle_url('/admin/roles/manage.php');
|
||||
|
@ -552,7 +552,7 @@ class mnetservice_enrol_potential_users_selector extends user_selector_base {
|
||||
public function find_users($search) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$systemcontext = get_system_context();
|
||||
$systemcontext = context_system::instance();
|
||||
$userids = get_users_by_capability($systemcontext, 'moodle/site:mnetlogintoremote', 'u.id');
|
||||
|
||||
if (empty($userids)) {
|
||||
|
@ -28,7 +28,7 @@ require_once($CFG->dirroot.'/mod/assign/adminlib.php');
|
||||
// Create the class for this controller.
|
||||
$pluginmanager = new assign_plugin_manager(required_param('subtype', PARAM_PLUGIN));
|
||||
|
||||
$PAGE->set_context(get_system_context());
|
||||
$PAGE->set_context(context_system::instance());
|
||||
|
||||
// Execute the controller.
|
||||
$pluginmanager->execute(optional_param('action', null, PARAM_PLUGIN),
|
||||
|
@ -40,7 +40,7 @@ function xmldb_data_upgrade($oldversion) {
|
||||
// Get directory contents.
|
||||
$userfolders = new DirectoryIterator($oldpresetdir);
|
||||
// Store the system context, these are site wide presets.
|
||||
$context = get_system_context();
|
||||
$context = context_system::instance();
|
||||
// Create file storage object.
|
||||
$fs = get_file_storage();
|
||||
// Create array of accepted files.
|
||||
|
@ -93,7 +93,7 @@ if (isset($formdata->confirmdelete) AND $formdata->confirmdelete == 1) {
|
||||
}
|
||||
|
||||
if ($template->ispublic) {
|
||||
$systemcontext = get_system_context();
|
||||
$systemcontext = context_system::instance();
|
||||
require_capability('mod/feedback:createpublictemplate', $systemcontext);
|
||||
require_capability('mod/feedback:deletetemplate', $systemcontext);
|
||||
}
|
||||
@ -164,7 +164,7 @@ if ($shoulddelete == 1) {
|
||||
echo $OUTPUT->box_end();
|
||||
}
|
||||
//now we get the public templates if it is permitted
|
||||
$systemcontext = get_system_context();
|
||||
$systemcontext = context_system::instance();
|
||||
if (has_capability('mod/feedback:createpublictemplate', $systemcontext) AND
|
||||
has_capability('mod/feedback:deletetemplate', $systemcontext)) {
|
||||
$templates = feedback_get_template_list($course, 'public');
|
||||
|
@ -110,7 +110,7 @@ if (isset($create_template_formdata->savetemplate) && $create_template_formdata-
|
||||
$savereturn = 'notsaved_name';
|
||||
} else {
|
||||
//If the feedback is located on the frontpage then templates can be public.
|
||||
if (has_capability('mod/feedback:createpublictemplate', get_system_context())) {
|
||||
if (has_capability('mod/feedback:createpublictemplate', context_system::instance())) {
|
||||
$create_template_formdata->ispublic = isset($create_template_formdata->ispublic) ? 1 : 0;
|
||||
} else {
|
||||
$create_template_formdata->ispublic = 0;
|
||||
|
@ -178,7 +178,7 @@ class feedback_edit_create_template_form extends moodleform {
|
||||
get_string('name', 'feedback'),
|
||||
array('size'=>'40', 'maxlength'=>'200'));
|
||||
|
||||
if (has_capability('mod/feedback:createpublictemplate', get_system_context())) {
|
||||
if (has_capability('mod/feedback:createpublictemplate', context_system::instance())) {
|
||||
$elementgroup[] = $mform->createElement('checkbox',
|
||||
'ispublic',
|
||||
get_string('public', 'feedback'),
|
||||
|
@ -146,7 +146,7 @@ class feedback_item_label extends feedback_item_base {
|
||||
if (!$item->feedback AND $item->template) {
|
||||
$template = $DB->get_record('feedback_template', array('id'=>$item->template));
|
||||
if ($template->ispublic) {
|
||||
$context = get_system_context();
|
||||
$context = context_system::instance();
|
||||
} else {
|
||||
$context = context_course::instance($template->course);
|
||||
}
|
||||
|
@ -1118,7 +1118,7 @@ function feedback_save_as_template($feedback, $name, $ispublic = 0) {
|
||||
//if the template is public the files are in the system context
|
||||
//files in the feedback_item are in the feedback_context of the feedback
|
||||
if ($ispublic) {
|
||||
$s_context = get_system_context();
|
||||
$s_context = context_system::instance();
|
||||
} else {
|
||||
$s_context = context_course::instance($newtempl->course);
|
||||
}
|
||||
@ -1223,7 +1223,7 @@ function feedback_items_from_template($feedback, $templateid, $deleteold = false
|
||||
//files in the template_item are in the context of the current course
|
||||
//files in the feedback_item are in the feedback_context of the feedback
|
||||
if ($template->ispublic) {
|
||||
$s_context = get_system_context();
|
||||
$s_context = context_system::instance();
|
||||
} else {
|
||||
$s_context = context_course::instance($feedback->course);
|
||||
}
|
||||
@ -1526,7 +1526,7 @@ function feedback_delete_item($itemid, $renumber = true, $template = false) {
|
||||
|
||||
if ($template) {
|
||||
if ($template->ispublic) {
|
||||
$context = get_system_context();
|
||||
$context = context_system::instance();
|
||||
} else {
|
||||
$context = context_course::instance($template->course);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ if (isguestuser($user)) {
|
||||
// Make sure the user has not been deleted
|
||||
if ($user->deleted) {
|
||||
$PAGE->set_title(get_string('userdeleted'));
|
||||
$PAGE->set_context(get_system_context());
|
||||
$PAGE->set_context(context_system::instance());
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($PAGE->title);
|
||||
echo $OUTPUT->footer();
|
||||
@ -110,7 +110,7 @@ if ($isspecificcourse) {
|
||||
// We are going to search for all of the users posts in all courses!
|
||||
// a general require login here as we arn't actually within any course.
|
||||
require_login();
|
||||
$PAGE->set_context(get_system_context());
|
||||
$PAGE->set_context(context_system::instance());
|
||||
|
||||
// Now we need to get all of the courses to search.
|
||||
// All courses where the user has posted within a forum will be returned.
|
||||
|
@ -47,7 +47,7 @@ $callbackclass = optional_param('callbackclass', null, PARAM_ALPHAEXT); // Callb
|
||||
$callerformats = optional_param('callerformats', null, PARAM_TAGLIST); // Comma separated list of formats the specific place exporting content supports.
|
||||
|
||||
require_login(); // this is selectively called again with $course later when we know for sure which one we're in.
|
||||
$PAGE->set_context(get_system_context());
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_url('/portfolio/add.php', array('id' => $dataid, 'sesskey' => sesskey()));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
$exporter = null;
|
||||
|
@ -30,7 +30,7 @@ require('../config.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot.'/repository/lib.php');
|
||||
$PAGE->set_context(get_system_context());
|
||||
$PAGE->set_context(context_system::instance());
|
||||
require_login();
|
||||
if (isguestuser()) {
|
||||
print_error('noguest');
|
||||
|
@ -377,7 +377,7 @@ case 'confirm':
|
||||
default:
|
||||
case 'plugins':
|
||||
$params = array();
|
||||
$params['context'] = array($user_context, get_system_context());
|
||||
$params['context'] = array($user_context, context_system::instance());
|
||||
$params['currentcontext'] = $PAGE->context;
|
||||
$params['return_types'] = FILE_INTERNAL;
|
||||
|
||||
|
@ -190,7 +190,7 @@ class repository_filesystem extends repository {
|
||||
|
||||
public static function instance_config_form($mform) {
|
||||
global $CFG, $PAGE;
|
||||
if (has_capability('moodle/site:config', get_system_context())) {
|
||||
if (has_capability('moodle/site:config', context_system::instance())) {
|
||||
$path = $CFG->dataroot . '/repository/';
|
||||
if (!is_dir($path)) {
|
||||
mkdir($path, $CFG->directorypermissions, true);
|
||||
@ -222,10 +222,10 @@ class repository_filesystem extends repository {
|
||||
|
||||
public static function create($type, $userid, $context, $params, $readonly=0) {
|
||||
global $PAGE;
|
||||
if (has_capability('moodle/site:config', get_system_context())) {
|
||||
if (has_capability('moodle/site:config', context_system::instance())) {
|
||||
return parent::create($type, $userid, $context, $params, $readonly);
|
||||
} else {
|
||||
require_capability('moodle/site:config', get_system_context());
|
||||
require_capability('moodle/site:config', context_system::instance());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -529,7 +529,7 @@ class repository_flickr_public extends repository {
|
||||
public static function plugin_init() {
|
||||
//here we create a default instance for this type
|
||||
|
||||
$id = repository::static_function('flickr_public','create', 'flickr_public', 0, get_system_context(), array('name'=>'', 'email_address' => null, 'usewatermarks' => false), 0);
|
||||
$id = repository::static_function('flickr_public','create', 'flickr_public', 0, context_system::instance(), array('name'=>'', 'email_address' => null, 'usewatermarks' => false), 0);
|
||||
if (empty($id)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -251,7 +251,7 @@ class repository_type implements cacheable_object {
|
||||
// for it
|
||||
$instanceoptions['name'] = $this->_options['pluginname'];
|
||||
}
|
||||
repository::static_function($this->_typename, 'create', $this->_typename, 0, get_system_context(), $instanceoptions);
|
||||
repository::static_function($this->_typename, 'create', $this->_typename, 0, context_system::instance(), $instanceoptions);
|
||||
}
|
||||
//run plugin_init function
|
||||
if (!repository::static_function($this->_typename, 'plugin_init')) {
|
||||
@ -958,7 +958,7 @@ abstract class repository implements cacheable_object {
|
||||
public static function get_editable_types($context = null) {
|
||||
|
||||
if (empty($context)) {
|
||||
$context = get_system_context();
|
||||
$context = context_system::instance();
|
||||
}
|
||||
|
||||
$types= repository::get_types(true);
|
||||
@ -3168,7 +3168,7 @@ function initialise_filepicker($args) {
|
||||
$user_context = context_user::instance($USER->id);
|
||||
|
||||
list($context, $course, $cm) = get_context_info_array($context->id);
|
||||
$contexts = array($user_context, get_system_context());
|
||||
$contexts = array($user_context, context_system::instance());
|
||||
if (!empty($course)) {
|
||||
// adding course context
|
||||
$contexts[] = context_course::instance($course->id);
|
||||
|
@ -94,7 +94,7 @@ switch ($action) {
|
||||
// global search
|
||||
case 'gsearch':
|
||||
$params = array();
|
||||
$params['context'] = array(context::instance_by_id($contextid), get_system_context());
|
||||
$params['context'] = array(context::instance_by_id($contextid), context_system::instance());
|
||||
$params['currentcontext'] = context::instance_by_id($contextid);
|
||||
$repos = repository::get_instances($params);
|
||||
$list = array();
|
||||
|
@ -67,7 +67,7 @@ if ($courseid) {
|
||||
if ($courseid) {
|
||||
$PAGE->set_context(context_course::instance($courseid));
|
||||
} else {
|
||||
$PAGE->set_context(get_system_context());
|
||||
$PAGE->set_context(context_system::instance());
|
||||
}
|
||||
|
||||
// Language strings
|
||||
|
@ -401,7 +401,7 @@ function coursetag_delete_course_tags($courseid, $showfeedback=false) {
|
||||
$DB->delete_records('tag', array('id'=>$tag->tagid));
|
||||
// Delete files
|
||||
$fs = get_file_storage();
|
||||
$fs->delete_area_files(get_system_context()->id, 'tag', 'description', $tag->tagid);
|
||||
$fs->delete_area_files(context_system::instance()->id, 'tag', 'description', $tag->tagid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ if ($course->id != SITEID) {
|
||||
}
|
||||
redirect(get_login_url());
|
||||
} else {
|
||||
$PAGE->set_context(get_system_context());
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_pagelayout('standard');
|
||||
}
|
||||
|
||||
|
@ -678,7 +678,7 @@ class core_user_external extends external_api {
|
||||
$users = $DB->get_recordset_sql($usersql, $params);
|
||||
|
||||
$result = array();
|
||||
$hasuserupdatecap = has_capability('moodle/user:update', get_system_context());
|
||||
$hasuserupdatecap = has_capability('moodle/user:update', context_system::instance());
|
||||
foreach ($users as $user) {
|
||||
if (!empty($user->deleted)) {
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user