/** * Handles processing before the execute process */ public function preProcess() { // Turn on the metadata manager queue but turn off the queue runner until // after all processing is done MetaDataManager::enableCacheRefreshQueue(); MetaDataManager::setRunQueueOnCallOff(); }
function save($df) { // Bug 58560 - Set the group name since addresses are part of a group $this->group = $df->getDBName($this->name); require_once 'modules/ModuleBuilder/parsers/parser.label.php'; $parser = new ParserLabel($df->getModuleName(), $df->getPackageName()); // Clean up the labels so they more accurately reflect the actual field if (!empty($this->label_value)) { $labelValue = $this->label_value; } else { $labelValue = empty($_REQUEST['labelValue']) ? '' : $_REQUEST['labelValue']; } // If there is a label to use, space it here for use below if (!empty($labelValue)) { $labelValue .= ' '; } // To prevent mutilple calls to the metadata api cache rebuilder, queue MetaDataManager::enableCacheRefreshQueue(); // To keep consistency with OOTB address groups, add Street to the fields foreach (array('Street', 'City', 'State', 'PostalCode', 'Country') as $addressFieldName) { $systemLabel = strtoupper("LBL_" . $this->name . '_' . $addressFieldName); // Use the entered label value as a prefix instead of the field name $parser->handleSave(array("label_" . $systemLabel => $labelValue . $addressFieldName), $GLOBALS['current_language']); if ($addressFieldName === 'Street') { $addressField = new TemplateAddressStreet(); $addressField->len = 150; } else { $addressField = new TemplateField(); $addressField->len = $addressFieldName === 'PostalCode' ? 20 : 100; } $addressField->name = $this->name . '_' . strtolower($addressFieldName); $addressField->label = $addressField->vname = $systemLabel; // Bug 58560 - Add the group to this field so it gets written to the custom vardefs $addressField->group = $this->group; // Maintain unified search setting for 'Street' $addressField->supports_unified_search = $addressField == 'Street'; $addressField->save($df); } // Handle the metadata api update now MetaDataManager::runCacheRefreshQueue(); }
/** * Save function responsible executing all sub-save functions required to rename a module. * * @return void */ public function save($redirect = TRUE) { global $locale; if (!empty($_REQUEST['dropdown_lang'])) { $this->selectedLanguage = $_REQUEST['dropdown_lang']; } else { $this->selectedLanguage = $locale->getAuthenticatedUserLanguage(); } //Clear all relevant language caches $this->clearLanguageCaches(); //Retrieve changes the user is requesting and store previous values for future use. $this->changedModules = $this->getChangedModules(); // Queue the metadata manager so that writes and rewrites only happen once MetaDataManager::enableCacheRefreshQueue(); //Change module, appStrings, subpanels, and related links. $this->changeAppStringEntries()->changeAllModuleModStrings()->renameAllRelatedLinks()->renameAllSubpanels()->renameAllDashlets()->changeStringsInRelatedModules()->changeGlobalAppStrings(); // Run the metadata cache refresh queue so changes take effect MetaDataManager::runCacheRefreshQueue(); //Refresh the page again so module tabs are changed as the save process happens after module tabs are already generated. if ($redirect) { echo "\n <script>\n var app = window.parent.SUGAR.App;\n app.api.call('read', app.api.buildURL('ping'));\n </script>"; } }
public function repairAndClearAll($selected_actions, $modules, $autoexecute = false, $show_output = true, $metadata_sections = false) { global $mod_strings; $this->module_list = $modules; $this->show_output = $show_output; // Add repairDatabase to the actions stack $actions = array_merge($selected_actions, array('repairDatabase')); // Unique the action stack to prevent duplicate processing $this->actions = array_unique($actions); $this->execute = $autoexecute; // Clear vardefs and language cache always. Since this is called here it // should not be in the actions $this->clearVardefs(); $this->clearLanguageCache(); // Enable the metadata manager cache refresh to queue. This allows the // cache refresh processes in metadata manager to be carried out one time // at the end of the rebuild instead of continual processing during the // request. This is set outside of the loop to allow any other cache reset // process to carry itself out as needed without firing off continual // calls to the metadata manager. MetaDataManager::enableCacheRefreshQueue(); foreach ($this->actions as $current_action) { switch ($current_action) { case 'repairDatabase': if (in_array($mod_strings['LBL_ALL_MODULES'], $this->module_list)) { $this->repairDatabase(); // Mark this as called so it doesn't get ran again $this->called[$current_action] = true; } else { $this->repairDatabaseSelectModules(); } break; case 'rebuildExtensions': if (in_array($mod_strings['LBL_ALL_MODULES'], $this->module_list)) { $this->rebuildExtensions(); // Mark this as called so it doesn't get ran again $this->called[$current_action] = true; } else { $this->rebuildExtensions($this->module_list); } break; case 'clearTpls': $this->clearTpls(); break; case 'clearJsFiles': $this->clearJsFiles(); break; case 'clearDashlets': $this->clearDashlets(); break; case 'clearThemeCache': $this->clearThemeCache(); break; case 'clearJsLangFiles': $this->clearJsLangFiles(); break; case 'rebuildAuditTables': $this->rebuildAuditTables(); break; case 'clearSearchCache': $this->clearSearchCache(); break; case 'clearAdditionalCaches': $this->clearAdditionalCaches(); break; case 'repairMetadataAPICache': $this->repairMetadataAPICache(); break; case 'clearPDFFontCache': $this->clearPDFFontCache(); break; case 'resetForecasting': $this->resetForecasting(); break; case 'repairConfigs': $this->repairBaseConfig(); $this->repairPortalConfig(); case 'clearAll': $this->clearTpls(); $this->clearJsFiles(); $this->clearJsLangFiles(); $this->clearDashlets(); $this->clearSmarty(); $this->clearThemeCache(); $this->clearXMLfiles(); $this->clearSearchCache(); $this->clearExternalAPICache(); $this->clearAdditionalCaches(); $this->clearPDFFontCache(); $this->rebuildExtensions(); $this->rebuildFileMap(); $this->rebuildAuditTables(); $this->repairDatabase(); $this->repairBaseConfig(); $this->repairPortalConfig(); $this->repairMetadataAPICache($metadata_sections); break; } } // Reset this so that things work properly after this is over $this->called = array(); // Run the metadata cache refresh queue. This will turn queueing off // after it is run MetaDataManager::runCacheRefreshQueue(); }