deactivate($pluginname);
if (!$res) {
exit_error(db_error(), 'admin');
} else {
$feedback = sprintf(_('Plugin %1$s updated Successfully'), $pluginname);
// Load the plugin and now get information from it.
$plugin = $pm->GetPluginObject($pluginname);
if (!$plugin || $plugin->isError()) {
exit_error(_("Couldn't get plugin object"), 'admin');
}
$installdir = $plugin->getInstallDir();
// Remove the symbolic link made if plugin has a www.
if (is_dir(forge_get_config('plugins_path') . '/' . $pluginname . '/www')) { // if the plugin has a www dir delete the link to it
if (file_exists('../'.$installdir)) {
$result = unlink('../'.$installdir);
if (!$result) {
$feedback .= _('
Soft link wasn\'t removed in www/plugins folder, please do so manually.');
}
} else {
$result = 0;
}
}
// Remove the symbolic link made if plugin has a config.
if (file_exists(forge_get_config('config_path'). '/plugins/'.$pluginname)) {
$result = unlink(forge_get_config('config_path'). '/plugins/'.$pluginname); // the apache group or user should have write perms in forge_get_config('config_path')/plugins folder...
if (!$result) {
$feedback .= _('Success, config not deleted');
}
}
}
} else {
$res = $pm->activate($pluginname);
if (!$res) {
exit_error(db_error(), 'admin');
} else {
$feedback = sprintf(_('Plugin %1$s updated Successfully'), $pluginname);
// Load the plugin and now get information from it.
$pm = plugin_manager_get_object();
$pm->LoadPlugin($pluginname);
$plugin = $pm->GetPluginObject($pluginname);
if (!$plugin || $plugin->isError()) {
exit_error(_("Couldn't get plugin object"), 'admin');
} else {
if (method_exists($plugin, 'install')) {
$plugin->install();
}
}
}
}
}
site_admin_header(array('title'=>_('Plugin Manager')));
?>