Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a check in Mailbox preRemove hook call. If the hook is returnin… #203

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions application/controllers/MailboxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,28 +426,29 @@ public function purgeAction()
if( isset( $_POST['purge'] ) && ( $_POST['purge'] == 'purge' ) )
{

$this->notify( 'mailbox', 'purge', 'preRemove', $this );
if($this->notify( 'mailbox', 'purge', 'preRemove', $this ) !== false) {

$this->getD2EM()->getRepository( "\\Entities\\Mailbox" )->purgeMailbox( $this->getMailbox(), $this->getAdmin(), !$this->getParam( 'delete_files', false ) );
$this->log(
\Entities\Log::ACTION_MAILBOX_PURGE,
"{$this->getAdmin()->getFormattedName()} purged mailbox {$this->getMailbox()->getUsername()}"
);
$this->getD2EM()->getRepository( "\\Entities\\Mailbox" )->purgeMailbox( $this->getMailbox(), $this->getAdmin(), !$this->getParam( 'delete_files', false ) );
$this->log(
\Entities\Log::ACTION_MAILBOX_PURGE,
"{$this->getAdmin()->getFormattedName()} purged mailbox {$this->getMailbox()->getUsername()}"
);

$this->notify( 'mailbox', 'purge', 'preFlush', $this );
$this->notify( 'mailbox', 'purge', 'preFlush', $this );

if( $this->getParam( 'delete_files', false ) )
{
$this->getMailbox()->setDeletePending( true );
$this->getMailbox()->setActive( false );
}
else
$this->getD2EM()->remove( $this->getMailbox() );
if( $this->getParam( 'delete_files', false ) )
{
$this->getMailbox()->setDeletePending( true );
$this->getMailbox()->setActive( false );
}
else
$this->getD2EM()->remove( $this->getMailbox() );

$this->getD2EM()->flush();
$this->notify( 'mailbox', 'purge', 'postFlush', $this );
$this->getD2EM()->flush();
$this->notify( 'mailbox', 'purge', 'postFlush', $this );

$this->addMessage( _( 'You have successfully purged the mailbox.' ), OSS_Message::SUCCESS );
$this->addMessage( _( 'You have successfully purged the mailbox.' ), OSS_Message::SUCCESS );
}
$this->_redirect( 'mailbox/list' );

}
Expand Down