예제 #1
0
 public function log_email($mailOriginal)
 {
     // make copy to avoid any changes on the original mail
     $mail = $mailOriginal;
     $fields = $this->extractFields($mail);
     Mail::create($fields)->save();
     return $mailOriginal;
 }
예제 #2
0
 /**
  * Processes bulk actions.
  * @since 1.0
  */
 function process_bulk_action()
 {
     if (false === $this->current_action()) {
         return;
     }
     if (check_admin_referer(Email_Logging_ListTable::NONCE_LIST_TABLE, Email_Logging_ListTable::NONCE_LIST_TABLE . '_nonce')) {
         $name = $this->_args['singular'];
         // Detect when a bulk action is being triggered.
         if ('delete' === $this->current_action()) {
             foreach ($_REQUEST[$name] as $item_id) {
                 $mail = Mail::find_one($item_id);
                 if (false !== $mail) {
                     $mail->delete();
                 }
             }
         }
     }
 }
 /**
  * Test limitNumberOfMailsByAmount - Check if old messages where deleted first.
  * The LogRotation supports the limitation of stored mails by amount.
  * This test checks if old messages are deleted first by asserting that after the policy is run the oldest mail is gone.
  * @since 1.6.0
  * @see WPML_LogRotation::limitNumberOfMailsByAmount
  */
 function test_limitNumberOfMailsByAmount_order()
 {
     global $wpml_settings;
     $amount = 10;
     $keep = 3;
     $this->prepareMessages($amount);
     $wpml_settings['log-rotation-limit-amout'] = '1';
     $wpml_settings['log-rotation-limit-amout-keep'] = $keep;
     $oldest_mail_id = $this->oldest_mail()->get_mail_id();
     WPML_LogRotation::limitNumberOfMailsByAmount();
     // Assert oldest mail is gone.
     $this->assertFalse(Mail::find_one($oldest_mail_id));
 }