Exemplo n.º 1
0
function prepSystemForUpgrade()
{
    global $sugar_config;
    global $sugar_flavor;
    global $mod_strings;
    global $current_language;
    global $subdirs;
    global $base_upgrade_dir;
    global $base_tmp_upgrade_dir;
    list($p_base_upgrade_dir, $p_base_tmp_upgrade_dir) = getUWDirs();
    ///////////////////////////////////////////////////////////////////////////////
    ////	Make sure variables exist
    if (empty($base_upgrade_dir)) {
        $base_upgrade_dir = $p_base_upgrade_dir;
    }
    if (empty($base_tmp_upgrade_dir)) {
        $base_tmp_upgrade_dir = $p_base_tmp_upgrade_dir;
    }
    sugar_mkdir($base_tmp_upgrade_dir, 0775, true);
    if (!isset($subdirs) || empty($subdirs)) {
        $subdirs = array('full', 'langpack', 'module', 'patch', 'theme');
    }
    $upgrade_progress_dir = $base_tmp_upgrade_dir;
    $upgrade_progress_file = $upgrade_progress_dir . '/upgrade_progress.php';
    if (file_exists($upgrade_progress_file)) {
        if (function_exists('get_upgrade_progress') && function_exists('didThisStepRunBefore')) {
            if (didThisStepRunBefore('end')) {
                include $upgrade_progress_file;
                unset($upgrade_config);
                unlink($upgrade_progress_file);
            }
        }
    }
    // increase the cuttoff time to 1 hour
    ini_set("max_execution_time", "3600");
    // make sure dirs exist
    if ($subdirs != null) {
        foreach ($subdirs as $subdir) {
            sugar_mkdir("{$base_upgrade_dir}/{$subdir}", 0775, true);
        }
    }
    // array of special scripts that are executed during (un)installation-- key is type of script, value is filename
    if (!defined('SUGARCRM_PRE_INSTALL_FILE')) {
        define('SUGARCRM_PRE_INSTALL_FILE', 'scripts/pre_install.php');
        define('SUGARCRM_POST_INSTALL_FILE', 'scripts/post_install.php');
        define('SUGARCRM_PRE_UNINSTALL_FILE', 'scripts/pre_uninstall.php');
        define('SUGARCRM_POST_UNINSTALL_FILE', 'scripts/post_uninstall.php');
    }
    $script_files = array("pre-install" => constant('SUGARCRM_PRE_INSTALL_FILE'), "post-install" => constant('SUGARCRM_POST_INSTALL_FILE'), "pre-uninstall" => constant('SUGARCRM_PRE_UNINSTALL_FILE'), "post-uninstall" => constant('SUGARCRM_POST_UNINSTALL_FILE'));
    // check that the upload limit is set to 6M or greater
    define('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES', 6 * 1024 * 1024);
    // 6 Megabytes
    $upload_max_filesize = ini_get('upload_max_filesize');
    $upload_max_filesize_bytes = return_bytes($upload_max_filesize);
    if ($upload_max_filesize_bytes < constant('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES')) {
        $GLOBALS['log']->debug("detected upload_max_filesize: {$upload_max_filesize}");
        $admin_strings = return_module_language($current_language, 'Administration');
        echo '<p class="error">' . $admin_strings['MSG_INCREASE_UPLOAD_MAX_FILESIZE'] . ' ' . get_cfg_var('cfg_file_path') . "</p>\n";
    }
}
Exemplo n.º 2
0
     logThis('Upgrade the sugar_version', $path);
     $sugar_config['sugar_version'] = $sugar_version;
     if ($destVersion == $origVersion) {
         require 'config.php';
     }
     if (!write_array_to_file("sugar_config", $sugar_config, "config.php")) {
         logThis('*** ERROR: could not write config.php! - upgrade will fail!', $path);
         $errors[] = 'Could not write config.php!';
     }
     logThis('post_install() done.', $path);
 }
 ///////////////////////////////////////////////////////////////////////////////
 ////	REGISTER UPGRADE
 if (empty($errors)) {
     logThis('Registering upgrade with UpgradeHistory', $path);
     if (!didThisStepRunBefore('commit', 'upgradeHistory')) {
         set_upgrade_progress('commit', 'in_progress', 'upgradeHistory', 'in_progress');
         $file_action = "copied";
         // if error was encountered, script should have died before now
         $new_upgrade = new UpgradeHistory();
         $new_upgrade->filename = $install_file;
         $new_upgrade->md5sum = md5_file($install_file);
         $new_upgrade->name = $zip_from_dir;
         $new_upgrade->description = $manifest['description'];
         $new_upgrade->type = 'patch';
         $new_upgrade->version = $sugar_version;
         $new_upgrade->status = "installed";
         $new_upgrade->manifest = !empty($_SESSION['install_manifest']) ? $_SESSION['install_manifest'] : '';
         if ($new_upgrade->description == null) {
             $new_upgrade->description = "Silent Upgrade was used to upgrade the instance";
         } else {
Exemplo n.º 3
0
if (version_compare($sugar_version, '6.7.0', '<')) {
    require_once clean_path($unzip_dir . '/scripts/upgrade_utils.php');
    require_once $unzip_dir . '/' . $zip_from_dir . '/modules/Forecasts/ForecastsDefaults.php';
    ForecastsDefaults::setupForecastSettings(true, $sugar_version, getUpgradeVersion());
    ForecastsDefaults::upgradeColumns();
    // do the config update to add the 'support' platform to any config with the category of 'portal'
    updatePortalConfigToContainPlatform();
}
// Bug 57216 - Upgrade wizard dying on metadata upgrader because needed files were
// already called but news needed to replace them. This moves the metadata upgrader
// later in the process - rgonzalez
logThis('Checking for mobile/portal metadata upgrade...');
// 6.6 metadata enhancements for portal and wireless, should only be
// handled for upgrades FROM pre-6.6 to a version POST 6.6 and MUST be
// handled AFTER inclusion of the upgrade package files
if (!didThisStepRunBefore('commit', 'upgradePortalMobileMetadata')) {
    if (version_compare($sugar_version, '6.6.0', '<')) {
        if (file_exists('modules/UpgradeWizard/SidecarUpdate/SidecarMetaDataUpgrader.php')) {
            set_upgrade_progress('commit', 'in_progress', 'upgradePortalMobileMetadata', 'in_progress');
            logThis('Sidecar Upgrade: Preparing to upgrade metadata to 6.6.0 compatibility through the silent upgrader ...');
            require_once 'modules/UpgradeWizard/SidecarUpdate/SidecarMetaDataUpgrader.php';
            // Get the sidecar metadata upgrader
            logThis('Sidecar Upgrade: Instantiating the mobile/portal metadata upgrader ...');
            $smdUpgrader = new SidecarMetaDataUpgrader();
            // Run the upgrader
            logThis('Sidecar Upgrade: Beginning the mobile/portal metadata upgrade ...');
            $smdUpgrader->upgrade();
            logThis('Sidecar Upgrade: Mobile/portal metadata upgrade complete');
            // Log failures if any
            $failures = $smdUpgrader->getFailures();
            if (!empty($failures)) {