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"); }
// mimic standard UW by copy patch zip to appropriate dir copy($argv[1], $install_file); //// END UPGRADE PREP /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //// UPGRADE UPGRADEWIZARD $zipBasePath = "{$unzip_dir}/{$zip_from_dir}"; $uwFiles = findAllFiles("{$zipBasePath}/modules/UpgradeWizard", array()); $destFiles = array(); foreach ($uwFiles as $uwFile) { $destFile = str_replace($zipBasePath . "/", '', $uwFile); copy($uwFile, $destFile); } require_once 'modules/UpgradeWizard/uw_utils.php'; // must upgrade UW first removeSilentUpgradeVarsCache(); // Clear the silent upgrade vars - Note: Any calls to these functions within this file are removed here logThis("*** SILENT UPGRADE INITIATED.", $path); logThis("*** UpgradeWizard Upgraded ", $path); if (function_exists('set_upgrade_vars')) { set_upgrade_vars(); } if ($configOptions['db_type'] == 'mysql') { //Change the db wait_timeout for this session $now_timeout = $db->getOne("select @@wait_timeout"); logThis('Wait Timeout before change ***** ' . $now_timeout, $path); $db->query("set wait_timeout=28800"); $now_timeout = $db->getOne("select @@wait_timeout"); logThis('Wait Timeout after change ***** ' . $now_timeout, $path); } //// END UPGRADE UPGRADEWIZARD