Skip to content

Commit

Permalink
Instantiate objects only once.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Feb 19, 2016
1 parent ca66558 commit fa1002d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions mnemo/lib/Driver.php
Expand Up @@ -290,23 +290,26 @@ abstract protected function _delete($noteId);
*/
public function deleteAll()
{
global $injector, $registry;

$uids = $this->_deleteAll();

// Update History.
$history = $GLOBALS['injector']->getInstance('Horde_History');
$history = $injector->getInstance('Horde_History');
$tagger = $injector->getInstance('Mnemo_Tagger');
$manager = $injector->getInstance('Content_Objects_Manager');
try {
foreach ($uids as $uid) {
$history->log(
'mnemo:' . $this->_notepad . ':' . $uid,
array('action' => 'delete'),
true);

$GLOBALS['injector']->getInstance('Mnemo_Tagger')
->replaceTags($uid, array(), $GLOBALS['registry']->getAuth(), 'note');
$tagger->replaceTags(
$uid, array(), $registry->getAuth(), 'note'
);

/* Tell content we removed the object */
$GLOBALS['injector']->getInstance('Content_Objects_Manager')
->delete(array($uid), 'note');
$manager->delete(array($uid), 'note');
}
} catch (Horde_Exception $e) {
}
Expand Down

0 comments on commit fa1002d

Please sign in to comment.