} } } // END sidecar metadata updates logThis('Mobile/portal metadata upgrade check complete'); /////////////////////////////////////////////////////////////////////////////// //// TAKE OUT TRASH if (empty($errors)) { set_upgrade_progress('end', 'in_progress', 'unlinkingfiles', 'in_progress'); logThis('Taking out the trash, unlinking temp files.', $path); unlinkUWTempFiles(); removeSilentUpgradeVarsCache(); logThis('Taking out the trash, done.', $path); } // rebuild cache SugarAutoLoader::buildCache(); /////////////////////////////////////////////////////////////////////////////// //// RECORD ERRORS $phpErrors = ob_get_contents(); ob_end_clean(); logThis("**** Potential PHP generated error messages: {$phpErrors}", $path); if (count($errors) > 0) { foreach ($errors as $error) { logThis("****** SilentUpgrade ERROR: {$error}", $path); } echo "FAILED\n"; } else { logThis("***** SilentUpgrade completed successfully.", $path); echo "********************************************************************\n"; echo "*************************** SUCCESS ********************************\n"; echo "********************************************************************\n";
function reset_file_cache() { // check for upgrades if (is_callable(array('SugarAutoLoader', 'buildCache'))) { // rebuild cache after all changes SugarAutoLoader::buildCache(); } }
/** * This method saves a subpanels override defintion * * @param object $panel the subpanel * @param var $subsection * @param string $override the override string */ function saveSubPanelDefOverride($panel, $subsection, $override) { $layoutPath = "custom/Extension/modules/{$panel->parent_bean->module_dir}/Ext/Layoutdefs/"; $layoutDefsName = "layout_defs['{$panel->parent_bean->module_dir}']['subpanel_setup']['" . strtolower($panel->name) . "']"; $layoutDefsExtName = "layoutdefs"; $moduleInstallerMethod = "rebuild_layoutdefs"; //bug 42262 (filename with $panel->_instance_properties['get_subpanel_data'] can create problem if had word "function" in it) $overrideValue = $filename = $panel->parent_bean->object_name . "_subpanel_" . $panel->name; $overrideName = 'override_subpanel_name'; //save the new subpanel $name = "subpanel_layout['list_fields']"; //bugfix: load looks for moduleName/metadata/subpanels, not moduleName/subpanels $path = 'custom/modules/' . $panel->_instance_properties['module'] . '/metadata/subpanels'; //bug# 40171: "Custom subpanels not working as expected" //each custom subpanel needs to have a unique custom def file $oldName1 = '_override' . $panel->parent_bean->object_name . $panel->_instance_properties['module'] . $panel->_instance_properties['subpanel_name']; $oldName2 = '_override' . $panel->parent_bean->object_name . $panel->_instance_properties['get_subpanel_data']; if (file_exists("{$layoutPath}/{$oldName1}.php")) { @unlink("{$layoutPath}/{$oldName1}.php"); } if (file_exists("{$layoutPath}/{$oldName2}.php")) { @unlink("{$layoutPath}/{$oldName2}.php"); } $extname = '_override' . $filename; //end of bug# 40171 mkdir_recursive($path, true); write_array_to_file($name, $override, $path . '/' . $filename . '.php'); //save the override for the layoutdef //tyoung 10.12.07 pushed panel->name to lowercase to match case in subpaneldefs.php files - //gave error on bad index 'module' as this override key didn't match the key in the subpaneldefs $newValue = override_value_to_string($layoutDefsName, $overrideName, $overrideValue); mkdir_recursive($layoutPath, true); $fp = sugar_fopen("{$layoutPath}/{$extname}.php", 'w'); fwrite($fp, "<?php\n//auto-generated file DO NOT EDIT\n{$newValue}\n?>"); fclose($fp); require_once 'ModuleInstall/ModuleInstaller.php'; $moduleInstaller = new ModuleInstaller(); $moduleInstaller->silent = true; // make sure that the ModuleInstaller->log() function doesn't echo while rebuilding the layoutdefs $moduleInstaller->{$moduleInstallerMethod}(); SugarAutoLoader::buildCache(); foreach (SugarAutoLoader::existing('modules/' . $panel->parent_bean->module_dir . '/layout_defs.php', SugarAutoLoader::loadExtension($layoutDefsExtName, $panel->parent_bean->module_dir)) as $file) { include $file; } }
/** * Clear only the autoloader cache */ public function cleanFileCache() { if (is_callable(array('SugarAutoLoader', 'buildCache'))) { SugarAutoLoader::buildCache(); } else { // delete dangerous files manually @unlink("cache/file_map.php"); @unlink("cache/class_map.php"); } }
/** * rebuild mapping file */ public function rebuildFileMap() { global $mod_strings; if ($this->show_output) { echo "<h3>{$mod_strings['LBL_QR_REBUILDFILEMAP']}</h3>"; } SugarAutoLoader::buildCache(); }