}
/* 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;
}
/* 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;
/* 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;
}
/* 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;
}
/* 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;
/* 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;
/* 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;
}
/* 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;
}
}
/* 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;
}
}
/* 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;
}
/* 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); */
--- /dev/null
+<?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;
+ }
+}
'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(),
<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" />
<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" />
}
/* 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;
}
$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);
}
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);
}
@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);
}
/* 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;
}
$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);
}
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));
abstract class Horde_History
{
/**
- * Instance cache.
- *
- * @var array
- */
- static protected $_instances;
-
- /**
* Our log handler.
*
* @var Horde_Log_Logger
/**
* 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__);
}
/**
* @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.
* @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.
}
return $db;
}
-}
\ No newline at end of file
+}
<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>
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);
}
$e = new PEAR_Error('Error');
return $e;
}
-}
\ No newline at end of file
+}
/* 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);
*/
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);
*/
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));
}
/**
}
$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);
}
/**
$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');
// 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':
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));
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);
}
/**
$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 {
/* 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);
/* 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');
}
/* 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');
}
/* 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');
}
/* 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');
}
/* 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');
}
/* 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':
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']) {
/* 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'];
}
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'];
}
}
/* 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 {
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;
return PEAR::raiseError(_("Permission Denied"));
}
- $history = &Horde_History::singleton();
+ $history = $GLOBALS['injector']->getInstance('Horde_History');
return $history->getActionTimestamp('mnemo:' . $notepad . ':' . $uid, $action);
}
}
/* 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) {
}
/* 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);
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;
}
/* 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;
/* 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);
}
/* 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);
}
/* 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);
}
$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']) {
}
// 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);
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));
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);
}
/**
}
/* 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)) {
$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) {
/* 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) {
/* 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');
}
$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');
}
/* 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');
}
/* 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':
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();
$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':
}
$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));
}
$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));
/* 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) {
/* 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) {
/* 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) {
}
/* 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
* 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);
/* 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':