Example #1
0
 function zd_TicketsViewDetail()
 {
     parent::SugarView();
     $repair = new RepairAndClear();
     $repair->module_list = array('zd_Tickets');
     $repair->clearTpls();
 }
Example #2
0
 public function action_savelanguages()
 {
     global $sugar_config;
     $toDecode = html_entity_decode($_REQUEST['disabled_langs'], ENT_QUOTES);
     $disabled_langs = json_decode($toDecode);
     $toDecode = html_entity_decode($_REQUEST['enabled_langs'], ENT_QUOTES);
     $enabled_langs = json_decode($toDecode);
     if (count($sugar_config['languages']) === count($disabled_langs)) {
         sugar_die(translate('LBL_CAN_NOT_DISABLE_ALL_LANG'));
     } else {
         $cfg = new Configurator();
         if (in_array($sugar_config['default_language'], $disabled_langs)) {
             reset($enabled_langs);
             $cfg->config['default_language'] = current($enabled_langs);
         }
         if (in_array($GLOBALS['current_user']->preferred_language, $disabled_langs)) {
             $GLOBALS['current_user']->preferred_language = current($enabled_langs);
             $GLOBALS['current_user']->save();
         }
         $cfg->config['disabled_languages'] = join(',', $disabled_langs);
         // TODO: find way to enforce order
         $cfg->handleOverride();
         // Clear the metadata cache so changes to languages are picked up right away
         MetaDataManager::refreshLanguagesCache($enabled_langs);
         require_once 'modules/Administration/QuickRepairAndRebuild.php';
         $repair = new RepairAndClear();
         $repair->clearLanguageCache();
     }
     //Call Ping API to refresh the language list.
     die("\n            <script>\n            var app = window.parent.SUGAR.App;\n            app.api.call('read', app.api.buildURL('ping'));\n            app.router.navigate('#bwc/index.php?module=Administration&action=Languages', {trigger:true, replace:true});\n            </script>");
 }
Example #3
0
    /**
     * @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;
    }
 public function run()
 {
     // we just finished with the layouts, we need to rebuild the extensions
     include "include/modules.php";
     require_once "modules/Administration/QuickRepairAndRebuild.php";
     $rac = new RepairAndClear('', '', false, false);
     $rac->rebuildExtensions();
 }
Example #5
0
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);
}
Example #6
0
 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();
 }
Example #7
0
    /**
     * @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;
    }
Example #8
0
 /**
  * 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()
{
    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']);
    }
}
Example #10
0
<?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>";
Example #11
0
                                if (is_array($entry) && isset($entry['name'])) {
                                    $parser->_viewdefs['panels'][$panel_id][$row_id][$entry_id]['name'] = strtolower($entry['name']);
                                }
                            }
                        }
                    }
                } else {
                    //For basic_search and advanced_search views, just process the fields
                    foreach ($parser->_viewdefs as $entry_id => $entry) {
                        if (is_array($entry) && isset($entry['name'])) {
                            $parser->_viewdefs[$entry_id]['name'] = strtolower($entry['name']);
                        }
                    }
                }
                //Save the changes
                $parser->handleSave(false);
            }
            //foreach
            //Now clear the cache of the .tpl files
            TemplateHandler::clearCache($module);
        }
        //foreach
        echo '<br>' . $mod_strings['LBL_CLEAR_VARDEFS_DATA_CACHE_TITLE'];
        require_once 'modules/Administration/QuickRepairAndRebuild.php';
        $repair = new RepairAndClear();
        $repair->show_output = false;
        $repair->module_list = array($class_names);
        $repair->clearVardefs();
    }
    echo '<br>' . $mod_strings['LBL_DIAGNOSTIC_DONE'];
}
Example #12
0
 function action_SaveField()
 {
     require_once 'modules/DynamicFields/FieldCases.php';
     $field = get_widget($_REQUEST['type']);
     $_REQUEST['name'] = trim($_POST['name']);
     $field->populateFromPost();
     if (!isset($_REQUEST['view_package'])) {
         require_once 'modules/DynamicFields/DynamicField.php';
         if (!empty($_REQUEST['view_module'])) {
             $module = $_REQUEST['view_module'];
             $df = new DynamicField($module);
             $class_name = $GLOBALS['beanList'][$module];
             require_once $GLOBALS['beanFiles'][$class_name];
             $mod = new $class_name();
             $df->setup($mod);
             $field->save($df);
             $this->action_SaveLabel();
             include_once 'modules/Administration/QuickRepairAndRebuild.php';
             global $mod_strings;
             $mod_strings['LBL_ALL_MODULES'] = 'all_modules';
             $repair = new RepairAndClear();
             $repair->show_output = false;
             $repair->module_list = array($class_name);
             $repair->clearVardefs();
             //#28707 ,clear all the js files in cache
             $repair->module_list = array();
             $repair->clearJsFiles();
         }
     } else {
         $mb = new ModuleBuilder();
         $module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
         $field->save($module);
         $module->mbvardefs->save();
         // get the module again to refresh the labels we might have saved with the $field->save (e.g., for address fields)
         $module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
         if (isset($_REQUEST['label']) && isset($_REQUEST['labelValue'])) {
             $module->setLabel($GLOBALS['current_language'], $_REQUEST['label'], $_REQUEST['labelValue']);
         }
         $module->save();
     }
     $this->view = 'modulefields';
 }
 /**
  * Clean up the Cache
  */
 protected function cleanUp()
 {
     // clear out any js cache, as the reports will screw up if they are not cleared
     require_once "modules/Administration/QuickRepairAndRebuild.php";
     $rac = new RepairAndClear();
     $rac->clearJsFiles();
 }
