PluginProbe
Gianism / trunk
Gianism vtrunk
4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.4.0 5.0.0 5.0.1 5.0.2 5.1.0 5.2.1 5.2.2 5.3.0 6.0.0 6.0.1 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 All 65 releases
gianism / uninstall.php

uninstall.php in Gianism trunk, at uninstall.php

55 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Delete all data for Literally WordPress
4 *
5 * @package gianism
6 * @since 1.0
7 */
8
9 //Check whether WordPress is initialized or not.
10 if ( ! defined( 'ABSPATH' ) && ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
11 exit();
12 }
13
14 // Delete Option
15 delete_option( 'wp_gianism_option' );
16 delete_option( 'wpg_analytics_token' );
17 delete_option( 'wpg_analytics_profile' );
18 delete_option( 'gianism_facebook_admin_token' );
19 delete_option( 'gianism_facebook_admin_refreshed' );
20 delete_option( 'gianism_facebook_admin_id' );
21 delete_option( 'gianism_notice_log' );
22
23
24 // Delete All message if exists.
25 // Backward compatibility.
26 $query = new WP_Query( 'post_type=gianism_message&posts_per_page=-1' );
27 if ( $query->have_posts() ) {
28 while ( $query->have_posts() ) {
29 $query->the_post();
30 wp_delete_post( get_the_ID() );
31 }
32 wp_reset_postdata();
33 }
34
35 // Delete all user meta
36 global $wpdb;
37 $query = <<<EOS
38 DELETE FROM {$wpdb->usermeta}
39 WHERE meta_key LIKE '_wpg_%'
40 EOS;
41 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
42 $wpdb->query( $query );
43
44 // Delete messages
45 $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key = '_gianism_message'" );
46
47 // Drop table
48 $wpdb->query( "DROP TABLE {$wpdb->prefix}wpg_ga_ranking" );
49
50
51 // Delete bot cron
52 if ( wp_next_scheduled( 'gianism_bot' ) ) {
53 wp_clear_scheduled_hook( 'gianism_bot' );
54 }
55