Saves >10DBq and 18 includes at the homepage for all nonadmin users.
For non admin users, this makes the homepage _much_ more lightweight.
Before: inc 101 DBq 51 time 1.2s
After: inc 76 DBq 36 time 0.2s
So this commit shaves 1 full second for the non-logged-in homepage.
Still pretty bad on the includes, but shaved a good 25 files and 15 DBqs.
global $CFG, $ADMIN;
- require_once($CFG->libdir.'/adminlib.php');
- $adminroot = admin_get_root();
+ if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
+ $this->content = '';
+ return '';
+ }
if ($this->content !== NULL) {
return $this->content;
}
+ require_once($CFG->libdir.'/adminlib.php');
+ $adminroot = admin_get_root();
+
if ($this->pathtosection = $adminroot->path($this->section)) {
$this->pathtosection = array_reverse($this->pathtosection);
array_pop($this->pathtosection);