PUM_Install::deactivate_site()
Run when Popup Maker is deactivated. Completely deletes all data if complete_uninstall is set to true.
Description Description
Source Source
File: classes/Install.php
public static function deactivate_site() { /** * Process complete uninstall */ if ( self::get_option( 'complete_uninstall' ) ) { global $wpdb; // Delete all popups and associated meta. $wpdb->query( "DELETE a,b,c FROM $wpdb->posts a LEFT JOIN $wpdb->term_relationships b ON (a.ID = b.object_id) LEFT JOIN $wpdb->postmeta c ON (a.ID = c.post_id) WHERE a.post_type IN ('popup', 'popup_theme')" ); $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key LIKE 'popup_%'" ); /** Delete All the Taxonomies */ foreach ( array( 'popup_category', 'popup_tag' ) as $taxonomy ) { // Prepare & excecute SQL, Delete Terms. $wpdb->get_results( $wpdb->prepare( "DELETE t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s')", $taxonomy ) ); // Delete Taxonomy. $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); } $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'popmake%' OR option_name LIKE '_pum_%' OR option_name LIKE 'pum_%' OR option_name LIKE 'popup_analytics_%'" ); // Delete all Popup Maker related user meta. $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key LIKE '_pum_%' OR meta_key lIKE 'pum_%'" ); // Delete subscribers table. $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}pum_subscribers" ); // Delete error log. PUM_Utils_Logging::instance()->clear_log(); // Reset JS/CSS assets for regeneration. pum_reset_assets(); // # TODO Delete AssetCache files and folder. do_action( 'pum_uninstall' ); } }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
1.4 | Introduced. |