/** * deactive one or more module * @param $module one or more module names */ function hw_deactivate_modules($module) { static $actived_modules; $modules = array(); if (!$actived_modules) { $actived_modules = hw_get_modules(true); } $count = count($actived_modules); if (isset($module[0]) && !is_array($module[0])) { $modules[] = $module; } elseif (is_string($module)) { $modules[] = array($module); } else { $modules = $module; } foreach ((array) $modules as $_module) { if (isset($_module[0]) && is_string($_module[0]) && isset($actived_modules[$_module[0]])) { unset($actived_modules[$_module[0]]); //deactivation hook for module $hooks = HW_HOANGWEB::register_deactivation_hook(realpath(HW_HOANGWEB_PLUGINS . '/' . $_module[0])); if (is_array($hooks)) { foreach ($hooks as $hook) { if (is_callable($hook)) { call_user_func($hook); usleep(200); //sleep in miliseconds } } } } } //save option to db if ($count != count($actived_modules)) { update_option('hw_install_modules', $actived_modules); HW_Cache::reset_wp_menus_caches(); } #__save_session('a',$actived_modules); }
/** * reset caches configuration */ protected static function reset_caches() { HW_Cache::reset_wp_menus_caches(); //.. }