Notification singleton best initialized in Horde_Registry constructor
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 3 Feb 2010 22:02:02 +0000 (15:02 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 3 Feb 2010 23:28:57 +0000 (16:28 -0700)
framework/Core/lib/Horde/Registry.php
framework/Core/lib/Horde/Registry/Application.php

index c4897f6..290f0ea 100644 (file)
@@ -309,6 +309,14 @@ class Horde_Registry
         /* Create the global permissions object. */
         // TODO: Convert to using Horde_Injector
         $GLOBALS['perms'] = Horde_Perms::singleton();
+        $injector->setInstance('Horde_Perms', $GLOBALS['perms']);
+
+        /**
+         * Initialize notification object.
+         * No listeners are attached at this point.
+         */
+        $GLOBALS['notification'] = Horde_Notification::singleton();
+        $injector->setInstance('Horde_Notification', $GLOBALS['notification']);
     }
 
     /**
index 3f87443..c5c6446 100644 (file)
@@ -61,11 +61,6 @@ class Horde_Registry_Application
      * Initialization. Does any necessary init needed to setup the full
      * environment for the application.
      *
-     * Global variables defined:
-     * <pre>
-     * $notification - Horde_Notification object.
-     * </pre>
-     *
      * Global constants defined:
      * <pre>
      * [APPNAME]_TEMPLATES - (string) Location of template files.
@@ -81,7 +76,6 @@ class Horde_Registry_Application
                 define($appname . '_TEMPLATES', $GLOBALS['registry']->get('templates'));
             }
 
-            $GLOBALS['notification'] = Horde_Notification::singleton();
             $this->_init();
             $this->_initNotification($GLOBALS['notification']);
         }
@@ -97,6 +91,8 @@ class Horde_Registry_Application
 
     /**
      * Initialization for Notification system.
+     * This is run after _init() is called so app-specific code can appear
+     * inside.
      *
      * @param Horde_Notification_Handler_Base $notify  The notification
      *                                                 object.