Example #14
0
global $unzip_dir;
global $path;
global $sugar_config;
if ($unzip_dir == null) {
    $unzip_dir = $_SESSION['unzip_dir'];
}
//First repair the databse to ensure it is up to date with the new vardefs/tabledefs
logThis('About to repair the database.', $path);
//Use Repair and rebuild to update the database.
global $dictionary, $beanFiles;
require_once 'modules/Trackers/TrackerManager.php';
$trackerManager = TrackerManager::getInstance();
$trackerManager->pause();
$trackerManager->unsetMonitors();
require_once "modules/Administration/QuickRepairAndRebuild.php";
$rac = new RepairAndClear();
$rac->clearVardefs();
$rac->rebuildExtensions();
//bug: 44431 - defensive check to ensure the method exists since upgrades to 6.2.0 may not have this method define yet.
if (method_exists($rac, 'clearExternalAPICache')) {
    $rac->clearExternalAPICache();
}
$repairedTables = array();
foreach ($beanFiles as $bean => $file) {
    if (file_exists($file)) {
        require_once $file;
        unset($GLOBALS['dictionary'][$bean]);
        $focus = new $bean();
        if ($focus instanceof SugarBean) {
            if (!isset($repairedTables[$focus->table_name])) {
                $sql = $GLOBALS['db']->repairTable($focus, true);
 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");
 }
Example #16
0
 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;
 }
Example #17
0
    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;
    }
Example #18
0
require_once 'include/utils/layout_utils.php';
$GLOBALS['db'] = DBManagerFactory::getInstance();
$current_language = $sugar_config['default_language'];
// disable the SugarLogger
$sugar_config['logger']['level'] = 'fatal';
$GLOBALS['sugar_config']['default_permissions'] = array('dir_mode' => 02770, 'file_mode' => 0777, 'chown' => '', 'chgrp' => '');
$GLOBALS['js_version_key'] = 'testrunner';
if (!isset($_SERVER['SERVER_SOFTWARE'])) {
    $_SERVER["SERVER_SOFTWARE"] = 'PHPUnit';
}
// helps silence the license checking when running unit tests.
$_SESSION['VALIDATION_EXPIRES_IN'] = 'valid';
$GLOBALS['startTime'] = microtime(true);
// clean out the cache directory
require_once 'modules/Administration/QuickRepairAndRebuild.php';
$repair = new RepairAndClear();
$repair->module_list = array();
$repair->show_output = false;
$repair->clearJsLangFiles();
$repair->clearJsFiles();
// mark that we got by the admin wizard already
$focus = new Administration();
$focus->retrieveSettings();
$focus->saveSetting('system', 'adminwizard', 1);
// include the other test tools
require_once 'SugarTestObjectUtilities.php';
require_once 'SugarTestProjectUtilities.php';
require_once 'SugarTestProjectTaskUtilities.php';
require_once 'SugarTestUserUtilities.php';
require_once 'SugarTestEmailAddressUtilities.php';
require_once 'SugarTestLangPackCreator.php';
Example #19
0
 /**
  * Takes in the request params from a save request and processes
  * them for the save.
  *
  * @param REQUEST params  $params
  */
 function saveDropDown($params)
 {
     $count = 0;
     $dropdown = array();
     $dropdown_name = $params['dropdown_name'];
     $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
     $my_list_strings = return_app_list_strings_language($selected_lang);
     while (isset($params['slot_' . $count])) {
         $index = $params['slot_' . $count];
         $key = isset($params['key_' . $index]) ? SugarCleaner::stripTags($params['key_' . $index]) : 'BLANK';
         $value = isset($params['value_' . $index]) ? SugarCleaner::stripTags($params['value_' . $index]) : '';
         if ($key == 'BLANK') {
             $key = '';
         }
         $key = trim($key);
         $value = trim($value);
         if (empty($params['delete_' . $index])) {
             $dropdown[$key] = $value;
         }
         $count++;
     }
     if ($selected_lang == $GLOBALS['current_language']) {
         $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
     }
     $contents = return_custom_app_list_strings_file_contents($selected_lang);
     //get rid of closing tags they are not needed and are just trouble
     $contents = str_replace("?>", '', $contents);
     if (empty($contents)) {
         $contents = "<?php";
     }
     //add new drop down to the bottom
     if (!empty($params['use_push'])) {
         //this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed
         foreach ($dropdown as $key => $value) {
             //only if the value has changed or does not exist do we want to add it this way
             if (!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0) {
                 //clear out the old value
                 $pattern_match = '/\\s*\\$app_list_strings\\s*\\[\\s*\'' . $dropdown_name . '\'\\s*\\]\\[\\s*\'' . $key . '\'\\s*\\]\\s*=\\s*[\'\\"]{1}.*?[\'\\"]{1};\\s*/ism';
                 $contents = preg_replace($pattern_match, "\n", $contents);
                 //add the new ones
                 $contents .= "\n\$app_list_strings['{$dropdown_name}']['{$key}']=" . var_export_helper($value) . ";";
             }
         }
     } else {
         //clear out the old value
         $pattern_match = '/\\s*\\$app_list_strings\\s*\\[\\s*\'' . $dropdown_name . '\'\\s*\\]\\s*=\\s*array\\s*\\([^\\)]*\\)\\s*;\\s*/ism';
         $contents = preg_replace($pattern_match, "\n", $contents);
         //add the new ones
         $contents .= "\n\$app_list_strings['{$dropdown_name}']=" . var_export_helper($dropdown) . ";";
     }
     // Bug 40234 - If we have no contents, we don't write the file. Checking for "<?php" because above it's set to that if empty
     if ($contents != "<?php") {
         save_custom_app_list_strings_contents($contents, $selected_lang);
         sugar_cache_reset();
     }
     // Bug38011
     $repairAndClear = new RepairAndClear();
     $repairAndClear->module_list = array(translate('LBL_ALL_MODULES'));
     $repairAndClear->show_output = false;
     $repairAndClear->clearJsLangFiles();
     // ~~~~~~~~
 }
Example #20
0
 public function action_popupSave()
 {
     $this->view = 'popupview';
     $packageName = isset($_REQUEST['view_package']) && strtolower($_REQUEST['view_package']) != 'studio' ? $_REQUEST['view_package'] : null;
     $parser = ParserFactory::getParser($_REQUEST['view'], $_REQUEST['view_module'], $packageName);
     $parser->handleSave();
     // Save popupdefs too because it's used on BWC pages (related fields).
     $parser = ParserFactory::getParser(MB_POPUPLIST, $_REQUEST['view_module'], $packageName);
     $parser->handleSave();
     if (empty($packageName)) {
         include_once 'modules/Administration/QuickRepairAndRebuild.php';
         global $mod_strings;
         $mod_strings['LBL_ALL_MODULES'] = 'all_modules';
         $repair = new RepairAndClear();
         $repair->show_output = false;
         $class_name = $GLOBALS['beanList'][$_REQUEST['view_module']];
         $repair->module_list = array($class_name);
         $repair->clearTpls();
     }
 }
Example #21
0
 function handleOverride($fromParseLoggerSettings = false)
 {
     global $sugar_config, $sugar_version;
     $sc = SugarConfig::getInstance();
     $overrideArray = $this->readOverride();
     $this->previous_sugar_override_config_array = $overrideArray;
     $diffArray = deepArrayDiff($this->config, $sugar_config);
     $overrideArray = sugarArrayMergeRecursive($overrideArray, $diffArray);
     // To remember checkbox state
     if (!$this->useAuthenticationClass && !$fromParseLoggerSettings) {
         if (isset($overrideArray['authenticationClass']) && $overrideArray['authenticationClass'] == 'SAMLAuthenticate') {
             unset($overrideArray['authenticationClass']);
         }
     }
     $overideString = "<?php\n/***CONFIGURATOR***/\n";
     sugar_cache_put('sugar_config', $this->config);
     $GLOBALS['sugar_config'] = $this->config;
     //print_r($overrideArray);
     //Bug#53013: Clean the tpl cache if action menu style has been changed.
     if (isset($overrideArray['enable_action_menu']) && (!isset($this->previous_sugar_override_config_array['enable_action_menu']) || $overrideArray['enable_action_menu'] != $this->previous_sugar_override_config_array['enable_action_menu'])) {
         require_once 'modules/Administration/QuickRepairAndRebuild.php';
         $repair = new RepairAndClear();
         $repair->module_list = array();
         $repair->clearTpls();
     }
     foreach ($overrideArray as $key => $val) {
         if (in_array($key, $this->allow_undefined) || isset($sugar_config[$key])) {
             if (is_string($val) && strcmp($val, 'true') == 0) {
                 $val = true;
                 $this->config[$key] = $val;
             }
             if (is_string($val) && strcmp($val, 'false') == 0) {
                 $val = false;
                 $this->config[$key] = false;
             }
         }
         $overideString .= override_value_to_string_recursive2('sugar_config', $key, $val);
     }
     $overideString .= '/***CONFIGURATOR***/';
     $this->saveOverride($overideString);
     if (isset($this->config['logger']['level']) && $this->logger) {
         $this->logger->setLevel($this->config['logger']['level']);
     }
 }
 function build()
 {
     $modulesToBuild = array();
     if (!isset($this->relationships[$this->newRelationshipName])) {
         $GLOBALS['log']->fatal("Could not find a relationship by the name of {$this->newRelationshipName}, you will have to quick repair and rebuild to get the new relationship added.");
     } else {
         $newRel = $this->relationships[$this->newRelationshipName];
         $newRelDef = $newRel->getDefinition();
         $modulesToBuild[$newRelDef['rhs_module']] = true;
         $modulesToBuild[$newRelDef['lhs_module']] = true;
     }
     $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) {
         if ($relationship->readonly()) {
             continue;
         }
         $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) {
         if ($relationship->readonly()) {
             continue;
         }
         $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();
         $mi->install_extensions();
         $mi->install_client_files();
     }
     $GLOBALS['mod_strings'] = $MBModStrings;
     // finally, restore the ModuleBuilder mod_strings
     // Anything that runs in-process needs to reload their vardefs
     $GLOBALS['reload_vardefs'] = true;
     // save out the updated definitions so that we keep track of the change in built status
     // sending false so we don't rebuild relationshsips for a third time.
     $this->save(false);
     $mi = new ModuleInstaller();
     $mi->silent = true;
     $mi->rebuild_relationships($modulesToBuild);
     // now clear all caches so that our changes are visible
     require_once 'modules/Administration/QuickRepairAndRebuild.php';
     $rac = new RepairAndClear();
     $rac->module_list = $modulesToBuild;
     $rac->clearJsFiles();
     $rac->clearVardefs();
     $rac->clearJsLangFiles();
     $rac->clearLanguageCache();
     $rac->rebuildExtensions(array_keys($modulesToBuild));
     $rac->clearVardefs();
     foreach ($rac->module_list as $moduleName => $ignore) {
         // Now rebuild the vardefs in memory
         $bean = BeanFactory::newBean($moduleName);
         VardefManager::loadVardef($bean->module_dir, $bean->object_name, true, array('bean' => $bean));
     }
     foreach (array_keys($modulesToBuild) as $module) {
         unset($GLOBALS['dictionary'][BeanFactory::getObjectName($module)]);
     }
     SugarRelationshipFactory::rebuildCache();
     MetaDataManager::refreshLanguagesCache(array($GLOBALS['current_language']));
     MetaDataManager::refreshSectionCache(array(MetaDataManager::MM_RELATIONSHIPS));
     MetaDataManager::refreshModulesCache(array_keys($modulesToBuild));
     $GLOBALS['log']->info(get_class($this) . "->build(): finished relationship installation");
 }
