public function testSilentUpgradeSessionVars() { require_once 'modules/UpgradeWizard/uw_utils.php'; $varsCacheFileName = sugar_cached("/silentUpgrader/silentUpgradeCache.php"); $loaded = loadSilentUpgradeVars(); $this->assertTrue($loaded, "Could not load the silent upgrade vars"); global $silent_upgrade_vars_loaded; $this->assertTrue(!empty($silent_upgrade_vars_loaded), "\$silent_upgrade_vars_loaded array should not be empty"); $set = setSilentUpgradeVar('SDizzle', 'BSnizzle'); $this->assertTrue($set, "Could not set a silent upgrade var"); $get = getSilentUpgradeVar('SDizzle'); $this->assertEquals('BSnizzle', $get, "Unexpected value when getting silent upgrade var before resetting"); $write = writeSilentUpgradeVars(); $this->assertTrue($write, "Could not write the silent upgrade vars to the cache file. Function returned false"); $this->assertFileExists($varsCacheFileName, "Cache file doesn't exist after call to writeSilentUpgradeVars()"); $output = shell_exec("php {$this->externalTestFileName}"); $this->assertEquals('BSnizzle', $output, "Running custom script didn't successfully retrieve the value"); $remove = removeSilentUpgradeVarsCache(); $this->assertTrue(empty($silent_upgrade_vars_loaded), "Silent upgrade vars variable should have been unset in removeSilentUpgradeVarsCache() call"); $this->assertFileNotExists($varsCacheFileName, "Cache file exists after call to removeSilentUpgradeVarsCache()"); $get = getSilentUpgradeVar('SDizzle'); $this->assertNotEquals('BSnizzle', $get, "Unexpected value when getting silent upgrade var after resetting"); }
} $fielddefs = $meta['fields']; $indices = $meta['indices']; $sql = $GLOBALS['db']->repairTableParams($tablename, $fielddefs, $indices, true); if (!empty($sql)) { logThis($sql, $path); $repairedTables[$tablename] = true; } } logThis('database repaired', $path); logThis('Start rebuild relationships.', $path); @rebuildRelations(); logThis('End rebuild relationships.', $path); include "{$unzip_dir}/manifest.php"; $ce_to_pro_ent = isset($manifest['name']) && ($manifest['name'] == 'SugarCE to SugarPro' || $manifest['name'] == 'SugarCE to SugarEnt' || $manifest['name'] == 'SugarCE to SugarCorp' || $manifest['name'] == 'SugarCE to SugarUlt'); $sugar_version = getSilentUpgradeVar('origVersion'); if (!$sugar_version) { global $silent_upgrade_vars_loaded; logThis("Error retrieving silent upgrade var for sugar_version: cache dir is {$GLOBALS['sugar_config']['cache_dir']} -- full cache for \$silent_upgrade_vars_loaded is " . var_export($silent_upgrade_vars_loaded, true), $path); } if ($ce_to_pro_ent) { //add the global team if it does not exist $globalteam = new Team(); $globalteam->retrieve('1'); require_once $unzip_dir . '/' . $zip_from_dir . '/modules/Administration/language/en_us.lang.php'; if (isset($globalteam->name)) { echo 'Global ' . $mod_strings['LBL_UPGRADE_TEAM_EXISTS'] . '<br>'; logThis(" Finish Building Global Team", $path); } else { $globalteam->create_team("Global", $mod_strings['LBL_GLOBAL_TEAM_DESC'], $globalteam->global_team); }