Ejemplo n.º 1
0
function uninstall_rm_plugin()
{
    $name = rmc_server_var($_GET, 'plugin', '');
    if ($name == '') {
        redirectMsg('plugins.php', __('You must specify a existing plugin', 'rmcommon'), 1);
        die;
    }
    $plugin = new RMPlugin($name);
    if ($plugin->isNew()) {
        redirectMsg('plugins.php', __('Specified plugin is not installed yet!', 'rmcommon'), 1);
        die;
    }
    if (!$plugin->delete()) {
        redirectMsg('plugins.php', __('Plugin could not be uninstalled, please try again.', 'rmcommon'), 1);
        die;
    }
    if (!$plugin->on_uninstall()) {
        redirectMsg('plugins.php', __('The plugin has been deleted from database, but erros ocurred on this process.', 'rmcommon') . '<br />' . $plugin->errors(), 1);
        die;
    }
    rm_reload_plugins();
    redirectMsg('plugins.php', __('Plugin uninstalled succesfully!', 'rmcommon'), 0);
}