public function uninstall($params)
{
if ($this->app->user_manager->is_admin() == false) {
return false;
}
if (isset($params['id'])) {
$id = intval($params['id']);
$this_module = $this->get('ui=any&one=1&id=' . $id);
if ($this_module != false and is_array($this_module) and isset($this_module['id'])) {
$module_name = $this_module['module'];
if ($this->app->user_manager->is_admin() == false) {
return false;
}
if (trim($module_name) == '') {
return false;
}
$loc_of_config = $this->locate($module_name, 'config');
$res = array();
$loc_of_functions = $this->locate($module_name, 'functions');
$cfg = false;
if (is_file($loc_of_config)) {
include $loc_of_config;
if (isset($config)) {
$cfg = $config;
}
if (is_array($cfg) and !empty($cfg)) {
if (isset($cfg['on_uninstall'])) {
$func = $cfg['on_uninstall'];
if (!function_exists($func)) {
if (is_file($loc_of_functions)) {
include_once $loc_of_functions;
}
}
if (function_exists($func)) {
$res = $func();
// return $res;
}
}
}
}
$to_save = array();
$to_save['id'] = $id;
$to_save['installed'] = '0';
$this->save($to_save);
}
}
$this->app->cache_manager->delete('modules' . DIRECTORY_SEPARATOR . '');
}