mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 02:16:41 +02:00
MDL-39482 avoid using get_category_or_system_context() because file might not be included
This commit is contained in:
parent
95190fda69
commit
cf230d98a8
1 changed files with 6 additions and 2 deletions
|
@ -1152,7 +1152,7 @@ class coursecat implements renderable, cacheable_object, IteratorAggregate {
|
||||||
$params = array('siteid' => SITEID);
|
$params = array('siteid' => SITEID);
|
||||||
if ($recursive) {
|
if ($recursive) {
|
||||||
if ($this->id) {
|
if ($this->id) {
|
||||||
$context = get_category_or_system_context($this->id);
|
$context = context_coursecat::instance($this->id);
|
||||||
$where .= ' AND ctx.path like :path';
|
$where .= ' AND ctx.path like :path';
|
||||||
$params['path'] = $context->path. '/%';
|
$params['path'] = $context->path. '/%';
|
||||||
}
|
}
|
||||||
|
@ -1488,7 +1488,11 @@ class coursecat implements renderable, cacheable_object, IteratorAggregate {
|
||||||
// can not move to itself or it's own child
|
// can not move to itself or it's own child
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return has_capability('moodle/category:manage', get_category_or_system_context($newparentcat->id));
|
if ($newparentcat->id) {
|
||||||
|
return has_capability('moodle/category:manage', context_coursecat::instance($newparentcat->id));
|
||||||
|
} else {
|
||||||
|
return has_capability('moodle/category:manage', context_system::instance());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue