Decouple Horde_History from Core.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 14 Apr 2010 10:14:13 +0000 (04:14 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 14 Apr 2010 20:03:54 +0000 (14:03 -0600)
41 files changed:
fima/lib/Driver.php
fima/lib/Report.php
fima/lib/ReportGraph.php
framework/Auth/lib/Horde/Auth/Kolab.php
framework/Core/lib/Horde/Core/Binder/History.php [new file with mode: 0644]
framework/Core/lib/Horde/Registry.php
framework/Core/package.xml
framework/Group/Group.php
framework/Group/Group/ldap.php
framework/Group/Group/sql.php
framework/History/lib/Horde/History.php
framework/History/lib/Horde/History/Factory.php
framework/History/package.xml
framework/History/test/Horde/History/InterfaceTest.php
framework/Kolab_Storage/lib/Horde/Kolab/Storage/Data.php
imp/lib/Maillog.php
kronolith/feed/index.php
kronolith/lib/Api.php
kronolith/lib/Application.php
kronolith/lib/Driver.php
kronolith/lib/Driver/Kolab.php
kronolith/lib/Driver/Sql.php
kronolith/lib/Event.php
kronolith/lib/View/Event.php
mnemo/data.php
mnemo/lib/Api.php
mnemo/lib/Driver.php
mnemo/lib/Driver/kolab.php
mnemo/lib/Driver/sql.php
mnemo/view.php
nag/lib/Api.php
nag/lib/Application.php
nag/lib/Driver.php
nag/lib/Task.php
nag/scripts/upgrades/create_missing_add_histories_sql.php
nag/view.php
turba/lib/Api.php
turba/lib/Driver.php
turba/lib/Driver/Sql.php
turba/lib/View/Browse.php
turba/lib/View/Contact.php

index 92018ce..7666073 100644 (file)
@@ -125,8 +125,7 @@ class Fima_Driver {
         }
 
         /* Log the creation of this item in the history log. */
-        $history = &Horde_History::singleton();
-        $history->log('fima:' . $this->_ledger . ':' . $accountId, array('action' => 'add'), true);
+        $GLOBALS['injector']->getInstance('Horde_History')->log('fima:' . $this->_ledger . ':' . $accountId, array('action' => 'add'), true);
 
         return $accountId;
     }
