function getJSPath($relative_path, $additional_attrs = '') { if (defined('TEMPLATE_URL')) { $relative_path = SugarTemplateUtilities::getWebPath($relative_path); } if (empty($GLOBALS['sugar_config']['js_custom_version'])) { $GLOBALS['sugar_config']['js_custom_version'] = 1; } $js_version_key = isset($GLOBALS['js_version_key']) ? $GLOBALS['js_version_key'] : ''; $path = $relative_path . '?s=' . $js_version_key . '&c=' . $GLOBALS['sugar_config']['js_custom_version']; if (inDeveloperMode()) { $path .= '&developerMode=' . mt_rand(); } if (!empty($additonal_attrs)) { $path .= '&' . $additional_attrs; } return $path; }
/** * Rebuilds the extension files found in custom/Extension * @param boolean $silent */ function rebuild_all($silent = false) { if (defined('TEMPLATE_URL')) { SugarTemplateUtilities::disableCache(); } $this->silent = $silent; global $sugar_config; //Check for new module extensions $this->rebuild_modules(); $this->rebuild_languages($sugar_config['languages']); $this->rebuild_extensions(); $this->rebuild_dashletcontainers(); $this->rebuild_relationships(); $this->rebuild_tabledictionary(); $this->reset_opcodes(); sugar_cache_reset(); }
} else { $xtpl->assign("LBL_CHARSET", $default_charset); } //////SNIPPET ADDED FOR TEMPLATING $image_server = ''; if (defined('TEMPLATE_URL')) { $image_server = TEMPLATE_URL . '/'; } $xtpl->assign("IMAGE_SERVER", $image_server); ///////END SNIPPET FOR TEMPLATING $xtpl->assign("THEME", $theme); //////SNIPPET ADDED FOR TEMPLATING $xtpl->assign("IMAGE_PATH", $image_path); $company_logo = $image_path . 'company_logo.png'; if (defined('INSTANCE_PATH') && file_exists(INSTANCE_PATH . 'custom/' . $theme_path . 'images/company_logo.png')) { $company_logo = SugarTemplateUtilities::getWebPath('custom/' . $theme_path . 'images/company_logo.png'); } else { if (file_exists('custom/' . $theme_path . 'images/company_logo.png')) { $company_logo = 'custom/' . $theme_path . 'images/company_logo.png'; } } $xtpl->assign('COMPANY_LOGO', $company_logo); ///////END SNIPPET FOR TEMPLATING $xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']); $xtpl->assign("MODULE_NAME", $currentModule); $xtpl->assign("DATE", date("Y-m-d")); if ($current_user->first_name != '') { $xtpl->assign("CURRENT_USER", $current_user->first_name); } else { $xtpl->assign("CURRENT_USER", $current_user->user_name); }
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 getJSPath($relative_path, $additional_attrs = '') { if (defined('TEMPLATE_URL')) { $relative_path = SugarTemplateUtilities::getWebPath($relative_path); } return getVersionedPath($relative_path) . (!empty($additional_attrs) ? "&{$additional_attrs}" : ""); }
/** * Save connectors array to file * @param array $connectors Source data to write * @param string $toFile filename to use * @return bool success */ public static function saveConnectors($connectors, $toFile = '') { if (empty($toFile)) { $toFile = 'custom/modules/Connectors/metadata/connectors.php'; if (defined('TEMPLATE_URL')) { $toFile = SugarTemplateUtilities::getFilePath($toFile); } } if (!is_array($connectors)) { $connectors = array(); } if (!write_array_to_file('connectors', $connectors, $toFile)) { //Log error and return empty array $GLOBALS['log']->fatal("Cannot write sources to file"); return false; } self::$connectors_cache = $connectors; return true; }
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 rebuild_all($silent = false) { if (defined('TEMPLATE_URL')) { SugarTemplateUtilities::disableCache(); } $this->silent = $silent; global $sugar_config; $this->rebuild_languages($sugar_config['languages']); $this->rebuild_vardefs(); $this->rebuild_layoutdefs(); $this->rebuild_menus(); $this->rebuild_userpage(); $this->rebuild_administration(); $this->rebuild_relationships(); //$this->repair_indices(); sugar_cache_reset(); }
/** * Rebuilds the extension files found in custom/Extension * * @param boolean $silent * @param array $modules optional list of modules to update. If $modules is empty, all modules are rebuilt */ function rebuild_all($silent = false, $modules = array()) { if (defined('TEMPLATE_URL')) { SugarTemplateUtilities::disableCache(); } $this->silent = $silent; global $sugar_config; $this->rebuild_languages($sugar_config['languages'], $modules); $this->rebuild_extensions($modules); $this->rebuild_dashletcontainers($modules); // This will be a time consuming process, particularly if $modules is empty $this->rebuild_relationships(array_flip($modules)); $this->rebuild_tabledictionary(); $this->reset_opcodes(); sugar_cache_reset(); }
function makeInvisibleForAll($item_id) { $query = "UPDATE {$this->table_name} SET visible = 0 WHERE item_id = '{$item_id}' AND visible = 1"; $this->db->query($query, true); $path = 'modules/Trackers/BreadCrumbStack.php'; if (defined('TEMPLATE_URL')) { $path = SugarTemplateUtilities::getFilePath($path); } require_once $path; if (!empty($_SESSION['breadCrumbs'])) { $breadCrumbs = $_SESSION['breadCrumbs']; $breadCrumbs->popItem($item_id); } }
/** * create_tables * Override this method to insert ACLActions for the tracker beans * */ function create_tables() { $path = 'modules/Trackers/config.php'; if (defined('TEMPLATE_URL')) { $path = SugarTemplateUtilities::getFilePath($path); } require $path; foreach ($tracker_config as $key => $configEntry) { if (isset($configEntry['bean']) && $configEntry['bean'] != 'Tracker') { $bean = new $configEntry['bean'](); if ($bean->bean_implements('ACL')) { ACLAction::addActions($bean->module_dir, $configEntry['bean']); } } } parent::create_tables(); }
/** * getConnectors * Returns an Array of the connectors that have been loaded into the system * along with attributes pertaining to each connector. * * @param boolean $refresh boolean flag indicating whether or not to force rewriting the file; defaults to false * @returns mixed $connectors Array of the connector entries found */ public static function getConnectors($refresh = false) { //define paths $src1 = 'modules/Connectors/connectors/sources'; $src2 = 'custom/modules/Connectors/connectors/sources'; $src3 = 'custom/modules/Connectors/metadata'; $src4 = 'custom/modules/Connectors/metadata/connectors.php'; //if this is a templated environment, then use utilities to get the proper paths if (defined('TEMPLATE_URL')) { $src1 = SugarTemplateUtilities::getFilePath($src1); $src2 = SugarTemplateUtilities::getFilePath($src2); $src3 = SugarTemplateUtilities::getFilePath($src3); $src4 = SugarTemplateUtilities::getFilePath($src4); } if ($refresh || !file_exists($src4)) { $sources = array_merge(self::getSources($src1), self::getSources($src2)); if (!file_exists($src3)) { mkdir_recursive($src3); } if (!write_array_to_file('connectors', $sources, $src4)) { //Log error and return empty array $GLOBALS['log']->fatal("Cannot write sources to file"); return array(); } } //if require $src4; return $connectors; }