Change Horde_Registry_Application init to noinit
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 20 Jan 2010 06:09:30 +0000 (23:09 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 20 Jan 2010 16:32:33 +0000 (09:32 -0700)
Now that bootstrap init has been separated from application init, we
always want to call an application's _init() function when accessing the
application for the first time.  Keep the 'init' param, but rename it to
'noinit' and make a truthy value disable this new behavior (opposite of
current default).

framework/Core/lib/Horde/Registry.php
horde/services/prefs.php
horde/test.php

index 8a83adb..36072a8 100644 (file)
@@ -948,10 +948,8 @@ class Horde_Registry
      *                 ONLY be disabled by system scripts (cron jobs, etc.)
      *                 and scripts that handle login.
      *                 DEFAULT: true
-     * 'init' - (boolean) Init the application (by either loading the
-     *          application's base.php file (deprecated) or calling init()
-     *          on the Application object)?
-     *          DEFAULT: false
+     * 'noinit' - (boolean) Do not init the application.
+     *            DEFAULT: false
      * 'logintasks' - (boolean) Perform login tasks? Only performed if
      *                'check_perms' is also true. System tasks are always
      *                peformed if the user is authorized.
@@ -1041,7 +1039,7 @@ class Horde_Registry
         } catch (Horde_Exception_HookNotSet $e) {}
 
         /* Initialize application. */
-        if ($checkPerms || !empty($options['init'])) {
+        if ($checkPerms || empty($options['noinit'])) {
             try {
                 if (file_exists($app_lib . '/base.php')) {
                     // TODO: Remove once there is no more base.php files
index 902118b..ed7e958 100644 (file)
@@ -12,9 +12,8 @@
  * @category Horde
  */
 
-require_once dirname(__FILE__) . '/../lib/core.php';
-
-$registry = Horde_Registry::singleton();
+require_once dirname(__FILE__) . '/../lib/Application.php';
+Horde_Registry::appInit('horde');
 
 /* Figure out which application we're setting preferences for. */
 $app = Horde_Util::getFormData('app', Horde_Prefs_Ui::getDefaultApp());
@@ -27,7 +26,7 @@ $group = Horde_Util::getFormData('group');
 $chunk = Horde_Util::nonInputVar('chunk');
 
 /* Load $app's base environment. */
-$registry->pushApp($app, array('init' => true));
+$registry->pushApp($app);
 
 /* If a prefs notification status handler is set, activate it now. */
 if (!empty($_SESSION['horde_prefs']['status'])) {
index e365f8d..19643da 100644 (file)
@@ -49,7 +49,7 @@ $app_version = $registry->getVersion($app);
 /* If we've gotten this far, we should have found enough of Horde to run
  * tests. Create the testing object. */
 if ($app != 'horde') {
-    $registry->pushApp($app, array('check_perms' => false, 'init' => true));
+    $registry->pushApp($app, array('check_perms' => false));
 }
 $classname = ucfirst($app) . '_Test';
 if (!class_exists($classname)) {