/** * This method will look for a file modules_post_install.php in the root directory and based on the * contents of this file, it will silently install any modules as specified in this array. */ function post_install_modules() { if (is_file('modules_post_install.php')) { global $current_user, $mod_strings; $current_user = new User(); $current_user->is_admin = '1'; require_once 'ModuleInstall/PackageManager/PackageManager.php'; require_once 'modules_post_install.php'; //we now have the $modules_to_install array in memory $pm = new PackageManager(); $old_mod_strings = $mod_strings; foreach ($modules_to_install as $module_to_install) { if (is_file($module_to_install)) { $pm->performSetup($module_to_install, 'module', false); $file_to_install = sugar_cached('upload/upgrades/module/') . basename($module_to_install); $_REQUEST['install_file'] = $file_to_install; $pm->performInstall($file_to_install); } } $mod_strings = $old_mod_strings; } }
function action_DeployPackage() { global $current_user; if (defined('TEMPLATE_URL')) { sugar_cache_reset(); SugarTemplateUtilities::disableCache(); } //increment etag for menu so the new module shows up when the AJAX UI reloads $current_user->incrementETag("mainMenuETag"); $mb = new ModuleBuilder(); $load = $_REQUEST['package']; $message = $GLOBALS['mod_strings']['LBL_MODULE_DEPLOYED']; if (!empty($load)) { $zip = $mb->getPackage($load); require_once 'ModuleInstall/PackageManager/PackageManager.php'; $pm = new PackageManager(); $info = $mb->packages[$load]->build(false); $uploadDir = $pm->upload_dir . '/upgrades/module/'; mkdir_recursive($uploadDir); rename($info['zip'], $uploadDir . $info['name'] . '.zip'); copy($info['manifest'], $uploadDir . $info['name'] . '-manifest.php'); $_REQUEST['install_file'] = $uploadDir . $info['name'] . '.zip'; $GLOBALS['mi_remove_tables'] = false; $pm->performUninstall($load); //#23177 , js cache clear clearAllJsAndJsLangFilesWithoutOutput(); //#30747, clear the cache in memory $cache_key = 'app_list_strings.' . $GLOBALS['current_language']; sugar_cache_clear($cache_key); sugar_cache_reset(); //clear end $pm->performInstall($_REQUEST['install_file'], true); //clear the unified_search_module.php file require_once 'modules/Home/UnifiedSearchAdvanced.php'; UnifiedSearchAdvanced::unlinkUnifiedSearchModulesFile(); //bug 44269 - start //clear workflow admin modules cache if (isset($_SESSION['get_workflow_admin_modules_for_user'])) { unset($_SESSION['get_workflow_admin_modules_for_user']); } //clear "is_admin_for_module" cache $sessionVar = 'MLA_' . $current_user->user_name; foreach ($mb->packages as $package) { foreach ($package->modules as $module) { $_SESSION[$sessionVar][$package->name . '_' . $module->name] = true; } } //recreate acl cache $actions = ACLAction::getUserActions($current_user->id, true); //bug 44269 - end } echo 'complete'; }
function action_DeployPackage() { if (defined('TEMPLATE_URL')) { sugar_cache_reset(); SugarTemplateUtilities::disableCache(); } $mb = new ModuleBuilder(); $load = $_REQUEST['package']; $message = $GLOBALS['mod_strings']['LBL_MODULE_DEPLOYED']; if (!empty($load)) { $zip = $mb->getPackage($load); require_once 'ModuleInstall/PackageManager/PackageManager.php'; $pm = new PackageManager(); $info = $mb->packages[$load]->build(false); mkdir_recursive($GLOBALS['sugar_config']['cache_dir'] . '/upload/upgrades/module/'); rename($info['zip'], $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '.zip'); copy($info['manifest'], $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '-manifest.php'); $_REQUEST['install_file'] = $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '.zip'; $GLOBALS['mi_remove_tables'] = false; $pm->performUninstall($load); //#23177 , js cache clear clearAllJsAndJsLangFilesWithoutOutput(); //#30747, clear the cache in memoy $cache_key = 'app_list_strings.' . $GLOBALS['current_language']; sugar_cache_clear($cache_key); sugar_cache_reset(); //clear end $pm->performInstall($_REQUEST['install_file']); } echo 'complete'; }
function action_DeployPackage() { $mb = new ModuleBuilder(); $load = $_REQUEST['package']; $message = $GLOBALS['mod_strings']['LBL_MODULE_DEPLOYED']; if (!empty($load)) { $zip = $mb->getPackage($load); require_once 'ModuleInstall/PackageManager/PackageManager.php'; $pm = new PackageManager(); $info = $mb->packages[$load]->build(false); mkdir_recursive($GLOBALS['sugar_config']['cache_dir'] . '/upload/upgrades/module/'); rename($info['zip'], $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '.zip'); copy($info['manifest'], $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '-manifest.php'); $_REQUEST['install_file'] = $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '.zip'; $GLOBALS['mi_remove_tables'] = false; $pm->performUninstall($load); $pm->performInstall($_REQUEST['install_file']); } echo 'complete'; }