-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
30 lines (24 loc) · 1.08 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
<?php
// Diese Datei ist keine Pflichtdatei mehr.
// AddOn-Objekt bereitstellen und Data-Verzeichnis löschen (redaxo/data/addons/demo_addon/)
// Im AddOn-Kontext wäre auch $this->getDataPath() möglich
$addon = rex_addon::get('ff_copy_addon');
//rex_dir::delete($addon->getDataPath());
// SQL-Anweisungen können auch weiterhin über die `uninstall.sql` ausgeführt werden.
// Empfohlen wird aber die SQL-Anweisungen in der `uninstall.php` auszuführen
// Siehe auch https://redaxo.org/doku/master/datenbank-tabellen
// Die Tabelle des Demo-AddOns wird hier gelöscht
if (rex_plugin::get('yform', 'rest')->isAvailable()) {
$tables = ['fc_article', 'fc_article_slice', 'fc_media'];
foreach ($tables as $table_name) {
try {
rex_sql_table::get(rex::getTable($table_name))->drop();
rex_yform_manager_table_api::removeTable(rex::getTable($table_name));
} catch (Exception $e) {
rex_logger::logException($e);
}
}
} else {
$addon->setProperty('installmsg', 'Something is wrong');
$addon->setProperty('install', false);
}