示例#1
0
/**
 * clearHelpFiles
 * This method attempts to delete all English inline help files.
 * This method was introduced by 5.5.0RC2.
 */
function clearHelpFiles()
{
    $modulePath = clean_path(getcwd() . '/modules');
    $allHelpFiles = array();
    getFiles($allHelpFiles, $modulePath, "/en_us.help.*/");
    foreach ($allHelpFiles as $the_file) {
        if (is_file($the_file)) {
            unlink($the_file);
            _logThis("Deleted file: {$the_file}", $path);
        }
    }
}
示例#2
0
             include $file;
             post_install();
             //set process to done
             $progArray['post_install'] = 'done';
             //set_upgrade_progress('commit','in_progress','post_install','done');
             post_install_progress($progArray, 'set');
         }
     }
     require "sugar_version.php";
     if ($_SESSION['current_db_version'] != $_SESSION['target_db_version']) {
         logThis('Performing UWrebuild()...');
         UWrebuild();
         global $sugar_version;
         $origVersion = substr(preg_replace("/[^0-9]/", "", $_SESSION['current_db_version']), 0, 3);
         if ($origVersion < '600') {
             _logThis('Check to hide iFrames and Feeds modules', $path);
             hide_iframes_and_feeds_modules();
         }
         logThis('UWrebuild() done.');
     }
     //set the logger before rebuilding config
     if (!isset($sugar_config['logger'])) {
         $sugar_config['logger'] = array('level' => 'fatal', 'file' => array('ext' => '.log', 'name' => 'sugarcrm', 'dateFormat' => '%c', 'maxSize' => '10MB', 'maxLogs' => 10, 'suffix' => '%m_%Y'));
     }
     // Set the default max tabs to 7
     $sugar_config['default_max_tabs'] = '7';
     if (!rebuildConfigFile($sugar_config, $sugar_version)) {
         logThis('*** ERROR: could not write config.php! - upgrade will fail!');
         $errors[] = $mod_strings['ERR_UW_CONFIG_WRITE'];
     }
 }
function _run_sql_file($filename)
{
    global $path;
    if (!is_file($filename)) {
        _logThis("*** ERROR: Could not find file: {$filename}", $path);
        return false;
    }
    $fh = fopen($filename, 'r');
    $contents = fread($fh, filesize($filename));
    fclose($fh);
    $lastsemi = strrpos($contents, ';');
    $contents = substr($contents, 0, $lastsemi);
    $queries = explode(';', $contents);
    $db = DBManagerFactory::getInstance();
    foreach ($queries as $query) {
        if (!empty($query)) {
            _logThis("Sending query: " . $query, $path);
            if ($db->dbType == 'oci8') {
            } else {
                $query_result = $db->query($query . ';', true, "An error has occured while performing db query.  See log file for details.<br>");
            }
        }
    }
    return true;
}
示例#4
0
 //upgrade the db
 ///////////////////////////////////////////////////////////////////////////////
 ////	HANDLE PREINSTALL SCRIPTS
 //if(empty($errors)) {
 $file = "{$argv[1]}/" . constant('SUGARCRM_PRE_INSTALL_FILE');
 if (is_file($file)) {
     include $file;
     logThis('Running pre_install()...', $path);
     pre_install();
     //if this is a pre 550 install, and not a flavor conversion from ce, then run
     //extra cleanup on aclroles table for tracker related records
     if ($pre_550 && !$ce_to_pro_ent) {
         _logThis("Begin remove ACL query for Trackers", $path);
         $query = " update  acl_actions set deleted = 1 where category = 'Trackers' and deleted = 0 ";
         $result = $GLOBALS['db']->query($query);
         _logThis("executed query:  {$query}", $path);
     }
     logThis('pre_install() done.', $path);
 }
 //}
 //run the 3-way merge
 if (file_exists($newtemplate_path . '/modules/UpgradeWizard/SugarMerge/SugarMerge.php')) {
     logThis('Running 3 way merge()...', $path);
     require_once $newtemplate_path . '/modules/UpgradeWizard/SugarMerge/SugarMerge.php';
     $merger = new SugarMerge($instanceUpgradePath, $argv[4] . '/', $argv[3] . '/custom');
     $merger->mergeAll();
     logThis('Finished 3 way merge()...', $path);
 }
 ///////////////////////////////////////////////////////////////////////////////
 ////	HANDLE POSTINSTALL SCRIPTS
 //if(empty($errors)) {
/**
 * Alters email_address relationship tables from the old uuid to the new uuid for 'email_addr_bean_rel' table.  This is relationship
 * linking the email address and the person bean user/lead/contact.
 * This script optionally updates the 'emails_email_addr_rel' using the $time_changed parameter as a flag.  This is the relationship
 * linking the email messages to the email address.
 * @param $old_uuid - this id is to be changed
 * @param $new_uuid - change to this id
 * @param null $time_changed (if this parameter is not set, run the query that updates 'emails_email_addr_rel' relationship table)
 */
function fix_email_address_relationships($old_uuid, $new_uuid, $time_changed = null)
{
    global $path;
    // if we have time query, we need joins
    //Relates all emails currently related to duplicates of the current email address to the first id in the array of duplicates
    if ($time_changed == null) {
        $stm_emails_email_addr = "UPDATE emails_email_addr_rel SET email_address_id='{$new_uuid}' WHERE email_address_id='{$old_uuid}'";
        _logThis($stm_emails_email_addr, $path);
        $rs = $GLOBALS['db']->query($stm_emails_email_addr);
        _logThis(' Number of row(s) changed = ' . $GLOBALS['db']->getAffectedRowCount($rs), $path);
    }
    //Relates all beans(People) currently related to duplicates of the current email address to the first id in the array of duplicates
    // it is highly unlikely that the records using this email address want the old one, so avoid making a bad guess.
    $stm_email_addr_bean = "UPDATE email_addr_bean_rel SET email_address_id='{$new_uuid}' WHERE email_address_id='{$old_uuid}'";
    _logThis($stm_email_addr_bean, $path);
    $rs = $GLOBALS['db']->query($stm_email_addr_bean);
    _logThis(' Number of row(s) changed = ' . $GLOBALS['db']->getAffectedRowCount($rs), $path);
}