[ Index ]

MailPress 7.1

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/ -> uninstall.php (source)

   1  <?php
   2  
   3  if ( !defined( 'ABSPATH' ) && !defined( 'WP_UNINSTALL_PLUGIN' ) ) die();
   4  
   5  class MP_uninstall
   6  {
   7  	function __construct()
   8      {
   9          global $wpdb;
  10  
  11          $wpdb->mp_mails        = $wpdb->prefix . 'mailpress_mails';
  12          $wpdb->mp_mailmeta    = $wpdb->prefix . 'mailpress_mailmeta';
  13          $wpdb->mp_users        = $wpdb->prefix . 'mailpress_users';
  14          $wpdb->mp_usermeta    = $wpdb->prefix . 'mailpress_usermeta';
  15          $wpdb->mp_stats        = $wpdb->prefix . 'mailpress_stats';
  16          $wpdb->mp_tracks    = $wpdb->prefix . 'mailpress_tracks';
  17          $wpdb->mp_forms        = $wpdb->prefix . 'mailpress_forms';
  18          $wpdb->mp_fields    = $wpdb->prefix . 'mailpress_formfields';
  19  
  20  // taxonomies
  21          $taxonomies = array( 'MailPress_mailing_list', 'MailPress_autoresponder' );
  22          foreach( $taxonomies as $taxonomy )
  23          {
  24              $queries[] = "DELETE FROM $wpdb->terms              WHERE term_id IN ( SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = '$taxonomy' );";
  25              $queries[] = "DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id IN ( SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = '$taxonomy' );";
  26              $queries[] = "DELETE FROM $wpdb->term_taxonomy WHERE taxonomy = '$taxonomy';";
  27          }
  28  // postmeta
  29          $queries[] = "DELETE FROM $wpdb->postmeta WHERE meta_key like '%_MailPress%';";        
  30          $queries[] = "DELETE FROM $wpdb->postmeta WHERE meta_key like '%_mailpress%';";
  31  // usermeta
  32          $queries[] = "DELETE FROM $wpdb->usermeta WHERE meta_key like '%_MailPress%';";        
  33          $queries[] = "DELETE FROM $wpdb->usermeta WHERE meta_key like '%_mailpress%';";
  34  // options
  35          $queries[] = "DELETE FROM $wpdb->options WHERE option_name like '%MailPress%';";        
  36          $queries[] = "DELETE FROM $wpdb->options WHERE option_name like '%mailpress%';";
  37  // mailpress tables
  38          $drop_tables = array ( 
  39                              $wpdb->mp_stats, 
  40                              $wpdb->mp_mails, 
  41                              $wpdb->mp_mailmeta, 
  42                              $wpdb->mp_users, 
  43                              $wpdb->mp_usermeta, 
  44                              $wpdb->mp_tracks, 
  45                              $wpdb->mp_forms, 
  46                              $wpdb->mp_fields
  47                       );
  48          foreach ( ( array ) $drop_tables as $table ) $wpdb->query( "DROP TABLE IF EXISTS $table;" );
  49  
  50          foreach( $queries as $query ) $wpdb->query( $query );
  51      }
  52  }
  53  new MP_uninstall(); 


Generated: Mon Mar 11 18:33:33 2019 Cross-referenced by PHPXref 0.7.1