Batch handling of moving messages should speed up production thing
This commit is contained in:
parent
daa4abf828
commit
08cba65fd6
32
vendors/shells/vault.php
vendored
32
vendors/shells/vault.php
vendored
|
|
@ -57,6 +57,8 @@ class VaultShell extends Shell {
|
|||
$enquiryList[$enqNumber] = $id;
|
||||
}
|
||||
|
||||
$storedArray = array();
|
||||
$discardArray = array();
|
||||
|
||||
|
||||
|
||||
|
|
@ -154,9 +156,9 @@ class VaultShell extends Shell {
|
|||
}
|
||||
echo "Email stored in the DB under enquiry ID".$enqID." Will be moved to the stored folder\n";
|
||||
|
||||
if($testing == 0) {
|
||||
imap_mail_move($mbox, $i, 'INBOX/Stored');
|
||||
}
|
||||
$storedArray[] = $i;
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
echo 'Unable to save the Email\n';
|
||||
|
|
@ -169,15 +171,33 @@ class VaultShell extends Shell {
|
|||
* I may change this to simply delete the emails. This will do for now, but it's doubling up on the storage for useless files.
|
||||
* */
|
||||
|
||||
if($testing == 0 ) {
|
||||
imap_mail_move($mbox, $i, 'INBOX/Discarded');
|
||||
}
|
||||
$discardArray[] = $i;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Finished working with the IMAP server. Make the changes and close the connection */
|
||||
|
||||
if($testing == 0) {
|
||||
|
||||
reset($discardArray);
|
||||
reset($storedArray);
|
||||
|
||||
$storeSet = implode(",", $storedArray);
|
||||
$discardSet = implode(",",$discardArray);
|
||||
|
||||
echo "Tidying up now. Moving messages to Stored or Discarded\n";
|
||||
|
||||
imap_mail_move($mbox, $storeSet, 'INBOX/Stored');
|
||||
imap_mail_move($mbox, $discardSet, 'INBOX/Discarded');
|
||||
}
|
||||
|
||||
imap_expunge($mbox);
|
||||
imap_close($mbox);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue