public function run() { global $modules_exempt_from_availability_check; $modules_exempt_from_availability_check = array(); require_once 'modules/Administration/upgrade_custom_relationships.php'; upgrade_custom_relationships(); }
logThis('Add global search for custom modules finished .', $path); } */ //Upgrade system displayed tabs and subpanels if (function_exists('upgradeDisplayedTabsAndSubpanels')) { upgradeDisplayedTabsAndSubpanels($_SESSION['current_db_version']); } //Unlink files that have been removed if (function_exists('unlinkUpgradeFiles')) { unlinkUpgradeFiles($_SESSION['current_db_version']); } if (function_exists('rebuildSprites') && function_exists('imagecreatetruecolor')) { rebuildSprites(true); } require_once 'modules/Administration/upgrade_custom_relationships.php'; upgrade_custom_relationships(); require_once 'modules/UpgradeWizard/uw_utils.php'; /* if($_SESSION['current_db_version'] < '620') { upgradeDateTimeFields($path); upgradeDocumentTypeFields($path); } */ //Update the license logThis('Start Updating the license ', $path); ob_start(); check_now(get_sugarbeat()); ob_end_clean(); logThis('End Updating the license ', $path); set_upgrade_progress('end', 'done');
function install($base_dir, $is_upgrade = false, $previous_version = '') { if (defined('TEMPLATE_URL')) { SugarTemplateUtilities::disableCache(); } if (defined('MODULE_INSTALLER_PACKAGE_SCAN') && MODULE_INSTALLER_PACKAGE_SCAN || !empty($GLOBALS['sugar_config']['moduleInstaller']['packageScan'])) { $this->ms->scanPackage($base_dir); if ($this->ms->hasIssues()) { $this->ms->displayIssues(); sugar_cleanup(true); } } // workaround for bug 45812 - refresh vardefs cache before unpacking to avoid partial vardefs in cache global $beanList; foreach ($this->modules as $module_name) { if (!empty($beanList[$module_name])) { $objectName = BeanFactory::getObjectName($module_name); VardefManager::loadVardef($module_name, $objectName); } } global $app_strings, $mod_strings; $this->base_dir = $base_dir; $total_steps = 5; //minimum number of steps with no tasks $current_step = 0; $tasks = array('pre_execute', 'install_copy', 'install_extensions', 'install_images', 'install_dcactions', 'install_dashlets', 'install_connectors', 'install_layoutfields', 'install_relationships', 'enable_manifest_logichooks', 'post_execute', 'reset_opcodes'); $total_steps += count($tasks); if (file_exists($this->base_dir . '/manifest.php')) { if (!$this->silent) { $current_step++; display_progress_bar('install', $current_step, $total_steps); echo '<div id ="displayLoglink" ><a href="#" onclick="document.getElementById(\'displayLog\').style.display=\'\'">' . $app_strings['LBL_DISPLAY_LOG'] . '</a> </div><div id="displayLog" style="display:none">'; } include $this->base_dir . '/manifest.php'; if ($is_upgrade && !empty($previous_version)) { //check if the upgrade path exists if (!empty($upgrade_manifest)) { if (!empty($upgrade_manifest['upgrade_paths'])) { if (!empty($upgrade_manifest['upgrade_paths'][$previous_version])) { $installdefs = $upgrade_manifest['upgrade_paths'][$previous_version]; } else { $errors[] = 'No Upgrade Path Found in manifest.'; $this->abort($errors); } //fi } //fi } //fi } //fi $this->id_name = $installdefs['id']; $this->installdefs = $installdefs; if (!$this->silent) { $current_step++; update_progress_bar('install', $current_step, $total_steps); } foreach ($tasks as $task) { $this->{$task}(); if (!$this->silent) { $current_step++; update_progress_bar('install', $current_step, $total_steps); } } $this->install_beans($this->installed_modules); if (!$this->silent) { $current_step++; update_progress_bar('install', $total_steps, $total_steps); } if (isset($installdefs['custom_fields'])) { $this->log(translate('LBL_MI_IN_CUSTOMFIELD')); $this->install_custom_fields($installdefs['custom_fields']); } if (!$this->silent) { $current_step++; update_progress_bar('install', $current_step, $total_steps); echo '</div>'; } if (!$this->silent) { $current_step++; update_progress_bar('install', $current_step, $total_steps); echo '</div>'; } $selectedActions = array('clearTpls', 'clearJsFiles', 'clearDashlets', 'clearVardefs', 'clearJsLangFiles', 'rebuildAuditTables', 'repairDatabase'); VardefManager::clearVardef(); global $beanList, $beanFiles, $moduleList; if (file_exists('custom/application/Ext/Include/modules.ext.php')) { include 'custom/application/Ext/Include/modules.ext.php'; } require_once "modules/Administration/upgrade_custom_relationships.php"; upgrade_custom_relationships($this->installed_modules); $this->rebuild_all(true); require_once 'modules/Administration/QuickRepairAndRebuild.php'; $rac = new RepairAndClear(); $rac->repairAndClearAll($selectedActions, $this->installed_modules, true, false); $this->rebuild_relationships(); UpdateSystemTabs('Add', $this->tab_modules); //Clear out all the langauge cache files. clearAllJsAndJsLangFilesWithoutOutput(); $cache_key = 'app_list_strings.' . $GLOBALS['current_language']; sugar_cache_clear($cache_key); sugar_cache_reset(); //clear the unified_search_module.php file require_once 'modules/Home/UnifiedSearchAdvanced.php'; UnifiedSearchAdvanced::unlinkUnifiedSearchModulesFile(); $this->log('<br><b>' . translate('LBL_MI_COMPLETE') . '</b>'); } else { die("No \$installdefs Defined In {$this->base_dir}/manifest.php"); } }
function install($base_dir, $is_upgrade = false, $previous_version = '') { if (defined('TEMPLATE_URL')) { SugarTemplateUtilities::disableCache(); } if (!empty($GLOBALS['sugar_config']['moduleInstaller']['packageScan'])) { $this->ms->scanPackage($base_dir); if ($this->ms->hasIssues()) { $this->ms->displayIssues(); sugar_cleanup(true); } } global $app_strings, $mod_strings; $this->base_dir = $base_dir; $total_steps = 5; //minimum number of steps with no tasks $current_step = 0; $tasks = array('pre_execute', 'install_copy', 'install_images', 'install_menus', 'install_dcactions', 'install_userpage', 'install_dashlets', 'install_administration', 'install_connectors', 'install_vardefs', 'install_layoutdefs', 'install_layoutfields', 'install_relationships', 'install_languages', 'install_logichooks', 'post_execute', 'reset_opcodes'); $total_steps += count($tasks); if (file_exists($this->base_dir . '/manifest.php')) { if (!$this->silent) { $current_step++; display_progress_bar('install', $current_step, $total_steps); echo '<div id ="displayLoglink" ><a href="#" onclick="document.getElementById(\'displayLog\').style.display=\'\'">' . $app_strings['LBL_DISPLAY_LOG'] . '</a> </div><div id="displayLog" style="display:none">'; } include $this->base_dir . '/manifest.php'; if ($is_upgrade && !empty($previous_version)) { //check if the upgrade path exists if (!empty($upgrade_manifest)) { if (!empty($upgrade_manifest['upgrade_paths'])) { if (!empty($upgrade_manifest['upgrade_paths'][$previous_version])) { $installdefs = $upgrade_manifest['upgrade_paths'][$previous_version]; } else { $errors[] = 'No Upgrade Path Found in manifest.'; $this->abort($errors); } //fi } //fi } //fi } //fi $this->id_name = $installdefs['id']; $this->installdefs = $installdefs; $installed_modules = array(); $tab_modules = array(); if (isset($installdefs['beans'])) { $str = "<?php \n //WARNING: The contents of this file are auto-generated\n"; foreach ($installdefs['beans'] as $bean) { if (!empty($bean['module']) && !empty($bean['class']) && !empty($bean['path'])) { $module = $bean['module']; $class = $bean['class']; $path = $bean['path']; $str .= "\$beanList['{$module}'] = '{$class}';\n"; $str .= "\$beanFiles['{$class}'] = '{$path}';\n"; if ($bean['tab']) { $str .= "\$moduleList[] = '{$module}';\n"; $this->install_user_prefs($module, empty($bean['hide_by_default'])); $tab_modules[] = $module; } else { $str .= "\$modules_exempt_from_availability_check['{$module}'] = '{$module}';\n"; $str .= "\$modInvisList[] = '{$module}';\n"; } $installed_modules[] = $module; } else { $errors[] = 'Bean array not well defined.'; $this->abort($errors); } } $str .= "\n?>"; if (!file_exists("custom/Extension/application/Ext/Include")) { mkdir_recursive("custom/Extension/application/Ext/Include", true); } $out = sugar_fopen("custom/Extension/application/Ext/Include/{$this->id_name}.php", 'w'); fwrite($out, $str); fclose($out); $this->rebuild_modules(); } if (!$this->silent) { $current_step++; update_progress_bar('install', $current_step, $total_steps); } foreach ($tasks as $task) { $this->{$task}(); if (!$this->silent) { $current_step++; update_progress_bar('install', $current_step, $total_steps); } } $this->install_beans($installed_modules); if (!$this->silent) { $current_step++; update_progress_bar('install', $total_steps, $total_steps); } if (isset($installdefs['custom_fields'])) { $this->log(translate('LBL_MI_IN_CUSTOMFIELD')); $this->install_custom_fields($installdefs['custom_fields']); } if (!$this->silent) { $current_step++; update_progress_bar('install', $current_step, $total_steps); echo '</div>'; } if (!$this->silent) { $current_step++; update_progress_bar('install', $current_step, $total_steps); echo '</div>'; } $selectedActions = array('clearTpls', 'clearJsFiles', 'clearDashlets', 'clearVardefs', 'clearJsLangFiles', 'rebuildAuditTables', 'repairDatabase'); VardefManager::clearVardef(); global $beanList, $beanFiles, $moduleList; if (file_exists('custom/application/Ext/Include/modules.ext.php')) { include 'custom/application/Ext/Include/modules.ext.php'; } require_once "modules/Administration/upgrade_custom_relationships.php"; upgrade_custom_relationships($installed_modules); $this->rebuild_all(true); require_once 'modules/Administration/QuickRepairAndRebuild.php'; $rac = new RepairAndClear(); $rac->repairAndClearAll($selectedActions, $installed_modules, true, false); $this->rebuild_relationships(); UpdateSystemTabs('Add', $tab_modules); //clear the unified_search_module.php file require_once 'modules/Home/UnifiedSearchAdvanced.php'; UnifiedSearchAdvanced::unlinkUnifiedSearchModulesFile(); $this->log('<br><b>' . translate('LBL_MI_COMPLETE') . '</b>'); } else { die("No \$installdefs Defined In {$this->base_dir}/manifest.php"); } }