-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuninstall.php
75 lines (64 loc) · 2.1 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
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
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* syncData
*
* @author Ralf Hertsch ([email protected])
* @link http://phpmanufaktur.de
* @copyright 2011
* @license GNU GPL (http://www.gnu.org/licenses/gpl.html)
* @version $Id$
*
* FOR VERSION- AND RELEASE NOTES PLEASE LOOK AT INFO.TXT!
*/
// include LEPTON class.secure.php to protect this file and the whole CMS!
$class_secure = '../../framework/class.secure.php';
if (file_exists($class_secure)) {
include($class_secure);
}
else {
trigger_error(sprintf("[ <b>%s</b> ] Can't include LEPTON class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
}
// include language file for syncData
if(!file_exists(WB_PATH .'/modules/'.basename(dirname(__FILE__)).'/languages/' .LANGUAGE .'.php')) {
require_once(WB_PATH .'/modules/'.basename(dirname(__FILE__)).'/languages/DE.php'); // Vorgabe: DE verwenden
}
else {
require_once(WB_PATH .'/modules/'.basename(dirname(__FILE__)).'/languages/' .LANGUAGE .'.php');
}
if (!class_exists('checkDroplets')) {
// try to load required class.droplets.php
if (file_exists(WB_PATH.'/modules/kit_tools/class.droplets.php')) {
require_once WB_PATH.'/modules/kit_tools/class.droplets.php';
}
else {
// load embedded class.droplets.php
require_once WB_PATH.'/modules/'.basename(dirname(__FILE__)).'//class.droplets.php';
}
}
require_once(WB_PATH .'/modules/'.basename(dirname(__FILE__)).'/class.syncdata.php');
global $admin;
$tables = array('dbSyncDataArchives','dbSyncDataCfg','dbSyncDataFiles','dbSyncDataJobs','dbSyncDataProtocol');
$error = '';
foreach ($tables as $table) {
$delete = null;
$delete = new $table();
if ($delete->sqlTableExists()) {
if (!$delete->sqlDeleteTable()) {
$error .= sprintf('<p>[UNINSTALL] %s</p>', $delete->getError());
}
}
}
// remove Droplets
$dbDroplets = new dbDroplets();
$droplets = array('sync_client');
foreach ($droplets as $droplet) {
$where = array(dbDroplets::field_name => $droplet);
if (!$dbDroplets->sqlDeleteRecord($where)) {
$message = sprintf('[UPGRADE] Error uninstalling Droplet: %s', $dbDroplets->getError());
}
}
// Prompt Errors
if (!empty($error)) {
$admin->print_error($error);
}
?>