From: Michael M Slusarz Date: Mon, 30 Nov 2009 23:33:59 +0000 (-0700) Subject: Fix 'load_base' registry application loading. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=872f800928a0f398f73c311c9524e36942c0f4c1;p=horde.git Fix 'load_base' registry application loading. Rename load_base -> init Now can init an app from the registry if it doesn't have a base.php file Login Tasks should now be able to be run in that application's environment, without need to set up the environment in the tasks. --- diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index 569fd370c..7e6f9b64e 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -823,8 +823,10 @@ class Horde_Registry * ONLY be disabled by system scripts (cron jobs, etc.) * and scripts that handle login. * DEFAULT: true - * 'load_base' - (boolean) Load the application's base.php file? - * DEFAULT: false + * 'init' - (boolean) Init the application (by either loading the + * application's base.php file (deprecated) or calling init() + * on the Application object)? + * 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. @@ -912,6 +914,17 @@ class Horde_Registry throw $e; } catch (Horde_Exception_HookNotSet $e) {} + /* Initialize application. */ + if (!empty($options['init']) || + ($checkPerms && !empty($options['logintasks']))) { + if (file_exists($app_lib . '/base.php')) { + // TODO: Remove once there is no more base.php files + require_once $app_lib . '/base.php'; + } else { + $this->callAppMethod($app, 'init'); + } + } + /* Do login tasks. */ if ($checkPerms) { $tasks = Horde_LoginTasks::singleton($app); @@ -920,14 +933,6 @@ class Horde_Registry } } - /* Include base.php file. */ - // TODO: Remove once there is no more base.php files - if (!empty($options['load_base'])) { - if (file_exists($app_lib . '/base.php')) { - require_once $app_lib . '/base.php'; - } - } - return true; } diff --git a/framework/Core/lib/Horde/Registry/Application.php b/framework/Core/lib/Horde/Registry/Application.php index 32fd2268c..89c79c9a5 100644 --- a/framework/Core/lib/Horde/Registry/Application.php +++ b/framework/Core/lib/Horde/Registry/Application.php @@ -33,4 +33,12 @@ class Horde_Registry_Application */ public $disabled = array(); + /** + * Initialization. Does any necessary init needed to setup the full + * environment for the application. + */ + public function init() + { + } + }