Example #23
0
 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");
     }
 }
 logThis('check to see if new modules exist', $path);
 $oldModuleList = array();
 $newModuleList = array();
 include $argv[4] . '/include/modules.php';
 $oldModuleList = $moduleList;
 include $newtemplate_path . '/include/modules.php';
 $newModuleList = $moduleList;
 ///    RELOAD NEW DEFINITIONS
 global $ACLActions, $beanList, $beanFiles;
 include $newtemplate_path . '/modules/ACLActions/actiondefs.php';
 //First repair the databse to ensure it is up to date with the new vardefs/tabledefs
 logThis('About to repair the database.', $path);
 //Use Repair and rebuild to update the database.
 global $dictionary;
 require_once $newtemplate_path . '/modules/Administration/QuickRepairAndRebuild.php';
 $rac = new RepairAndClear();
 $rac->clearVardefs();
 $rac->rebuildExtensions();
 $repairedTables = array();
 //Force vardefs to be reloaded
 $GLOBALS['reload_vardefs'] = true;
 foreach ($beanFiles as $bean => $file) {
     if (file_exists($newtemplate_path . '/' . $file) && $bean != 'UpgradeHistory') {
         unset($GLOBALS['dictionary'][$bean]);
         require_once $newtemplate_path . '/' . $file;
         $focus = new $bean();
         if (empty($focus->table_name) || isset($repairedTables[$focus->table_name])) {
             continue;
         }
         if ($focus instanceof SugarBean) {
             $sql = $db->repairTable($focus, true);
Example #25
0
<?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);
Example #26
0
 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");
     }
 }
 }
 //check to see if we delete empty language files
 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));
