Do app pushing entirely within Registry.
authorMichael M Slusarz <slusarz@curecanti.org>
Sun, 11 Apr 2010 01:27:52 +0000 (19:27 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sun, 11 Apr 2010 01:30:43 +0000 (19:30 -0600)
This reverts commit 2b647b8ef7bb3be67b3b63616b9988de697744f6.

framework/Core/lib/Horde/Registry.php
horde/lib/Api.php

index 26634e3..6efa5b7 100644 (file)
@@ -1235,6 +1235,9 @@ class Horde_Registry
     {
         if (is_null($app)) {
             $app = $this->getApp();
+            $pushed = false;
+        } else {
+            $pushed = $this->pushApp($app);
         }
 
         /* If there is no logged in user, return an empty Horde_Prefs::
@@ -1249,6 +1252,10 @@ class Horde_Registry
                 $GLOBALS['prefs']->retrieve($app);
             }
         }
+
+        if ($pushed) {
+            $this->popApp();
+        }
     }
 
     /**
index 0204a41..7e3ab5d 100644 (file)
@@ -155,14 +155,8 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function getPreference($app, $pref)
     {
-        $pushed = $GLOBALS['registry']->pushApp($app);
         $GLOBALS['registry']->loadPrefs($app);
-        $value = $GLOBALS['prefs']->getValue($pref);
-        if ($pushed) {
-            $GLOBALS['registry']->popApp();
-        }
-
-        return $value;
+        return $GLOBALS['prefs']->getValue($pref);
     }
 
     /**
@@ -175,12 +169,8 @@ class Horde_Api extends Horde_Registry_Api
      */
     public function setPreference($app, $pref, $value)
     {
-        $pushed = $GLOBALS['registry']->pushApp($app);
         $GLOBALS['registry']->loadPrefs($app);
-        $value = $GLOBALS['prefs']->setValue($pref, $value);
-        if ($pushed) {
-            $GLOBALS['registry']->popApp();
-        }
+        return $GLOBALS['prefs']->setValue($pref, $value);
     }
 
     /**