From: Michael M Slusarz Date: Tue, 4 May 2010 08:25:24 +0000 (-0600) Subject: Bug #9004: expungeMailbox() should return an IMP_Indices() object X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8d616b7052a654406e86920a18af591f8bf3f301;p=horde.git Bug #9004: expungeMailbox() should return an IMP_Indices() object --- diff --git a/imp/lib/Ajax/Application.php b/imp/lib/Ajax/Application.php index 2ea581a65..49d371f84 100644 --- a/imp/lib/Ajax/Application.php +++ b/imp/lib/Ajax/Application.php @@ -1201,9 +1201,7 @@ class IMP_Ajax_Application extends Horde_Ajax_Application_Base */ public function purgeDeleted() { - $indices = new IMP_Indices($this->_vars->uid); $change = $this->_changed(true); - if (is_null($change)) { return false; } @@ -1215,11 +1213,10 @@ class IMP_Ajax_Application extends Horde_Ajax_Application_Base $expunged = $GLOBALS['injector']->getInstance('IMP_Message')->expungeMailbox(array($this->_vars->view => 1), array('list' => true)); - if (empty($expunged[$this->_vars->view])) { + if (!($expunge_count = $expunged->count())) { return false; } - $expunge_count = count($expunged[$this->_vars->view]); $display_folder = IMP::displayFolder($this->_vars->view); if ($expunge_count == 1) { $GLOBALS['notification']->push(sprintf(_("1 message was purged from \"%s\"."), $display_folder), 'horde.success'); diff --git a/imp/lib/Message.php b/imp/lib/Message.php index 685089a04..8f21414c6 100644 --- a/imp/lib/Message.php +++ b/imp/lib/Message.php @@ -663,15 +663,15 @@ class IMP_Message * DEFAULT: false * * - * @return array If 'list' option is true, an array of mailbox names as - * keys and UIDs as values that were expunged. + * @return IMP_Indices If 'list' option is true, an indices object + * containing the messages that have been expunged. */ public function expungeMailbox($mbox_list, $options = array()) { $msg_list = !empty($options['list']); if (empty($mbox_list)) { - return $msg_list ? array() : null; + return $msg_list ? new IMP_Indices() : null; } $imp_imap = $GLOBALS['injector']->getInstance('IMP_Imap')->getOb(); @@ -711,7 +711,9 @@ class IMP_Message } catch (Horde_Imap_Client_Exception $e) {} } - return $msg_list ? $update_list : null; + if ($msg_list) { + return new IMP_Indices($update_list); + } } /**