-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuninstall.php
34 lines (29 loc) · 931 Bytes
/
uninstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* @package koko-analytics
* @license GPL-3.0+
* @author Danny van Kooten
*
* Perform the necessary steps to completely uninstall Koko Analytics
*/
// if uninstall.php is not called by WordPress, die
if (!defined('WP_UNINSTALL_PLUGIN')) die;
// delete wp-options
delete_option("koko_analytics_settings");
delete_option("koko_analytics_version");
delete_option("koko_analytics_use_custom_endpoint");
delete_option("koko_analytics_realtime_pageview_count");
// drop koko tables
global $wpdb;
$wpdb->query(
"DROP TABLE IF EXISTS
{$wpdb->prefix}koko_analytics_site_stats,
{$wpdb->prefix}koko_analytics_post_stats,
{$wpdb->prefix}koko_analytics_referrer_stats,
{$wpdb->prefix}koko_analytics_dates,
{$wpdb->prefix}koko_analytics_referrer_urls"
);
// delete custom endpoint file
if (file_exists(ABSPATH . '/koko-analytics-collect.php')) {
unlink(ABSPATH . '/koko-analytics-collect.php');
}