// ----------------- FUNCTIONS if ($pluginname != '') { $install = rex_get('install', 'int', -1); $activate = rex_get('activate', 'int', -1); $uninstall = rex_get('uninstall', 'int', -1); // ----------------- plugin INSTALL if ($install == 1) { if (($warning = rex_install_plugin($plugins, $pluginname)) === true) { $info = $I18N_COM->msg("plugin_installed", $pluginname); } } elseif ($activate == 1) { if (($warning = rex_activate_plugin($plugins, $pluginname)) === true) { $info = $I18N_COM->msg("plugin_activated", $pluginname); } } elseif ($activate == 0) { if (($warning = rex_deactivate_plugin($plugins, $pluginname)) === true) { $info = $I18N_COM->msg("plugin_deactivated", $pluginname); } } elseif ($uninstall == 1) { if (($warning = rex_uninstall_plugin($plugins, $pluginname)) === true) { $info = $I18N_COM->msg("plugin_uninstalled", $pluginname); } } } // ----------------- OUT // Vergleiche plugins aus dem Verzeichnis plugins/ mit den Eintraegen in include/plugins.inc.php // Wenn ein plugin in der Datei fehlt oder nicht mehr vorhanden ist, aendere den Dateiinhalt. if (count(array_diff($plugins, OOPlugin::getRegisteredPlugins())) > 0 || count(array_diff(OOPlugin::getRegisteredPlugins(), $plugins)) > 0) { if (($state = rex_generateplugins($plugins)) !== true) { $warning = $state; }
function rex_uninstall_plugin($plugins, $pluginname) { global $REX, $I18N_COM; $state = true; $install_dir = rex_plugins_dir() . '/' . $pluginname; $uninstall_file = $install_dir . '/uninstall.inc.php'; $uninstall_sql = $install_dir . '/uninstall.sql'; if (is_readable($uninstall_file)) { require $uninstall_file; // Wurde das "uninstall" Flag gesetzt, oder eine Fehlermeldung ausgegeben? Wenn ja, Abbruch $instmsg = OOPlugin::getProperty($pluginname, 'installmsg', ''); if (OOPlugin::isInstalled($pluginname) || $instmsg) { $state = $I18N_COM->msg('plugin_no_uninstall', $pluginname) . '<br/>'; if (empty($instmsg)) { $state .= $I18N_COM->msg('plugin_no_reason'); } else { $state .= $instmsg; } } else { $state = rex_deactivate_plugin($plugins, $pluginname); if ($state === true && is_readable($uninstall_sql)) { $state = rex_install_dump($uninstall_sql); if ($state !== true) { $state = 'Error found in uninstall.sql:<br />' . $state; } } if ($state === true) { // regenerate Addons file $state = rex_generatePlugins($plugins); } } } else { $state = $I18N_COM->msg("plugin_uninstall_not_found"); } // Fehler beim uninstall -> Addon bleibt installiert if ($state !== true) { OOPlugin::setProperty($pluginname, 'install', 1); } return $state; }