/** * @see SugarView::display() */ public function display() { $randc = new RepairAndClear(); $randc->repairAndClearAll(array('clearAll'), array(translate('LBL_ALL_MODULES')), false, true); echo <<<EOHTML <br /><br /><a href="index.php?module=Administration&action=index">{$GLOBALS['mod_strings']['LBL_DIAGNOSTIC_DELETE_RETURN']}</a> EOHTML; }
/** * Create the custom field with type 'relate' */ protected function createCustomField() { $field = get_widget('relate'); $field->id = 'Contacts' . $this->field_name_c; $field->name = $this->field_name_c; $field->type = 'relate'; $field->label = 'LBL_' . strtoupper($this->field_name_c); $field->ext2 = 'Accounts'; $field->view_module = 'Contacts'; $this->relateField = $field; $this->bean = BeanFactory::getBean('Contacts'); $this->df = new DynamicField($this->bean->module_name); $this->df->setup($this->bean); $field->save($this->df); $this->rc = new RepairAndClear(); $this->rc->repairAndClearAll(array("rebuildExtensions", "clearVardefs"), array('Contact'), false, false); }
function post_install() { $autoexecute = false; //execute the SQL $show_output = true; //output to the screen require_once "modules/Administration/QuickRepairAndRebuild.php"; $randc = new RepairAndClear(); $randc->repairAndClearAll(array('clearAll', 'clearMetadataAPICache'), array(translate('LBL_ALL_MODULES')), $autoexecute, $show_output); }
public function tearDown() { if ($this->accountFieldWidget) { $this->accountFieldWidget->delete($this->accountField); } if ($this->opportunityFieldWidget) { $this->opportunityFieldWidget->delete($this->opportunityField); } $repair = new RepairAndClear(); $repair->repairAndClearAll(array('rebuildExtensions', 'clearVardefs'), array($GLOBALS['beanList']['Accounts'], $GLOBALS['beanList']['Opportunities']), true, false); $_REQUEST = $_POST = array(); SugarTestHelper::tearDown(); }
/** * @see SugarView::display() */ public function display() { // To prevent lag in the rendering of the page after clicking the quick repair link... echo "<h2>{$GLOBALS['mod_strings']['LBL_BEGIN_QUICK_REPAIR_AND_REBUILD']}</h2>"; ob_flush(); $randc = new RepairAndClear(); $actions = array(); $actions[] = 'clearAll'; $randc->repairAndClearAll($actions, array(translate('LBL_ALL_MODULES')), false, true, ''); echo <<<EOHTML <br /><br /><a href="index.php?module=Administration&action=index">{$GLOBALS['mod_strings']['LBL_DIAGNOSTIC_DELETE_RETURN']}</a> EOHTML; }
function post_install() { if (strtolower($_POST['mode']) == 'install') { ?> <br/> <h3>Advanced OpenSales by <a href="http://www.salesagility.com">SalesAgility</a></h3> <br/> German translation by Claudia Haring & Georg Schütz <a href="http://www.kamux.de">www.kamux.de</a><br/> Russian tranlsation by likhobory <a href="mailto:likhobory@mail.ru">likhobory@mail.ru</a><br/> Dutch translation by OpenSesame ICT <a href="http://www.osict.com">www.osict.com</a> <a href="mailto:bdm@osict.com">bdm@osict.com</a><br/> Finnish translation by Henri Vuolle <a href="mailto:henri.vuolle@kiwai.fi">henri.vuolle@kiwai.fi</a><br/> Italian translation by Andrea Motta<br/> Spanish translation by Morris X<br/> <br/><?php $modules = array('AOS_Contracts', 'AOS_Invoices', 'AOS_PDF_Templates', 'AOS_Products', 'AOS_Products_Quotes', 'AOS_Quotes'); $actions = array('clearAll', 'rebuildAuditTables', 'rebuildExtensions', 'repairDatabase'); require_once 'modules/Administration/QuickRepairAndRebuild.php'; $randc = new RepairAndClear(); $randc->repairAndClearAll($actions, $modules, true, false); $_REQUEST['upgradeWizard'] = true; require_once 'modules/ACL/install_actions.php'; unset($_REQUEST['upgradeWizard']); } }
public function action_DeleteField() { $field = get_widget($_REQUEST['type']); $field->name = $_REQUEST['name']; if (!isset($_REQUEST['view_package'])) { if (!empty($_REQUEST['name']) && !empty($_REQUEST['view_module'])) { $moduleName = $_REQUEST['view_module']; // bug 51325 make sure we make this switch or delete will not work if ($moduleName == 'Employees') { $moduleName = 'Users'; } $seed = BeanFactory::getBean($moduleName); $df = new DynamicField($moduleName); $df->setup($seed); //Need to load the entire field_meta_data for some field types $field = $df->getFieldWidget($moduleName, $field->name); $field->delete($df); $GLOBALS['mod_strings']['LBL_ALL_MODULES'] = 'all_modules'; $_REQUEST['execute_sql'] = true; include_once 'modules/Administration/QuickRepairAndRebuild.php'; $repair = new RepairAndClear(); $repair->repairAndClearAll(array('rebuildExtensions', 'clearVardefs', 'clearTpls'), array($moduleName), true, false); require_once 'modules/ModuleBuilder/Module/StudioModuleFactory.php'; $module = StudioModuleFactory::getStudioModule($moduleName); } } else { $mb = new ModuleBuilder(); $module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']); $field = $module->getField($field->name); $field->delete($module); $mb->save(); } $module->removeFieldFromLayouts($field->name); $this->view = 'modulefields'; if (isset($GLOBALS['current_language']) && isset($_REQUEST['label']) && isset($_REQUEST['labelValue']) && isset($_REQUEST['view_module'])) { $this->DeleteLabel($GLOBALS['current_language'], $_REQUEST['label'], $_REQUEST['labelValue'], $_REQUEST['view_module']); $this->metadataApiCacheCleared = true; } // Clear the metadata cache if it hasn't been done already if (!$this->metadataApiCacheCleared && !empty($moduleName)) { // This removes the labels associated with the field and rebuilds // the api cache for the module $repair->module_list = array($moduleName); $repair->repairMetadataAPICache('labels'); } }
//retrieve old modules list writeLog('check to see if new modules exist'); $oldModuleList = array(); $newModuleList = array(); include $old_template . '/include/modules.php'; $oldModuleList = $moduleList; $moduleList = array(); include 'include/modules.php'; $newModuleList = $moduleList; /////////////////////////////////////////////////////////////////////////////// //// HANDLE DATABASE $mod_strings = $mod_strings_copy; writeLog('About to repair the database.'); //Use Repair and rebuild to update the database. $rac = new RepairAndClear(); $rac->repairAndClearAll(array('clearAll'), array($mod_strings['LBL_ALL_MODULES']), true, false); writeLog('database repaired'); //include tab controller $newTB = new TabController(); //make sure new modules list has a key we can reference directly $newModuleList = $newTB->get_key_array($newModuleList); $oldModuleList = $newTB->get_key_array($oldModuleList); //iterate through list and remove commonalities to get new modules foreach ($newModuleList as $remove_mod) { if (in_array($remove_mod, $oldModuleList)) { unset($newModuleList[$remove_mod]); } } //new modules list now has left over modules which are new to this install, so lets add them to the system tabs writeLog('new modules to add are ' . var_export($newModuleList, true)); //grab the existing system tabs
/** * Rebuild only Extensions. * @param array $modules Rebuild only the specified modules * @param string $user_id User id of the admin user * @return array Messages */ public function rebuildExtensions(array $modules = array(), $user_id = '1') { $this->setUpQuickRepair($user_id); $repair = new \RepairAndClear(); $repair->repairAndClearAll(array('rebuildExtensions'), $modules); return $this->getMessages(); }
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by SugarCRM". ********************************************************************************/ if (isset($_REQUEST['action']) && isset($_REQUEST['selected_actions']) && isset($_REQUEST['repair_module'])) { $randc = new RepairAndClear(); $randc->repairAndClearAll($_REQUEST['selected_actions'], $_REQUEST['repair_module'], false, true); } class RepairAndClear { var $module_list; var $show_output; var $actions; var $execute; var $module_list_from_cache; function repairAndClearAll($selected_actions, $modules, $autoexecute = false, $show_output = true) { global $mod_strings; $this->module_list = $modules; $this->show_output = $show_output; $this->actions = $selected_actions; $this->execute = $autoexecute;
function build() { $basepath = "custom/Extension/modules"; $this->activitiesToAdd = false; // and mark all as built so that the next time we come through we'll know and won't build again foreach ($this->relationships as $name => $relationship) { $definition = $relationship->getDefinition(); // activities will always appear on the rhs only - lhs will be always be this module in MB if (strtolower($definition['rhs_module']) == 'activities') { $this->activitiesToAdd = true; $relationshipName = $definition['relationship_name']; foreach (self::$activities as $activitiesSubModuleLower => $activitiesSubModuleName) { $definition['rhs_module'] = $activitiesSubModuleName; $definition['for_activities'] = true; $definition['relationship_name'] = $relationshipName . '_' . $activitiesSubModuleLower; $this->relationships[$definition['relationship_name']] = RelationshipFactory::newRelationship($definition); } unset($this->relationships[$name]); } } $GLOBALS['log']->info(get_class($this) . "->build(): installing relationships"); $MBModStrings = $GLOBALS['mod_strings']; $adminModStrings = return_module_language('', 'Administration'); // required by ModuleInstaller foreach ($this->relationships as $name => $relationship) { $relationship->setFromStudio(); $GLOBALS['mod_strings'] = $MBModStrings; $installDefs = parent::build($basepath, "<basepath>", array($name => $relationship)); // and mark as built so that the next time we come through we'll know and won't build again $relationship->setReadonly(); $this->relationships[$name] = $relationship; // now install the relationship - ModuleInstaller normally only does this as part of a package load where it installs the relationships defined in the manifest. However, we don't have a manifest or a package, so... // If we were to chose to just use the Extension mechanism, without using the ModuleInstaller install_...() methods, we must : // 1) place the information for each side of the relationship in the appropriate Ext directory for the module, which means specific $this->save...() methods for DeployedRelationships, and // 2) we must also manually add the relationship into the custom/application/Ext/TableDictionary/tabledictionary.ext.php file as install_relationship doesn't handle that (install_relationships which requires the manifest however does) // Relationships must be in tabledictionary.ext.php for the Admin command Rebuild Relationships to reliably work: // Rebuild Relationships looks for relationships in the modules vardefs.php, in custom/modules/<modulename>/Ext/vardefs/vardefs.ext.php, and in modules/TableDictionary.php and custom/application/Ext/TableDictionary/tabledictionary.ext.php // if the relationship is not defined in one of those four places it could be deleted during a rebuilt, or during a module installation (when RebuildRelationships.php deletes all entries in the Relationships table) // So instead of doing this, we use common save...() methods between DeployedRelationships and UndeployedRelationships that will produce installDefs, // and rather than building a full manifest file to carry them, we manually add these installDefs to the ModuleInstaller, and then // individually call the appropriate ModuleInstaller->install_...() methods to take our relationship out of our staging area and expand it out to the individual module Ext areas $GLOBALS['mod_strings'] = $adminModStrings; require_once 'ModuleInstall/ModuleInstaller.php'; $mi = new ModuleInstaller(); $mi->id_name = 'custom' . $name; // provide the moduleinstaller with a unique name for this relationship - normally this value is set to the package key... $mi->installdefs = $installDefs; $mi->base_dir = $basepath; $mi->silent = true; VardefManager::clearVardef(); $mi->install_relationships(); $mi->install_languages(); $mi->install_vardefs(); $mi->install_layoutdefs(); } // now clear all caches so that our changes are visible require_once 'modules/Administration/QuickRepairAndRebuild.php'; $rac = new RepairAndClear(); $rac->repairAndClearAll(array('clearAll'), array($GLOBALS['mod_strings']['LBL_ALL_MODULES']), true, false); $GLOBALS['mod_strings'] = $MBModStrings; // finally, restore the ModuleBuilder mod_strings // save out the updated definitions so that we keep track of the change in built status $this->save(); $GLOBALS['log']->info(get_class($this) . "->build(): finished relationship installation"); }
function post_install() { // create directory for external contract pdf files $externalContractsPdfDir = "{$GLOBALS['sugar_config']['cache_dir']}/modules/Emails/attachments/"; mkdir_recursive($externalContractsPdfDir); if (file_exists($externalContractsPdfDir)) { $GLOBALS['log']->debug("Successfully created directory '{$externalContractsPdfDir}'"); } else { $GLOBALS['log']->fatal("Could not create directory for creation of pdf files: '{$externalContractsPdfDir}'"); } global $sugar_config; global $sugar_version; $module_list = array('oqc_TextBlock', 'oqc_Offering', 'oqc_Product', 'oqc_Contract', 'oqc_ExternalContract', 'oqc_ProductCatalog', 'oqc_Addition', 'oqc_Task'); // Add banning of AjaxUI for openqc modules require_once 'modules/Configurator/Configurator.php'; $cfg = new Configurator(); $overrideArray = $cfg->readOverride(); if (array_key_exists('addAjaxBannedModules', $overrideArray)) { $disabled_modules = $overrideArray['addAjaxBannedModules']; $updatedArray = array_merge($disabled_modules, array_diff($module_list, $disabled_modules)); } else { $updatedArray = $module_list; } $cfg->config['addAjaxBannedModules'] = empty($updatedArray) ? FALSE : $updatedArray; $cfg->handleOverride(); // Configure documents.properties file depending on OS. There is three choices atm //1. Default- Linux (OpenSuse, Ubuntu); 2. WinXP; 3. MACOSX $oqc_config_directory = 'include/oqc/conf/'; if (strtoupper(substr(php_uname('s'), 0, 3)) === 'WIN') { if (file_exists($oqc_config_directory . 'documents_linux.properties')) { unlink($oqc_config_directory . 'documents_linux.properties'); } rename($oqc_config_directory . 'documents.properties', $oqc_config_directory . 'documents_linux.properties'); rename($oqc_config_directory . 'documents_windows.properties', $oqc_config_directory . 'documents.properties'); } elseif (strtoupper(substr(php_uname('s'), 0, 3)) === 'DAR') { if (file_exists($oqc_config_directory . 'documents_linux.properties')) { unlink($oqc_config_directory . 'documents_linux.properties'); } rename($oqc_config_directory . 'documents.properties', $oqc_config_directory . 'documents_linux.properties'); rename($oqc_config_directory . 'documents_macosx.properties', $oqc_config_directory . 'documents.properties'); } //Do some sanity checks before installing scheduler file if sugar version is lower than 6.3 if (floatval(substr($sugar_version, 0, 3)) < 6.3) { $scheduler_directory = 'custom/modules/Schedulers/'; if (file_exists($scheduler_directory . '_AddJobsHere.php')) { //rename existing file; User can merge oqc file with original one manually if (file_exists($scheduler_directory . '_AddJobsHere_original.php')) { unlink($scheduler_directory . '_AddJobsHere_original.php'); } rename($scheduler_directory . '_AddJobsHere.php', $scheduler_directory . '_AddJobsHere_original.php'); } rename($scheduler_directory . 'oqc_AddJobsHere.php', $scheduler_directory . '_AddJobsHere.php'); } // Rebuild Roles after install require_once 'modules/ACL/install_actions.php'; //Last, Do a Quick Repair & Rebuild $module = array('All Modules'); $selected_actions = array('clearAll'); require_once 'modules/Administration/QuickRepairAndRebuild.php'; $randc = new RepairAndClear(); $randc->repairAndClearAll($selected_actions, $module, false, false); }
<?php if (!defined('sugarEntry') || !sugarEntry) { die('Not A Valid Entry Point'); } global $db; //***********************************************************// //********** Restauramos los ficheros originales ************// //***********************************************************// echo "<b>Restored Files:</b><br/><br/>"; //***********************************************************// //********** Restauramos los ficheros originales ************// //***********************************************************// echo "<br/><br/><br/><b>Modified Files:</b><br/><br/>"; echo "<br/><b>AlineaSol Repair Done.</b>"; //Repair and Rebuild $module = array('All Modules'); $selected_actions = array('clearAll'); require_once 'modules/Administration/QuickRepairAndRebuild.php'; $randc = new RepairAndClear(); $randc->repairAndClearAll($selected_actions, $module, false, false); //Repair and Rebuild echo "<br/><b>SugarCRM Repair & Rebuild Done.</b>";
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"); } }
public function createCustom() { //create new varchar widget and associate with Accounts $this->custField = get_widget('varchar'); $this->custField->id = 'Accounts' . $this->custFieldName; $this->custField->name = $this->custFieldName; $this->custField->type = 'varchar'; $this->custField->label = 'LBL_' . strtoupper($this->custFieldName); $this->custField->vname = 'LBL_' . strtoupper($this->custFieldName); $this->custField->len = 255; $this->custField->custom_module = 'Accounts'; $this->custField->required = 0; $this->custField->default = 'goofy'; $this->acc = new Account(); $this->df = new DynamicField('Accounts'); $this->df->setup($this->acc); $this->df->addFieldObject($this->custField); $this->df->buildCache('Accounts'); $this->custField->save($this->df); VardefManager::clearVardef(); VardefManager::refreshVardefs('Accounts', 'Account'); //Now create the meta files to make this a Calculated Field. $fn = $this->custFieldName; $extensionContent = <<<EOQ <?php \$dictionary['Account']['fields']['{$fn}']['duplicate_merge_dom_value']=0; \$dictionary['Account']['fields']['{$fn}']['calculated']='true'; \$dictionary['Account']['fields']['{$fn}']['formula']='related(\$assigned_user_link,"name")'; \$dictionary['Account']['fields']['{$fn}']['enforced']='true'; \$dictionary['Account']['fields']['{$fn}']['dependency']=''; \$dictionary['Account']['fields']['{$fn}']['type']='varchar'; \$dictionary['Account']['fields']['{$fn}']['name']='{$fn}'; EOQ; //create custom field file $this->custFileDirPath = create_custom_directory($this->custFileDirPath); $fileLoc = $this->custFileDirPath . 'sugarfield_' . $this->custFieldName . '.php'; file_put_contents($fileLoc, $extensionContent); //run repair and clear to make sure the meta gets picked up $_REQUEST['repair_silent'] = 1; $rc = new RepairAndClear(); $rc->repairAndClearAll(array("clearAll", "rebuildExtensions"), array("Accounts"), false, false); $fn = $this->custFieldName; }
<?php /* * Your installation or use of this SugarCRM file is subject to the applicable * terms available at * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/. * If you do not agree to all of the applicable terms or do not have the * authority to bind the entity as an authorized representative, then do not * install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ global $current_user; $current_user->is_admin = 1; $_REQUEST['mode'] = 'execute'; include_once 'modules/Administration/RepairIndex.php'; //rrs: if we synced down custom fields the languages were not being updated. $mod_strings = return_module_language('en_us', 'Administration'); include_once 'modules/Administration/QuickRepairAndRebuild.php'; $randc = new RepairAndClear(); $randc->repairAndClearAll(array('clearAll', 'repairDatabase'), array('All Modules'), true, false); include_once 'include/SugarObjects/LanguageManager.php'; LanguageManager::clearLanguageCache(); $current_user->is_admin = 0;
/** * runs rebuild scripts */ function UWrebuild() { global $db; global $path; logThis('Rebuilding everything...', $path); // require_once('ModuleInstall/ModuleInstaller.php'); // $mi = new ModuleInstaller(); // $mi->rebuild_all(true); require_once 'modules/Administration/QuickRepairAndRebuild.php'; $randc = new RepairAndClear(); $randc->repairAndClearAll(array('clearAll'), array(translate('LBL_ALL_MODULES')), false, false); $query = "DELETE FROM versions WHERE name='Rebuild Extensions'"; $db->query($query); logThis('Registering rebuild record: ' . $query, $path); logThis('Rebuild done.', $path); // insert a new database row to show the rebuild extensions is done $id = create_guid(); $gmdate = gmdate($GLOBALS['timedate']->get_db_date_time_format()); $date_entered = db_convert("'{$gmdate}'", 'datetime'); $query = 'INSERT INTO versions (id, deleted, date_entered, date_modified, modified_user_id, created_by, name, file_version, db_version) ' . "VALUES ('{$id}', '0', {$date_entered}, {$date_entered}, '1', '1', 'Rebuild Extensions', '4.0.0', '4.0.0')"; $db->query($query); logThis('Registering rebuild record in versions table: ' . $query, $path); }
function removeCustomExtensions() { $out = ""; $extDir = "custom/Extension/modules/{$this->module}"; if (is_dir($extDir)) { rmdir_recursive($extDir); require_once 'modules/Administration/QuickRepairAndRebuild.php'; $rac = new RepairAndClear(); $rac->repairAndClearAll(array('clearAll'), array($this->module), true, false); $rac->rebuildExtensions(); $out .= "Cleared extensions for {$this->module}<br/>"; } return $out; }
<?php /** * Copyright 2016 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license. */ if (!defined('sugarEntry') || !sugarEntry) { die('Not A Valid Entry Point'); } require_once "modules/Administration/QuickRepairAndRebuild.php"; $randc = new RepairAndClear(); //Rebuild extensions then clear include/javascript files $randc->repairAndClearAll(array('rebuildExtensions', 'clearAdditionalCaches'), array(translate('LBL_ALL_MODULES')), false, true);
function action_DeleteField() { require_once 'modules/DynamicFields/FieldCases.php'; $field = get_widget($_REQUEST['type']); $field->name = $_REQUEST['name']; if (!isset($_REQUEST['view_package'])) { if (!empty($_REQUEST['name']) && !empty($_REQUEST['view_module'])) { require_once 'modules/DynamicFields/DynamicField.php'; $moduleName = $_REQUEST['view_module']; // bug 51325 make sure we make this switch or delete will not work if ($moduleName == 'Employees') { $moduleName = 'Users'; } $class_name = $GLOBALS['beanList'][$moduleName]; require_once $GLOBALS['beanFiles'][$class_name]; $seed = new $class_name(); $df = new DynamicField($moduleName); $df->setup($seed); //Need to load the entire field_meta_data for some field types $field = $df->getFieldWidget($moduleName, $field->name); $field->delete($df); $GLOBALS['mod_strings']['LBL_ALL_MODULES'] = 'all_modules'; $_REQUEST['execute_sql'] = true; include_once 'modules/Administration/QuickRepairAndRebuild.php'; $repair = new RepairAndClear(); $repair->repairAndClearAll(array('rebuildExtensions', 'clearVardefs', 'clearTpls'), array($class_name), true, false); require_once 'modules/ModuleBuilder/Module/StudioModuleFactory.php'; $module = StudioModuleFactory::getStudioModule($moduleName); } } else { $mb = new ModuleBuilder(); $module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']); $field = $module->getField($field->name); $field->delete($module); $mb->save(); } $module->removeFieldFromLayouts($field->name); $this->view = 'modulefields'; if (isset($GLOBALS['current_language']) && isset($_REQUEST['label']) && isset($_REQUEST['labelValue']) && isset($_REQUEST['view_module'])) { $this->DeleteLabel($GLOBALS['current_language'], $_REQUEST['label'], $_REQUEST['labelValue'], $_REQUEST['view_module']); } }
/** * Utility function. Rebuilds extensions for specified module. * * @static * @param string $module * @return void */ protected static function rebuildExtensions($module) { $rc = new RepairAndClear(); $rc->repairAndClearAll(array('rebuildExtensions'), array($module), false, false); }
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"); } }
public function tearDown() { //remove the 2 grouping files and their directories if (file_exists('custom/Extension/application/Ext/JSGroupings/Jgroup0.php')) { unlink('custom/Extension/application/Ext/JSGroupings/Jgroup0.php'); } if (file_exists('custom/Extension/application/Ext/JSGroupings/Jgroup1.php')) { unlink('custom/Extension/application/Ext/JSGroupings/Jgroup1.php'); } if ($this->removeJSG_Dir && file_exists("custom/Extension/application/Ext/JSGroupings")) { @rmdir("custom/Extension/application/Ext/JSGroupings"); } //unset before array unset($this->beforeArray); //run repair so the extension files are reset back to original state $trac = new RepairAndClear(); $trac->repairAndClearAll(array('rebuildExtensions'), array(), false, false); }
<?php //run a quick repair require_once 'modules/Administration/QuickRepairAndRebuild.php'; $RAC = new RepairAndClear(); $actions = array('clearAll'); $RAC->repairAndClearAll($actions, array(translate('LBL_ALL_MODULES')), false, true);
global $sugar_config; if (!empty($sugar_config['site_url'])) { header("Location: " . $sugar_config['site_url'] . "/index.php"); } else { sugar_die("Didn't find site url in your sugarcrm config file"); } } //End of #27991 if (empty($current_language)) { $current_language = $sugar_config['default_language']; } $app_list_strings = return_app_list_strings_language($current_language); $app_strings = return_application_language($current_language); global $current_user; $current_user = new User(); $current_user->getSystemUser(); $GLOBALS['log']->debug('--------------------------------------------> at repair.php <--------------------------------------------'); $repair = new RepairAndClear(); $repair->repairAndClearAll(array('clearAll'), array(translate('LBL_ALL_MODULES')), true, false); $exit_on_cleanup = true; sugar_cleanup(false); // some jobs have annoying habit of calling sugar_cleanup(), and it can be called only once // but job results can be written to DB after job is finished, so we have to disconnect here again // just in case we couldn't call cleanup if (class_exists('DBManagerFactory')) { $db = DBManagerFactory::getInstance(); $db->disconnect(); } if ($exit_on_cleanup) { exit; }
if (isset($_POST['deleteEmpty'])) { $rlf->deleteEmpty = true; } if (isset($_POST['lowLevelLog']) && $_POST['lowLevelLog'] == 1) { $rlf->lowLevelLog = true; } else { $rlf->lowLevelLog = false; } //Run the tests $rlf->processLanguageFiles(); //Run a QR&R $GLOBALS['log']->debug("fixLanguageFiles: BEGIN QRR"); require_once 'modules/Administration/QuickRepairAndRebuild.php'; $RAC = new RepairAndClear(); $actions = array('clearAll'); $RAC->repairAndClearAll($actions, array('All Modules'), false, $output); $GLOBALS['log']->debug("fixLanguageFiles: END QRR"); $sugar_smarty = new Sugar_Smarty(); $sugar_smarty->assign("MOD", $mod_strings); $sugar_smarty->assign("APP", $app_strings); $sugar_smarty->assign("RETURN_MODULE", "Administration"); $sugar_smarty->assign("RETURN_ACTION", "index"); $sugar_smarty->assign("DB_NAME", $db->dbName); $sugar_smarty->assign("MODULE", $currentModule); $sugar_smarty->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']); //result storage $sugar_smarty->assign("MANUALFIXFILES", implode("\n", $rlf->manualFixFiles)); $sugar_smarty->assign("MODIFIEDFILES", implode("\n", $rlf->modifiedFiles)); $sugar_smarty->assign("INDEXCHANGES", implode("\n", $rlf->indexChanges)); $sugar_smarty->assign("REMOVEDFILES", implode("\n", $rlf->removedFiles)); $sugar_smarty->assign("REMOVEDMODULES", implode("\n", $rlf->removedModules));
function delete($rel_name) { $this->newRelationshipName = $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['reload_vardefs'] = true; $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]); } }