@@ -154,8 +153,7 @@ class Fima_Driver {
         /* Log the modification of this item in the history log. */
         $account = $this->getAccount($accountId);
         if (!is_a($account, 'PEAR_Error')) {
-            $history = &Horde_History::singleton();
-            $history->log('fima:' . $this->_ledger . ':' . $account['account_id'], array('action' => 'modify'), true);
+            $GLOBALS['injector']->getInstance('Horde_History')->log('fima:' . $this->_ledger . ':' . $account['account_id'], array('action' => 'modify'), true);
         }
 
         return true;
@@ -184,8 +182,7 @@ class Fima_Driver {
 
         /* Log the deletion of this item in the history log. */
         if (!is_a($account, 'PEAR_Error')) {
-            $history = &Horde_History::singleton();
-            $history->log('fima:' . $this->_ledger . ':' . $account['account_id'], array('action' => 'delete'), true);
+            $GLOBALS['injector']->getInstance('Horde_History')->log('fima:' . $this->_ledger . ':' . $account['account_id'], array('action' => 'delete'), true);
         }
 
         return true;
@@ -212,8 +209,7 @@ class Fima_Driver {
         }
 
         /* Log the creation of this item in the history log. */
-        $history = &Horde_History::singleton();
-        $history->log('fima:' . $this->_ledger . ':' . $postingId, array('action' => 'add'), true);
+        $GLOBALS['injector']->getInstance('Horde_History')->log('fima:' . $this->_ledger . ':' . $postingId, array('action' => 'add'), true);
 
         return $postingId;
     }
@@ -242,8 +238,7 @@ class Fima_Driver {
         /* Log the modification of this item in the history log. */
         $posting = $this->getPosting($postingId);
         if (!is_a($posting, 'PEAR_Error')) {
-            $history = &Horde_History::singleton();
-            $history->log('fima:' . $this->_ledger . ':' . $posting['posting_id'], array('action' => 'modify'), true);
+            $GLOBALS['injector']->getInstance('Horde_History')->log('fima:' . $this->_ledger . ':' . $posting['posting_id'], array('action' => 'modify'), true);
         }
 
         return true;
@@ -268,8 +263,7 @@ class Fima_Driver {
 
         /* Log the deletion of this item in the history log. */
         if (!is_a($posting, 'PEAR_Error')) {
-            $history = &Horde_History::singleton();
-            $history->log('fima:' . $this->_ledger . ':' . $posting['posting_id'], array('action' => 'delete'), true);
+            $GLOBALS['injector']->getInstance('Horde_History')->log('fima:' . $this->_ledger . ':' . $posting['posting_id'], array('action' => 'delete'), true);
         }
 
         return true;
@@ -296,8 +290,7 @@ class Fima_Driver {
 
         /* Log the shifting of this item in the history log. */
         if (!is_a($posting, 'PEAR_Error')) {
-            $history = &Horde_History::singleton();
-            $history->log('fima:' . $this->_ledger . ':' . $posting['posting_id'], array('action' => 'shift'), true);
+            $GLOBALS['injector']->getInstance('Horde_History')->log('fima:' . $this->_ledger . ':' . $posting['posting_id'], array('action' => 'shift'), true);
         }
 
         return true;
@@ -319,8 +312,7 @@ class Fima_Driver {
         }
 
         /* Log the deletion of this item in the history log. */
-        $history = &Horde_History::singleton();
-        $history->log('fima:' . $this->_ledger . ':all', array('action' => 'delete'), true);
+        $GLOBALS['injector']->getInstance('Horde_History')->log('fima:' . $this->_ledger . ':all', array('action' => 'delete'), true);
 
         return true;
     }
index b66c851..eb60d5f 100644 (file)
@@ -92,8 +92,7 @@ class Fima_Report {
         }
 
         /* Log the execution of the report in the history log. */
-        $history = &Horde_History::singleton();
-        $history->log('fima:report:' . $this->_params['report_id'], array('action' => 'execute'), true);
+        $GLOBALS['injector']->getInstance('Horde_History')->log('fima:report:' . $this->_params['report_id'], array('action' => 'execute'), true);
 
         return true;
     }
index 867307d..2ca7a54 100644 (file)
@@ -111,8 +111,7 @@ class Fima_ReportGraph {
         }
 
         /* Log the execution of the report in the history log. */
-        $history = &Horde_History::singleton();
-        $history->log('fima:reportgraph', array('action' => 'execute'), true);
+        $GLOBALS['injector']->getInstance('Horde_History')->log('fima:reportgraph', array('action' => 'execute'), true);
 
         return true;
     }
index daf108d..5060290 100644 (file)
@@ -69,7 +69,7 @@ class Horde_Auth_Kolab extends Horde_Auth_Base
 
 /*         if ($session->auth !== true && */
 /*             class_exists('Horde_History')) { */
-/*             $history = Horde_History::singleton(); */
+/*             $history = $GLOBALS['injector']->getInstance('Horde_History'); */
 
 /*             $history_identifier = "$userId@logins.kolab"; */
 /*             $history_log = $history->getHistory($history_identifier); */
diff --git a/framework/Core/lib/Horde/Core/Binder/History.php b/framework/Core/lib/Horde/Core/Binder/History.php
new file mode 100644 (file)
index 0000000..2bc8a09
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+/**
+ * @category Horde
+ * @package  Core
+ */
+class Horde_Core_Binder_History implements Horde_Injector_Binder
+{
+    public function create(Horde_Injector $injector)
+    {
+        if (empty($GLOBALS['conf']['sql']['phptype']) ||
+            ($GLOBALS['conf']['sql']['phptype'] == 'none')) {
+            throw new Horde_Exception(_("The History system is disabled."));
+        }
+
+        $ob = Horde_History::factory('Sql', $GLOBALS['conf']['sql']);
+        $ob->setLogger($injector->getInstance('Horde_Log_Logger'));
+
+        return $ob;
+    }
+
+    public function equals(Horde_Injector_Binder $binder)
+    {
+        return false;
+    }
+}
index 147e227..61941f4 100644 (file)
@@ -238,6 +238,7 @@ class Horde_Registry
             'Horde_Cache' => new Horde_Core_Binder_Cache(),
             'Horde_Db_Adapter_Base' => new Horde_Core_Binder_Db('reader'),
             'Horde_Editor' => new Horde_Core_Binder_Editor(),
+            'Horde_History' => new Horde_Core_Binder_History(),
             'Horde_Lock' => new Horde_Core_Binder_Lock(),
             'Horde_Log_Logger' => new Horde_Core_Binder_Logger(),
             'Horde_Memcache' => new Horde_Core_Binder_Memcache(),
index 38d8e4f..59fd59c 100644 (file)
@@ -70,6 +70,7 @@ Application Framework.
        <file name="Db.php" role="php" />
        <file name="Dns.php" role="php" />
        <file name="Editor.php" role="php" />
+       <file name="History.php" role="php" />
        <file name="Lock.php" role="php" />
        <file name="Logger.php" role="php" />
        <file name="Mail.php" role="php" />
@@ -216,6 +217,7 @@ Application Framework.
    <install name="lib/Horde/Core/Binder/Db.php" as="Horde/Core/Binder/Db.php" />
    <install name="lib/Horde/Core/Binder/Dns.php" as="Horde/Core/Binder/Dns.php" />
    <install name="lib/Horde/Core/Binder/Editor.php" as="Horde/Core/Binder/Editor.php" />
+   <install name="lib/Horde/Core/Binder/History.php" as="Horde/Core/Binder/History.php" />
    <install name="lib/Horde/Core/Binder/Lock.php" as="Horde/Core/Binder/Lock.php" />
    <install name="lib/Horde/Core/Binder/Logger.php" as="Horde/Core/Binder/Logger.php" />
    <install name="lib/Horde/Core/Binder/Mail.php" as="Horde/Core/Binder/Mail.php" />
index 2d7dd34..4f6f7f6 100644 (file)
@@ -239,7 +239,7 @@ class Group {
         }
 
         /* Log the addition of the group in the history log. */
-        Horde_History::singleton()->log($this->getGUID($group), array('action' => 'add'), true);
+        $GLOBALS['injector']->getInstance('Horde_History')->log($this->getGUID($group), array('action' => 'add'), true);
 
         return $result;
     }