Example #28
0
 function action_popupSave()
 {
     $this->view = 'popupview';
     $packageName = isset($_REQUEST['view_package']) && strtolower($_REQUEST['view_package']) != 'studio' ? $_REQUEST['view_package'] : null;
     require_once 'modules/ModuleBuilder/parsers/ParserFactory.php';
     $parser = ParserFactory::getParser($_REQUEST['view'], $_REQUEST['view_module'], $packageName);
     $parser->handleSave();
     if (empty($packageName)) {
         include_once 'modules/Administration/QuickRepairAndRebuild.php';
         global $mod_strings;
         $mod_strings['LBL_ALL_MODULES'] = 'all_modules';
         $repair = new RepairAndClear();
         $repair->show_output = false;
         $class_name = $GLOBALS['beanList'][$_REQUEST['view_module']];
         $repair->module_list = array($class_name);
         $repair->clearTpls();
     }
 }
Example #29
0
/**
 * We need to clear all the js cache files, including the js language files  in serval places in MB. So I extract them into a util function here.
 * @Depends on QuickRepairAndRebuild.php
 * @Relate bug 30642  ,23177
 */
function clearAllJsAndJsLangFilesWithoutOutput()
{
    global $current_language, $mod_strings;
    $MBmodStrings = $mod_strings;
    $mod_strings = return_module_language($current_language, 'Administration');
    include_once 'modules/Administration/QuickRepairAndRebuild.php';
    $repair = new RepairAndClear();
    $repair->module_list = array();
    $repair->show_output = false;
    $repair->clearJsLangFiles();
    $repair->clearJsFiles();
    $mod_strings = $MBmodStrings;
}
 * 
 * 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;