/**
  * Executes log rotation periodically.
  * @since 1.4
  */
 static function LogRotationSchedule()
 {
     global $wpml_settings, $wpdb;
     $tableName = WPML_Plugin::getTablename('mails');
     if ($wpml_settings['log-rotation-limit-amout'] == '1') {
         $keep = $wpml_settings['log-rotation-limit-amout-keep'];
         if ($keep > 0) {
             $wpdb->query("DELETE p\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t{$tableName} AS p\n\t\t\t\t\t\tJOIN\n\t\t\t\t\t\t( SELECT mail_id\n\t\t\t\t\t\tFROM {$tableName}\n\t\t\t\t\t\tORDER BY mail_id DESC\n\t\t\t\t\t\tLIMIT 1 OFFSET {$keep}\n\t\t\t\t) AS lim\n\t\t\t\t\t\tON p.mail_id <= lim.mail_id;");
         }
     }
     if ($wpml_settings['log-rotation-delete-time'] == '1') {
         $days = $wpml_settings['log-rotation-delete-time-days'];
         if ($days > 0) {
             $wpdb->query("DELETE FROM {$tableName} WHERE DATEDIFF(now(), timestamp) >= {$days}");
         }
     }
 }
Beispiel #2
0
 /**
  * Processes bulk actions.
  * @since 1.0
  */
 function process_bulk_action()
 {
     global $wpdb;
     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'];
         $tableName = WPML_Plugin::getTablename('mails');
         //Detect when a bulk action is being triggered...
         if ('delete' == $this->current_action()) {
             foreach ($_REQUEST[$name] as $item_id) {
                 $wpdb->query($wpdb->prepare("DELETE FROM `{$tableName}` WHERE `mail_id` = %d", esc_sql($item_id)), ARRAY_A);
             }
         }
     }
 }
Beispiel #3
0
 public function log_email($mailOriginal)
 {
     // make copy to avoid any changes on the original mail
     $mail = $mailOriginal;
     global $wpdb;
     $fields = $this->extractFields($mail);
     $tableName = WPML_Plugin::getTablename('mails');
     $wpdb->insert($tableName, $fields);
     return $mailOriginal;
 }
 function process_bulk_action()
 {
     global $wpdb;
     $name = $this->_args['singular'];
     $tableName = WPML_Plugin::getTablename('mails');
     //Detect when a bulk action is being triggered...
     if ('delete' == $this->current_action()) {
         foreach ($_REQUEST[$name] as $item_id) {
             $wpdb->query($wpdb->prepare("DELETE FROM `{$tableName}` WHERE `mail_id` = %d", $item_id));
         }
     }
 }