-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathuninstall.php
More file actions
64 lines (56 loc) · 1.5 KB
/
uninstall.php
File metadata and controls
64 lines (56 loc) · 1.5 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* Webmention Uninstall
*
* Fired when the plugin is uninstalled to clean up plugin options and cached files.
*
* @package Webmention
*/
// If uninstall not called from WordPress, exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
/**
* Delete all plugin options.
*/
$options = array(
// Settings registered in class-admin.php.
'webmention_disable_selfpings_same_url',
'webmention_disable_selfpings_same_domain',
'webmention_disable_media_mentions',
'webmention_support_post_types',
'webmention_show_comment_form',
'webmention_comment_form_text',
'webmention_home_mentions',
'webmention_approve_domains',
'webmention_avatars',
'webmention_avatar_store_enable',
'webmention_separate_comment',
'webmention_show_facepile',
'webmention_facepile_fold_limit',
// Legacy option for media mentions.
'webmention_send_media_mentions',
// Database version tracking.
'webmention_db_version',
// Migration lock.
'webmention_migration_lock',
);
foreach ( $options as $option ) {
delete_option( $option );
}
/**
* Delete cached avatar files using WP_Filesystem.
*/
global $wp_filesystem;
if ( ! function_exists( 'WP_Filesystem' ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
WP_Filesystem();
if ( $wp_filesystem ) {
$upload_dir = wp_get_upload_dir();
$webmention_dir = $upload_dir['basedir'] . '/webmention';
// Delete the entire webmention directory recursively.
if ( $wp_filesystem->is_dir( $webmention_dir ) ) {
$wp_filesystem->delete( $webmention_dir, true );
}
}