From cbcc9852e01effeed60b7180eea5a66fb668e80b Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Wed, 23 Dec 2009 18:23:21 +0000 Subject: [PATCH] MDL-21125 removing obsolete global $THEME --- blocks/upgrade.txt | 1 + lib/pagelib.php | 12 +++--------- lib/setup.php | 10 ++-------- mod/upgrade.txt | 1 + 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/blocks/upgrade.txt b/blocks/upgrade.txt index f7239e1c06..4eec74c02a 100644 --- a/blocks/upgrade.txt +++ b/blocks/upgrade.txt @@ -13,6 +13,7 @@ required changes in code: * rewrite backup/restore * theme changes: move plugin styles into blocks/xxx/styles.css and use new css markers for images, move all images into new blocks/xxx/pix/ directory and use new outputlib api + old global $THEME is fully replaced by $OUTPUT optional - no changes needed in older code: diff --git a/lib/pagelib.php b/lib/pagelib.php index 6c63b678c8..d7151b677f 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -944,18 +944,13 @@ class moodle_page { /** * Force this page to use a particular theme. * - * Please use this cautiously. It is only intended to be used by the themes selector - * admin page, and theme/styles.php. + * Please use this cautiously. It is only intended to be used by the themes selector admin page. * * @param $themename the name of the theme to use. */ public function force_theme($themename) { - global $PAGE, $THEME; $this->ensure_theme_not_set(); $this->_theme = theme_config::load($themename); - if ($this === $PAGE) { - $THEME = $this->_theme; - } } /** @@ -1025,10 +1020,10 @@ class moodle_page { * * Make sure the right theme for this page is loaded. Tell our * blocks_manager about the theme block regions, and then, if - * we are $PAGE, set up the globals $THEME and $OUTPUT. + * we are $PAGE, set up the global $OUTPUT. */ public function initialise_theme_and_output() { - global $OUTPUT, $PAGE, $SITE, $THEME; + global $OUTPUT, $PAGE, $SITE; if (!empty($this->_wherethemewasinitialised)) { return; @@ -1047,7 +1042,6 @@ class moodle_page { $this->_theme->setup_blocks($this->pagelayout, $this->blocks); if ($this === $PAGE) { - $THEME = $this->_theme; $OUTPUT = $this->get_renderer('core'); } diff --git a/lib/setup.php b/lib/setup.php index a78979b43b..0aa0212883 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -110,19 +110,13 @@ global $COURSE; * to change something that affects the current theme ($PAGE->course, logged in use, * httpsrequried ... will result in an exception.) * + * Please note the $OUTPUT is replacing the old global $THEME object. + * * @global object $OUTPUT * @name $OUTPUT */ global $OUTPUT; -/** - * $THEME is a global that defines the current theme. - * - * @global theme_config $THEME - * @name THEME - */ -global $THEME; - /** * Shared memory cache. * @global object $MCACHE diff --git a/mod/upgrade.txt b/mod/upgrade.txt index 30df086fd0..bc81921623 100644 --- a/mod/upgrade.txt +++ b/mod/upgrade.txt @@ -22,6 +22,7 @@ required changes in code: * theme changes: move plugin styles into mod/xxx/styles.css and use new css markers for images, move all images into new mod/xxx/pix/ directory and use new outputlib api move module icon to mod/xxx/pix/icon.gif + old global $THEME is fully replaced by $OUTPUT optional - no changes needed in older code: -- 2.39.5