From: Michael M Slusarz Date: Sun, 11 Apr 2010 18:42:48 +0000 (-0600) Subject: Revert "Do app pushing entirely within Registry." X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0ad27a43eded123a4c1d64268ce64d4ec776584a;p=horde.git Revert "Do app pushing entirely within Registry." This partially reverts commit 9fc391d83bad2e00b3a72c48e70d169362a5f54f. --- diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index b1a997353..2b09d1f28 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -1234,16 +1234,17 @@ class Horde_Registry /** * Loads the preferences for the current user for the current application * and imports them into the global $prefs variable. + * $app will be the active application after calling this function. * * @param string $app The name of the application. + * @throws Horde_Exception */ public function loadPrefs($app = null) { if (is_null($app)) { $app = $this->getApp(); - $pushed = false; } else { - $pushed = $this->pushApp($app); + $this->pushApp($app); } /* If there is no logged in user, return an empty Horde_Prefs:: @@ -1258,10 +1259,6 @@ class Horde_Registry $GLOBALS['prefs']->retrieve($app); } } - - if ($pushed) { - $this->popApp(); - } } /** diff --git a/horde/lib/Api.php b/horde/lib/Api.php index 7e3ab5df6..0204a417c 100644 --- a/horde/lib/Api.php +++ b/horde/lib/Api.php @@ -155,8 +155,14 @@ class Horde_Api extends Horde_Registry_Api */ public function getPreference($app, $pref) { + $pushed = $GLOBALS['registry']->pushApp($app); $GLOBALS['registry']->loadPrefs($app); - return $GLOBALS['prefs']->getValue($pref); + $value = $GLOBALS['prefs']->getValue($pref); + if ($pushed) { + $GLOBALS['registry']->popApp(); + } + + return $value; } /** @@ -169,8 +175,12 @@ class Horde_Api extends Horde_Registry_Api */ public function setPreference($app, $pref, $value) { + $pushed = $GLOBALS['registry']->pushApp($app); $GLOBALS['registry']->loadPrefs($app); - return $GLOBALS['prefs']->setValue($pref, $value); + $value = $GLOBALS['prefs']->setValue($pref, $value); + if ($pushed) { + $GLOBALS['registry']->popApp(); + } } /**