mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-11937 - save 100 database queries in the case of the admin bookmarks block
without bookmarks on non-admin page Merged from MOODLE_19_STABLE
This commit is contained in:
parent
a559f6306e
commit
e6262fcd0d
@ -31,9 +31,6 @@ class block_admin_bookmarks extends block_base {
|
||||
|
||||
global $CFG, $USER, $PAGE;
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
}
|
||||
@ -41,6 +38,10 @@ class block_admin_bookmarks extends block_base {
|
||||
$this->content = new stdClass;
|
||||
$this->content->text = '';
|
||||
if (get_user_preferences('admin_bookmarks')) {
|
||||
// this is expensive! Only require when bookmakrs exist..
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
$adminroot = admin_get_root();
|
||||
|
||||
$bookmarks = explode(',',get_user_preferences('admin_bookmarks'));
|
||||
// hmm... just a liiitle (potentially) processor-intensive
|
||||
// (recall that $adminroot->locate is a huge recursive call... and we're calling it repeatedly here
|
||||
|
Loading…
x
Reference in New Issue
Block a user