-
Notifications
You must be signed in to change notification settings - Fork 4
/
uninstall.php
executable file
·38 lines (37 loc) · 1.38 KB
/
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
35
36
37
38
<?php
/*
* Clean-up when Rencontre is uninstalled from a site.
*/
if(!defined('WP_UNINSTALL_PLUGIN')) die;
//
$rencOpt = get_option('rencontre_options');
if(!empty($rencOpt['uni'])) {
//
delete_option('rencontre_options');
delete_site_option('rencontre_options'); // multisite
//
global $wpdb;
$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'rencontre_dbip');
$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'rencontre_profil');
$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'rencontre_users');
$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'rencontre_users_profil');
$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'rencontre_liste');
$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'rencontre_msg');
$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'rencontre_prison');
//
$upload_dir = wp_upload_dir();
if(is_dir($upload_dir['basedir'].'/portrait')) rencontre_rmdirR($upload_dir['basedir'].'/portrait');
if(is_dir($upload_dir['basedir'].'/session')) rencontre_rmdirR($upload_dir['basedir'].'/session');
if(is_dir($upload_dir['basedir'].'/tchat')) rencontre_rmdirR($upload_dir['basedir'].'/tchat');
}
//
// *********************************
//
function rencontre_rmdirR($dir) {
$files = array_diff(scandir($dir), array('.','..'));
foreach($files as $file) {
(is_dir("$dir/$file")) ? rencontre_rmdirR("$dir/$file") : unlink("$dir/$file");
}
return rmdir($dir);
}
?>