private function createRelationship($lhs_module, $rhs_module = null, $relationship_type = 'one-to-many') { $rhs_module = $rhs_module == null ? $lhs_module : $rhs_module; // Adding relation between products and users $this->relationships = new DeployedRelationships($lhs_module); $definition = array('lhs_module' => $lhs_module, 'relationship_type' => $relationship_type, 'rhs_module' => $rhs_module, 'lhs_label' => $lhs_module, 'rhs_label' => $rhs_module, 'rhs_subpanel' => 'default'); $this->relationship = RelationshipFactory::newRelationship($definition); $this->relationships->add($this->relationship); $this->relationships->save(); $this->relationships->build(); LanguageManager::clearLanguageCache($lhs_module); // Updating $dictionary by created relation global $dictionary; $moduleInstaller = new ModuleInstaller(); $moduleInstaller->silent = true; $moduleInstaller->rebuild_tabledictionary(); require 'modules/TableDictionary.php'; // Updating vardefs VardefManager::$linkFields = array(); VardefManager::clearVardef(); VardefManager::refreshVardefs($lhs_module, BeanFactory::getObjectName($lhs_module)); if ($lhs_module != $rhs_module) { VardefManager::refreshVardefs($rhs_module, BeanFactory::getObjectName($rhs_module)); } SugarRelationshipFactory::rebuildCache(); }
function delete($rel_name) { require_once "ModuleInstall/ModuleInstaller.php"; require_once 'modules/Administration/QuickRepairAndRebuild.php'; $mi = new ModuleInstaller(); $mi->silent = true; $mi->uninstall_relationship("custom/metadata/{$rel_name}MetaData.php"); // now clear all caches so that our changes are visible Relationship::delete_cache(); $mi->rebuild_tabledictionary(); $MBmodStrings = $GLOBALS['mod_strings']; $GLOBALS['mod_strings'] = return_module_language('', 'Administration'); $rac = new RepairAndClear(); $rac->repairAndClearAll(array('clearAll', 'rebuildExtensions'), array($GLOBALS['mod_strings']['LBL_ALL_MODULES']), true, false); $GLOBALS['mod_strings'] = $MBmodStrings; }
function delete($rel_name) { //Remove any fields from layouts $rel = $this->get($rel_name); if (!empty($rel)) { $this->removeFieldsFromDeployedLayout($rel); } require_once "ModuleInstall/ModuleInstaller.php"; require_once 'modules/Administration/QuickRepairAndRebuild.php'; $mi = new ModuleInstaller(); $mi->silent = true; $mi->uninstall_relationship("custom/metadata/{$rel_name}MetaData.php"); // now clear all caches so that our changes are visible Relationship::delete_cache(); $mi->rebuild_tabledictionary(); $MBmodStrings = $GLOBALS['mod_strings']; $GLOBALS['mod_strings'] = return_module_language('', 'Administration'); $rac = new RepairAndClear(); $rac->repairAndClearAll(array('clearAll', 'rebuildExtensions'), array($GLOBALS['mod_strings']['LBL_ALL_MODULES']), true, false); $GLOBALS['mod_strings'] = $MBmodStrings; //Bug 41070, supercedes the previous 40941 fix in this section if (isset($this->relationships[$rel_name])) { unset($this->relationships[$rel_name]); } }
/** * Registration of $dictionary in global scope * * @static * @return bool is variable setuped or not */ protected static function setUp_dictionary() { self::setUp('beanFiles'); self::setUp('beanList'); self::$registeredVars['dictionary'] = true; global $dictionary; $dictionary = array(); $moduleInstaller = new ModuleInstaller(); $moduleInstaller->silent = true; $moduleInstaller->rebuild_tabledictionary(); require 'modules/TableDictionary.php'; foreach ($GLOBALS['beanList'] as $k => $v) { VardefManager::loadVardef($k, $v); } return true; }
// Implicitly set character set to skip browser buffer sniffing header('Content-Type: text/html; charset=UTF-8'); // Bypass output buffering if enforced by FastCGI implementation header('X-Accel-Buffering: no'); // Flush after each output so the user can see the progress in real-time ob_implicit_flush(); // When output_buffering is enabled - which is recommended in production - // make sure we flush the current output buffer(s) otherwise we are still // buffering at this point and real-time updates wont make it to the screen. while (@ob_end_flush()) { } require_once 'install/install_utils.php'; // since we need to make sure we have even the custom tabledictionary items in there $mi = new ModuleInstaller(); $mi->silent = true; $mi->rebuild_tabledictionary(); $mi->rebuild_vardefs(); require_once 'include/MetaDataManager/MetaDataManager.php'; MetaDataManager::disableCache(); include "modules/Trackers/tracker_perfMetaData.php"; include "modules/Trackers/tracker_queriesMetaData.php"; include "modules/Trackers/tracker_sessionsMetaData.php"; include "modules/Trackers/tracker_tracker_queriesMetaData.php"; require_once 'modules/TableDictionary.php'; $trackerManager = TrackerManager::getInstance(); $trackerManager->pause(); $cache_dir = sugar_cached(""); $line_entry_format = "     <b>"; $line_exit_format = "...   </b>"; $rel_dictionary = $dictionary; // sourced by modules/TableDictionary.php
/** * Clears cache. */ protected function cleanCache() { $mi = new ModuleInstaller(); $mi->silent = true; Relationship::delete_cache(); $mi->rebuild_vardefs(); $mi->rebuild_tabledictionary(); }