@@ -265,7 +265,7 @@ class Group {
         $this->_groupCache[$group->getName()] = &$group;
 
         /* Log the update of the group users on the history log. */
-        $history = Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
         $guid = $this->getGUID($group);
         foreach ($group->getAuditLog() as $userId => $action) {
             $history->log($guid, array('action' => $action, 'user' => $userId), true);
@@ -299,7 +299,7 @@ class Group {
         }
         unset($this->_groupCache[$group->getName()]);
 
-        Horde_History::singleton()->log($this->getGUID($group), array('action' => 'delete'), true);
+        $GLOBALS['injector']->getInstance('Horde_History')->log($this->getGUID($group), array('action' => 'delete'), true);
 
         return $this->_datatree->remove($group, $force);
     }
index 4953f2f..664539f 100644 (file)
@@ -351,7 +351,7 @@ class Group_ldap extends Group {
         @ldap_close($this->_ds);
 
         /* Log the update of the group users on the history log. */
-        $history = Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
         $guid = $this->getGUID($group);
         foreach ($group->getAuditLog() as $userId => $action) {
             $history->log($guid, array('action' => $action, 'user' => $userId), true);
index b700db0..442da7b 100644 (file)
@@ -237,8 +237,7 @@ class Group_sql extends Group {
         }
 
         /* Log the addition of the group in the history log. */
-        $history = Horde_History::singleton();
-        $history->log($this->getGUID($group), array('action' => 'add'), true);
+        $GLOBALS['injector']->getInstance('Horde_History')->log($this->getGUID($group), array('action' => 'add'), true);
 
         return $result;
     }
@@ -282,7 +281,7 @@ class Group_sql extends Group {
         $this->_groupCache[$group->getName()] = &$group;
 
         /* Log the update of the group users on the history log. */
-        $history = Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
         $guid = $this->getGUID($group);
         foreach ($group->getAuditLog() as $userId => $action) {
             $history->log($guid, array('action' => $action, 'user' => $userId), true);
@@ -319,7 +318,7 @@ class Group_sql extends Group {
         }
         unset($this->_groupCache[$name]);
 
-        Horde_History::singleton()->log($this->getGUID($group), array('action' => 'delete'), true);
+        $GLOBALS['injector']->getInstance('Horde_History')->log($this->getGUID($group), array('action' => 'delete'), true);
 
         $query = 'DELETE FROM horde_groups_members WHERE group_uid = ?';
         $result = $this->_write_db->query($query, array($id));
index 52957b0..93787fc 100644 (file)
@@ -36,13 +36,6 @@ require_once 'Horde/Autoloader.php';
 abstract class Horde_History
 {
     /**
-     * Instance cache.
-     *
-     * @var array
-     */
-    static protected $_instances;
-
-    /**
      * Our log handler.
      *
      * @var Horde_Log_Logger
@@ -51,49 +44,29 @@ abstract class Horde_History
 
     /**
      * Attempts to return a reference to a concrete History instance.
-     * It will only create a new instance if no History instance
-     * currently exists.
-     *
-     * This method must be invoked as: $var = History::singleton()
      *
-     * @param string $driver The driver to use.
+     * @param string $driver  The driver to use.
+     * @param array $params   Parameters needed for the driver.
      *
      * @return Horde_History  The concrete Horde_History reference.
      * @throws Horde_History_Exception
      */
-    static public function singleton($driver = null)
+    static public function factory($driver, $params = array())
     {
-        global $conf;
+        $injector = new Horde_Injector(new Horde_Injector_TopLevel());
 
-        if (empty($driver)) {
-            $driver = 'Sql';
-        }
+        $injector->bindFactory(
+            __CLASS__,
+            __CLASS__ . '_Factory',
+            'getHistory'
+        );
 
-        if ($driver == 'Sql') {
-            if (empty($conf['sql']['phptype'])
-                || ($conf['sql']['phptype'] == 'none')) {
-                throw new Horde_History_Exception(_("The History system is disabled."));
-            }
-            $params = $conf['sql'];
-        } else {
-            $params = array();
-        }
-
-        if (!isset(self::$_instances[$driver])) {
-            $injector = new Horde_Injector(new Horde_Injector_TopLevel());
-            $injector->bindFactory(
-                __CLASS__,
-                __CLASS__ . '_Factory',
-                'getHistory'
-            );
-            $config = new stdClass;
-            $config->driver = $driver;
-            $config->params = $params;
-            $injector->setInstance(__CLASS__ . '_Config', $config);
-            self::$_instances[$driver] = $injector->getInstance(__CLASS__);
-        }
+        $config = new stdClass;
+        $config->driver = $driver;
+        $config->params = $params;
+        $injector->setInstance(__CLASS__ . '_Config', $config);
 
-        return self::$_instances[$driver];
+        return $injector->getInstance(__CLASS__);
     }
 
     /**
index 1051f79..4667d9a 100644 (file)
@@ -75,7 +75,7 @@ class Horde_History_Factory
      * @param Horde_Injector $injector  The environment for creating the
      *                                  instance.
      * @param array $params             The db connection parameters if the
-     *                                  environment does not already provide a 
+     *                                  environment does not already provide a
      *                                  connection.
      *
      * @return Horde_History_Sql The new Horde_History_Sql instance.
@@ -119,7 +119,7 @@ class Horde_History_Factory
      * @param Horde_Injector $injector  The environment for creating the
      *                                  instance.
      * @param array $params             The db connection parameters if the
-     *                                  environment does not already provide a 
+     *                                  environment does not already provide a
      *                                  connection.
      *
      * @return Horde_History_Mock The new Horde_History_Mock instance.
@@ -157,4 +157,4 @@ class Horde_History_Factory
         }
         return $db;
     }
-}
\ No newline at end of file
+}
index b39f27d..1e3e9b7 100644 (file)
@@ -58,7 +58,11 @@ http://pear.php.net/dtd/package-2.0.xsd">
     <min>1.5.4</min>
    </pearinstaller>
    <package>
-    <name>History</name>
+    <name>DB</name>
+    <channel>pear.php.net</channel>
+   </package>
+   <package>
+    <name>Exception</name>
     <channel>pear.horde.org</channel>
    </package>
   </required>
index 2f356fe..b3dd551 100644 (file)
@@ -177,13 +177,13 @@ EOL;
         return $this->_histories[$environment];
     }
 
-    public function testMethodSingletonHasResultHordehistoryWhichIsAlwaysTheSame()
+    public function testMethodFactoryHasResultHordehistoryWhichIsAlwaysTheSame()
     {
         foreach ($this->getEnvironments() as $environment) {
             $history = $this->getHistory($environment);
-            $history1 = Horde_History::singleton($environment);
+            $history1 = Horde_History::factory($environment);
             $this->assertType('Horde_History', $history1);
-            $history2 = Horde_History::singleton($environment);
+            $history2 = Horde_History::factory($environment);
             $this->assertType('Horde_History', $history2);
             $this->assertSame($history1, $history2);
         }
@@ -555,4 +555,4 @@ class Dummy_Db extends DB_common
         $e = new PEAR_Error('Error');
         return $e;
     }
-}
\ No newline at end of file
+}
index f2575d9..104b83b 100644 (file)
@@ -475,7 +475,7 @@ class Horde_Kolab_Storage_Data
 
         /* Log the action on this item in the history log. */
         try {
-            Horde_History::singleton()
+            $GLOBALS['injector']->getInstance('Horde_History')
                 ->log($app . ':' . $this->_folder->getShareId() . ':' . $object_uid,
                       array('action' => $action, 'ts' => $mod_ts),
                       true);
index 0517015..ed1d49f 100644 (file)
@@ -26,7 +26,7 @@ class IMP_Maillog
      */
     static public function log($type, $msg_ids, $data = null)
     {
-        $history = Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
 
         if (!is_array($msg_ids)) {
             $msg_ids = array($msg_ids);
@@ -76,7 +76,7 @@ class IMP_Maillog
      */
     static public function getLog($msg_id)
     {
-        return Horde_History::singleton()->getHistory(self::_getUniqueHistoryId($msg_id));
+        return $GLOBALS['injector']->getInstance('Horde_History')->getHistory(self::_getUniqueHistoryId($msg_id));
     }
 
     /**
@@ -195,8 +195,7 @@ class IMP_Maillog
         }
         $msg_ids = array_map(array('IMP_Maillog', '_getUniqueHistoryId'), $msg_ids);
 
-        $history = Horde_History::singleton();
-        $history->removeByNames($msg_ids);
+        $GLOBALS['injector']->getInstance('Horde_History')->removeByNames($msg_ids);
     }
 
     /**
index fab022d..d605c66 100644 (file)
@@ -87,7 +87,7 @@ if (isset($conf['urls']['pretty']) && $conf['urls']['pretty'] == 'rewrite') {
 
 $owner = $share->get('owner');
 $identity = Horde_Prefs_Identity::factory('none', $owner);
-$history = Horde_History::singleton();
+$history = $injector->getInstance('Horde_History');
 $now = new Horde_Date(time());
 
 $template = $injector->createInstance('Horde_Template');
index 6602a82..441a4e5 100644 (file)
@@ -328,7 +328,7 @@ class Kronolith_Api extends Horde_Registry_Api
                         // the event's history.
                         $created = $modified = null;
                         try {
-                            $log = Horde_History::singleton()->getHistory('kronolith:' . $calendar . ':' . $uid);
+                            $log = $GLOBALS['injector']->getInstance('Horde_History')->getHistory('kronolith:' . $calendar . ':' . $uid);
                             foreach ($log as $entry) {
                                 switch ($entry['action']) {
                                 case 'add':
@@ -496,7 +496,7 @@ class Kronolith_Api extends Horde_Registry_Api
             throw new Horde_Exception_PermissionDenied();
         }
 
-        $histories = Horde_History::singleton()->getByTimestamp('>', $timestamp, array(array('op' => '=', 'field' => 'action', 'value' => $action)), 'kronolith:' . $calendar);
+        $histories = $GLOBALS['injector']->getInstance('Horde_History')->getByTimestamp('>', $timestamp, array(array('op' => '=', 'field' => 'action', 'value' => $action)), 'kronolith:' . $calendar);
 
         // Strip leading kronolith:username:.
         return preg_replace('/^([^:]*:){2}/', '', array_keys($histories));
@@ -525,7 +525,7 @@ class Kronolith_Api extends Horde_Registry_Api
             throw new Horde_Exception_PermissionDenied();
         }
 
-        return Horde_History::singleton()->getActionTimestamp('kronolith:' . $calendar . ':' . $uid, $action);
+        return $GLOBALS['injector']->getInstance('Horde_History')->getActionTimestamp('kronolith:' . $calendar . ':' . $uid, $action);
     }
 
     /**
index 9263252..05af8c4 100644 (file)
@@ -426,7 +426,7 @@ class Kronolith_Application extends Horde_Registry_Application
         $result = Kronolith::getDriver()->removeUserData($user);
 
         /* Now delete history as well. */
-        Horde_History::singleton()->removeByParent('kronolith:' . $user);
+        $GLOBALS['injector']->getInstance('Horde_History')->removeByParent('kronolith:' . $user);
 
         /* Get the user's default share */
         try {
index e4b77a9..f57461e 100644 (file)
@@ -318,7 +318,7 @@ class Kronolith_Driver
         /* Log the moving of this item in the history log. */
         $uid = $event->uid;
         if ($uid) {
-            $history = Horde_History::singleton();
+            $history = $GLOBALS['injector']->getInstance('Horde_History');
             try {
                 $history->log('kronolith:' . $event->calendar . ':' . $uid, array('action' => 'delete'), true);
                 $history->log('kronolith:' . $newCalendar . ':' . $uid, array('action' => 'add'), true);
index cc0ce5f..2855c31 100644 (file)
@@ -378,7 +378,7 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver
 
         /* Log the creation/modification of this item in the history log. */
         try {
-            Horde_History::singleton()->log('kronolith:' . $event->calendar . ':' . $event->uid, $action, true);
+            $GLOBALS['injector']->getInstance('Horde_History')->log('kronolith:' . $event->calendar . ':' . $event->uid, $action, true);
         } catch (Exception $e) {
             Horde::logMessage($e, 'ERR');
         }
@@ -469,7 +469,7 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver
 
             /* Log the deletion of this item in the history log. */
             try {
-                Horde_History::singleton()->log('kronolith:' . $event->calendar . ':' . $event->uid, array('action' => 'delete'), true);
+                $GLOBALS['injector']->getInstance('Horde_History')->log('kronolith:' . $event->calendar . ':' . $event->uid, array('action' => 'delete'), true);
             } catch (Exception $e) {
                 Horde::logMessage($e, 'ERR');
             }
index 43428f4..eb25a98 100644 (file)
@@ -583,7 +583,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver
             /* Log the modification of this item in the history log. */
             if ($event->uid) {
                 try {
-                    Horde_History::singleton()->log('kronolith:' . $this->calendar . ':' . $event->uid, array('action' => 'modify'), true);
+                    $GLOBALS['injector']->getInstance('Horde_History')->log('kronolith:' . $this->calendar . ':' . $event->uid, array('action' => 'modify'), true);
                 } catch (Exception $e) {
                     Horde::logMessage($e, 'ERR');
                 }
@@ -651,7 +651,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver
 
         /* Log the creation of this item in the history log. */
         try {
-            Horde_History::singleton()->log('kronolith:' . $this->calendar . ':' . $uid, array('action' => 'add'), true);
+            $GLOBALS['injector']->getInstance('Horde_History')->log('kronolith:' . $this->calendar . ':' . $uid, array('action' => 'add'), true);
         } catch (Exception $e) {
             Horde::logMessage($e, 'ERR');
         }
@@ -753,7 +753,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver
         /* Log the deletion of this item in the history log. */
         if ($event->uid) {
             try {
-                Horde_History::singleton()->log('kronolith:' . $this->calendar . ':' . $event->uid, array('action' => 'delete'), true);
+                $GLOBALS['injector']->getInstance('Horde_History')->log('kronolith:' . $this->calendar . ':' . $event->uid, array('action' => 'delete'), true);
             } catch (Exception $e) {
                 Horde::logMessage($e, 'ERR');
             }
index 438d45e..f465713 100644 (file)
@@ -531,7 +531,7 @@ abstract class Kronolith_Event
         /* Get the event's history. */
         $created = $modified = null;
         try {
-            $log = Horde_History::singleton()->getHistory('kronolith:' . $this->calendar . ':' . $this->uid);
+            $log = $GLOBALS['injector']->getInstance('Horde_History')->getHistory('kronolith:' . $this->calendar . ':' . $this->uid);
             foreach ($log as $entry) {
                 switch ($entry['action']) {
                 case 'add':
index 6dca486..3a0d1c8 100644 (file)
@@ -52,7 +52,7 @@ class Kronolith_View_Event {
         if ($this->event->uid) {
             /* Get the event's history. */
             try {
-                $log = Horde_History::singleton()
+                $log = $GLOBALS['injector']->getInstance('Horde_History')
                     ->getHistory('kronolith:' . $this->event->calendar . ':' . $this->event->uid);
                 foreach ($log as $entry) {
                     switch ($entry['action']) {
index c9e64ac..76a7f00 100644 (file)
@@ -164,7 +164,7 @@ if (is_array($next_step)) {
         /* If we have created or modified dates for the note, set them
          * correctly in the history log. */
         if (!empty($row['created'])) {
-            $history = &Horde_History::singleton();
+            $history = $GLOBALS['injector']->getInstance('Horde_History');
             if (is_array($row['created'])) {
                 $row['created'] = $row['created']['ts'];
             }
@@ -172,7 +172,7 @@ if (is_array($next_step)) {
                           array('action' => 'add', 'ts' => $row['created']), true);
         }
         if (!empty($row['modified'])) {
-            $history = &Horde_History::singleton();
+            $history = $GLOBALS['injector']->getInstance('Horde_History');
             if (is_array($row['modified'])) {
                 $row['modified'] = $row['modified']['ts'];
             }
index 8f0717c..e206c9a 100644 (file)
@@ -127,7 +127,7 @@ function _mnemo_removeUserData($user)
         }
 
         /* Now delete history as well. */
-        $history = &Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
         if (method_exists($history, 'removeByParent')) {
             $histories = $history->removeByParent('mnemo:' . $user);
         } else {
@@ -252,7 +252,7 @@ function _mnemo_listBy($action, $timestamp, $notepad = null)
         return PEAR::raiseError(_("Permission Denied"));
     }
 
-    $history = &Horde_History::singleton();
+    $history = $GLOBALS['injector']->getInstance('Horde_History');
     $histories = $history->getByTimestamp('>', $timestamp, array(array('op' => '=', 'field' => 'action', 'value' => $action)), 'mnemo:' . $notepad);
     if (is_a($histories, 'PEAR_Error')) {
         return $histories;
@@ -285,7 +285,7 @@ function _mnemo_getActionTimestamp($uid, $action, $notepad = null)
         return PEAR::raiseError(_("Permission Denied"));
     }
 
-    $history = &Horde_History::singleton();
+    $history = $GLOBALS['injector']->getInstance('Horde_History');
     return $history->getActionTimestamp('mnemo:' . $notepad . ':' . $uid, $action);
 }
 
index 6145930..4149b24 100644 (file)
@@ -285,7 +285,7 @@ class Mnemo_Driver {
         }
 
         /* Get the note's history. */
-        $history = &Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
         $log = $history->getHistory('mnemo:' . $memo['memolist_id'] . ':' . $memo['uid']);
         if ($log && !is_a($log, 'PEAR_Error')) {
             foreach ($log->getData() as $entry) {
index ea83b58..a2f2091 100644 (file)
@@ -622,7 +622,7 @@ class Mnemo_Driver_kolab_wrapper_new extends Mnemo_Driver_kolab_wrapper {
         }
 
         /* Log the action in the history log. */
-        $history = &Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
         $history->log('mnemo:' . $this->_notepad . ':' . $this->_uniqueId($note_uid), $action, true);
 
         return $this->_uniqueId($note_uid);
@@ -696,7 +696,7 @@ class Mnemo_Driver_kolab_wrapper_new extends Mnemo_Driver_kolab_wrapper {
             return $result;
         }
 
-        $history = &Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
         $history->log('mnemo:' . $this->_notepad . ':' . $this->_uniqueId($noteId), array('action' => 'delete'), true);
 
         return $result;
index 33203a0..b2ee2b6 100644 (file)
@@ -251,7 +251,7 @@ class Mnemo_Driver_sql extends Mnemo_Driver {
         }
 
         /* Log the creation of this item in the history log. */
-        $history = &Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
         $history->log('mnemo:' . $this->_notepad . ':' . $uid, array('action' => 'add'), true);
 
         return $noteId;
@@ -303,7 +303,7 @@ class Mnemo_Driver_sql extends Mnemo_Driver {
         /* Log the modification of this item in the history log. */
         $note = $this->get($noteId);
         if (!empty($note['uid'])) {
-            $history = &Horde_History::singleton();
+            $history = $GLOBALS['injector']->getInstance('Horde_History');
             $history->log('mnemo:' . $this->_notepad . ':' . $note['uid'], array('action' => 'modify'), true);
         }
 
@@ -338,7 +338,7 @@ class Mnemo_Driver_sql extends Mnemo_Driver {
 
         /* Log the moving of this item in the history log. */
         if (!empty($note['uid'])) {
-            $history = &Horde_History::singleton();
+            $history = $GLOBALS['injector']->getInstance('Horde_History');
             $history->log('mnemo:' . $this->_notepad . ':' . $note['uid'], array('action' => 'delete'), true);
             $history->log('mnemo:' . $newNotepad . ':' . $note['uid'], array('action' => 'add'), true);
         }
@@ -368,7 +368,7 @@ class Mnemo_Driver_sql extends Mnemo_Driver {
 
         /* Log the deletion of this item in the history log. */
         if (!empty($note['uid'])) {
-            $history = &Horde_History::singleton();
+            $history = $GLOBALS['injector']->getInstance('Horde_History');
             $history->log('mnemo:' . $this->_notepad . ':' . $note['uid'], array('action' => 'delete'), true);
         }
 
index eb7ce90..5e5b438 100644 (file)
@@ -64,7 +64,7 @@ $userId = Horde_Auth::getAuth();
 $createdby = '';
 $modifiedby = '';
 if (!empty($memo['uid'])) {
-    $log = Horde_History::singleton()->getHistory('mnemo:' . $memolist_id . ':' . $memo['uid']);
+    $log = $GLOBALS['injector']->getInstance('Horde_History')->getHistory('mnemo:' . $memolist_id . ':' . $memo['uid']);
     if ($log && !is_a($log, 'PEAR_Error')) {
        foreach ($log as $entry) {
             switch ($entry['action']) {
index ee8b3ac..38e0a28 100644 (file)
@@ -475,7 +475,7 @@ class Nag_Api extends Horde_Registry_Api
                         }
                         // Check if our task is newer then the existing - get
                         // the task's history.
-                        $history = Horde_History::singleton();
+                        $history = $GLOBALS['injector']->getInstance('Horde_History');
                         $created = $modified = null;
                         try {
                             $log = $history->getHistory('nag:' . $tasklist . ':' . $task->uid);
@@ -694,7 +694,7 @@ class Nag_Api extends Horde_Registry_Api
                 return PEAR::raiseError(_("Permission Denied"));
             }
 
-        $histories = Horde_History::singleton()->getByTimestamp('>', $timestamp, array(array('op' => '=', 'field' => 'action', 'value' => $action)), 'nag:' . $tasklist);
+        $histories = $GLOBALS['injector']->getInstance('Horde_History')->getByTimestamp('>', $timestamp, array(array('op' => '=', 'field' => 'action', 'value' => $action)), 'nag:' . $tasklist);
 
         // Strip leading nag:username:.
         return preg_replace('/^([^:]*:){2}/', '', array_keys($histories));
@@ -723,7 +723,7 @@ class Nag_Api extends Horde_Registry_Api
                 return PEAR::raiseError(_("Permission Denied"));
             }
 
-        return Horde_History::singleton()->getActionTimestamp('nag:' . $tasklist . ':' . $uid, $action);
+        return $GLOBALS['injector']->getInstance('Horde_History')->getActionTimestamp('nag:' . $tasklist . ':' . $uid, $action);
     }
 
     /**
index 8d26933..b8e7278 100644 (file)
@@ -256,7 +256,7 @@ class Nag_Application extends Horde_Registry_Application
         }
 
         /* Now delete history as well. */
-        Horde_History::singleton()->removeByParent('nag:' . $user);
+        $GLOBALS['injector']->getInstance('Horde_History')->removeByParent('nag:' . $user);
 
         /* ...and finally, delete the actual share */
         if (!empty($share)) {
index 30f1b85..8663ac4 100644 (file)
@@ -226,7 +226,7 @@ class Nag_Driver
         $task = $this->get($taskId);
 
         /* Log the creation of this item in the history log. */
-        $history = Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
         try {
             $history->log('nag:' . $this->_tasklist . ':' . $uid, array('action' => 'add'), true);
         } catch (Exception $e) {
@@ -337,7 +337,7 @@ class Nag_Driver
 
             /* Log the moving of this item in the history log. */
             if (!empty($task->uid)) {
-                $history = Horde_History::singleton();
+                $history = $GLOBALS['injector']->getInstance('Horde_History');
                 try {
                     $history->log('nag:' . $task->tasklist . ':' . $task->uid, array('action' => 'delete'), true);
                 } catch (Exception $e) {
@@ -368,7 +368,7 @@ class Nag_Driver
         /* Log the modification of this item in the history log. */
         if (!empty($task->uid)) {
             try {
-                Horde_History::singleton()->log('nag:' . $log_tasklist . ':' . $task->uid, array('action' => 'modify'), true);
+                $GLOBALS['injector']->getInstance('Horde_History')->log('nag:' . $log_tasklist . ':' . $task->uid, array('action' => 'modify'), true);
             } catch (Exception $e) {
                 Horde::logMessage($e, 'ERR');
             }
@@ -381,7 +381,7 @@ class Nag_Driver
                 $attributes['ts'] = 0;
             }
             try {
-                Horde_History::singleton()->log('nag:' . $log_tasklist . ':' . $task->uid, $attributes, true);
+                $GLOBALS['injector']->getInstance('Horde_History')->log('nag:' . $log_tasklist . ':' . $task->uid, $attributes, true);
             } catch (Exception $e) {
                 Horde::logMessage($e, 'ERR');
             }
@@ -417,7 +417,7 @@ class Nag_Driver
         /* Log the deletion of this item in the history log. */
         if (!empty($task->uid)) {
             try {
-                Horde_History::singleton()->log('nag:' . $this->_tasklist . ':' . $task->uid, array('action' => 'delete'), true);
+                $GLOBALS['injector']->getInstance('Horde_History')->log('nag:' . $this->_tasklist . ':' . $task->uid, array('action' => 'delete'), true);
             } catch (Exception $e) {
                 Horde::logMessage($e, 'ERR');
             }
index 3527412..ebc4a44 100644 (file)
@@ -853,7 +853,7 @@ class Nag_Task {
         /* Get the task's history. */
         $created = $modified = null;
         try {
-            $log = Horde_History::singleton()->getHistory('nag:' . $this->tasklist . ':' . $this->uid);
+            $log = $GLOBALS['injector']->getInstance('Horde_History')->getHistory('nag:' . $this->tasklist . ':' . $this->uid);
             foreach ($log as $entry) {
                 switch ($entry['action']) {
                 case 'add':
index 95c7a19..ed1f62f 100755 (executable)
@@ -13,7 +13,7 @@
 require_once dirname(__FILE__) . '/../../lib/Application.php';
 Horde_Registry::appInit('nag', array('authentication' => 'none', 'cli' => true));
 
-$history = Horde_History::singleton();
+$history = $GLOBALS['injector']->getInstance('Horde_History');
 
 // Run through every tasklist.
 $tasklists = $nag_shares->listAllShares();
index 17f82fa..7bc48e7 100644 (file)
@@ -62,7 +62,7 @@ $createdby = '';
 $modifiedby = '';
 if (!empty($task->uid)) {
     try {
-        $log = Horde_History::singleton()->getHistory('nag:' . $tasklist_id . ':' . $task->uid);
+        $log = $GLOBALS['injector']->getInstance('Horde_History')->getHistory('nag:' . $tasklist_id . ':' . $task->uid);
         foreach ($log as $entry) {
             switch ($entry['action']) {
             case 'add':
index d66d3bd..b62dce2 100644 (file)
@@ -509,7 +509,7 @@ class Turba_Api extends Horde_Registry_Api
         }
 
         $uids = array();
-        $history = Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
         foreach ($sources as $source) {
             if (empty($source) || !isset($cfgSources[$source])) {
                 throw new Horde_Exception(sprintf(_("Invalid address book: %s"), $source));
@@ -569,7 +569,7 @@ class Turba_Api extends Horde_Registry_Api
         }
 
         $last = 0;
-        $history = Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
         foreach ($sources as $source) {
             if (empty($source) || !isset($cfgSources[$source])) {
                 throw new Horde_Exception(sprintf(_("Invalid address book: %s"), $source));
index 18443e0..f74248e 100644 (file)
@@ -784,7 +784,7 @@ class Turba_Driver
 
         /* Log the creation of this item in the history log. */
         try {
-            Horde_History::singleton()
+            $GLOBALS['injector']->getInstance('Horde_History')
                 ->log('turba:' . $this->getName() . ':' . $uid,
                       array('action' => 'add'), true);
         } catch (Exception $e) {
@@ -841,7 +841,7 @@ class Turba_Driver
         /* Log the deletion of this item in the history log. */
         if ($object->getValue('__uid')) {
             try {
-                Horde_History::singleton()->log($object->getGuid(),
+                $GLOBALS['injector']->getInstance('Horde_History')->log($object->getGuid(),
                                                 array('action' => 'delete'),
                                                 true);
             } catch (Exception $e) {
@@ -888,7 +888,7 @@ class Turba_Driver
         /* Log the modification of this item in the history log. */
         if ($object->getValue('__uid')) {
             try {
-                Horde_History::singleton()->log($object->getGuid(),
+                $GLOBALS['injector']->getInstance('Horde_History')->log($object->getGuid(),
                                                 array('action' => 'modify'),
                                                 true);
             } catch (Exception $e) {
index 93ee615..6f14256 100644 (file)
@@ -362,7 +362,7 @@ class Turba_Driver_Sql extends Turba_Driver
         }
 
         /* Update Horde_History */
-        $history = Horde_History::singleton();
+        $history = $GLOBALS['injector']->getInstance('Horde_History');
         try {
             while ($ids->fetchInto($row)) {
                 // This is slightly hackish, but it saves us from having to
index 71831c4..bf8e983 100644 (file)
@@ -219,7 +219,7 @@ class Turba_View_Browse {
                          * because otherwise the delete log would be after the
                          * add log. */
                         try {
-                            Horde_History::singleton()
+                            $GLOBALS['injector']->getInstance('Horde_History')
                                 ->log('turba:' . $targetDriver->getName() . ':' . $objAttributes['__uid'],
                                       array('action' => 'add'),
                                       true);
index c3c0aaa..2dcf22c 100644 (file)
@@ -47,7 +47,7 @@ class Turba_View_Contact {
         /* Get the contact's history. */
         if ($this->contact->getValue('__uid')) {
             try {
-                $log = Horde_History::singleton()->getHistory($this->contact->getGuid());
+                $log = $GLOBALS['injector']->getInstance('Horde_History')->getHistory($this->contact->getGuid());
                 foreach ($log as $entry) {
                     switch ($entry['action']) {
                     case 'add':