From 3ed159b066622e452a443670ecbb5307043163b6 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 19 Jan 2010 23:09:30 -0700 Subject: [PATCH] Change Horde_Registry_Application init to noinit 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 | 8 +++----- horde/services/prefs.php | 7 +++---- horde/test.php | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index 8a83adb05..36072a800 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -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 diff --git a/horde/services/prefs.php b/horde/services/prefs.php index 902118b10..ed7e9582f 100644 --- a/horde/services/prefs.php +++ b/horde/services/prefs.php @@ -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'])) { diff --git a/horde/test.php b/horde/test.php index e365f8d4b..19643da6d 100644 --- a/horde/test.php +++ b/horde/test.php @@ -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)) { -- 2.11.0