-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
80 lines (72 loc) · 2.54 KB
/
uninstall.php
File metadata and controls
80 lines (72 loc) · 2.54 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
* Deinstallation des Upkeep AddOns
*/
// AddOn aus der config.yml entfernen
$configFile = rex_path::coreData('config.yml');
$config = rex_file::getConfig($configFile);
if (array_key_exists('setup_addons', $config) && in_array('upkeep', $config['setup_addons'], true)) {
$config['setup_addons'] = array_filter($config['setup_addons'], static function ($addon) {
return $addon !== 'upkeep';
});
rex_file::putConfig($configFile, $config);
}
// Alle vom AddOn erstellten Tabellen löschen
$tables = [
'upkeep_domain_mapping',
'upkeep_ips_blocked_ips',
'upkeep_ips_threat_log',
'upkeep_ips_custom_patterns',
'upkeep_ips_default_patterns', // Neue Tabelle für Standard-Patterns
'upkeep_ips_rate_limit',
'upkeep_ips_positivliste',
'upkeep_ips_whitelist', // Falls noch vorhanden (alte Bezeichnung)
// Mail Security Tabellen
'upkeep_mail_rate_limit',
'upkeep_mail_badwords',
'upkeep_mail_blocklist',
'upkeep_mail_threat_log',
'upkeep_mail_default_patterns' // Standard-Mail-Patterns
];
foreach ($tables as $table) {
$fullTableName = rex::getTable($table);
$sql = rex_sql::factory();
try {
// Tabelle löschen (IF EXISTS verhindert Fehler bei bereits gelöschten Tabellen)
$sql->setQuery("DROP TABLE IF EXISTS `{$fullTableName}`");
rex_logger::factory()->info("Tabelle {$fullTableName} erfolgreich gelöscht.");
} catch (Exception $e) {
rex_logger::factory()->error("Fehler beim Löschen der Tabelle {$fullTableName}: " . $e->getMessage());
}
}
// Alle AddOn-Konfigurationen löschen
$addon = rex_addon::get('upkeep');
if ($addon->isInstalled()) {
// Alle Config-Werte löschen
$configKeys = [
'allowed_ips',
'frontend_password',
'ips_active',
'ips_rate_limiting_enabled',
'ips_captcha_trust_duration',
'ips_burst_limit',
'ips_strict_limit',
'ips_burst_window',
// Mail Security Einstellungen
'mail_security_active',
'mail_rate_limiting_enabled',
'mail_rate_limit_per_minute',
'mail_rate_limit_per_hour',
'mail_rate_limit_per_day',
'mail_security_debug',
'mail_security_detailed_logging',
// Mehrsprachigkeits-Einstellungen
'multilanguage_enabled',
'multilanguage_default',
'multilanguage_texts'
];
foreach ($configKeys as $key) {
$addon->removeConfig($key);
}
rex_logger::factory()->info("Alle Upkeep AddOn-Konfigurationen erfolgreich gelöscht.");
}