-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathuninstall.php
More file actions
39 lines (35 loc) · 830 Bytes
/
uninstall.php
File metadata and controls
39 lines (35 loc) · 830 Bytes
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
35
36
37
38
39
<?php
/**
* Inline Google Spreadsheet Viewer uninstaller
*
* @package plugin
*/
// Don't execute any uninstall code unless WordPress core requests it.
if (!defined('WP_UNINSTALL_PLUGIN')) { exit(); }
delete_option('gdoc_settings');
// Delete caches.
global $wpdb;
$wpdb->query($wpdb->prepare(
"
DELETE FROM {$wpdb->options}
WHERE option_name LIKE '%s'
",
$wpdb->esc_like('_transient_gdoc') . '%'
));
$wpdb->query($wpdb->prepare(
"
DELETE FROM {$wpdb->options}
WHERE option_name LIKE '%s'
",
$wpdb->esc_like('_transient_timeout_gdoc') . '%'
));
// Delete RBAC settings.
global $wp_roles;
$delete_caps = array(
'gdoc_query_sql_databases'
);
foreach ($delete_caps as $cap) {
foreach (array_keys($wp_roles->roles) as $role) {
$wp_roles->remove_cap($role, $cap);
}
}