if (is_dir($cachedir)) { $allModFiles = array(); $allModFiles = findAllFiles($cachedir, $allModFiles); foreach ($allModFiles as $file) { //$file_md5_ref = str_replace(clean_path(getcwd()),'',$file); if (file_exists($file)) { unlink($file); } } } //Also add the three-way merge here. The idea is after the 451 html files have //been converted run the 3-way merge. If 500 then just run the 3-way merge if (file_exists('modules/UpgradeWizard/SugarMerge/SugarMerge.php')) { set_upgrade_progress('end', 'in_progress', 'threewaymerge', 'in_progress'); require_once 'modules/UpgradeWizard/SugarMerge/SugarMerge.php'; $merger = new SugarMerge($zipBasePath); $merger->mergeAll(); set_upgrade_progress('end', 'in_progress', 'threewaymerge', 'done'); } /////////////////////////////////////////////////////////////////////////////// //// COPY NEW FILES INTO TARGET INSTANCE if (!didThisStepRunBefore('commit', 'commitCopyNewFiles')) { set_upgrade_progress('commit', 'in_progress', 'commitCopyNewFiles', 'in_progress'); $split = commitCopyNewFiles($unzip_dir, $zip_from_dir); $copiedFiles = $split['copiedFiles']; $skippedFiles = $split['skippedFiles']; set_upgrade_progress('commit', 'in_progress', 'commitCopyNewFiles', 'done'); } require_once clean_path($unzip_dir . '/scripts/upgrade_utils.php'); $new_sugar_version = getUpgradeVersion(); $origVersion = substr(preg_replace("/[^0-9]/", "", $sugar_version), 0, 3);
$allModFiles = array(); $allModFiles = findAllFiles($GLOBALS['sugar_config']['cache_dir'] . 'smarty', $allModFiles); foreach ($allModFiles as $file) { //$file_md5_ref = str_replace(clean_path(getcwd()),'',$file); if (file_exists($file)) { unlink($file); } } } //Also add the three-way merge here. The idea is after the 451 html files have //been converted run the 3-way merge. If 500 then just run the 3-way merge $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'); if (file_exists('modules/UpgradeWizard/SugarMerge/SugarMerge.php')) { require_once 'modules/UpgradeWizard/SugarMerge/SugarMerge.php'; if (isset($_SESSION['unzip_dir']) && isset($_SESSION['zip_from_dir']) && !isset($_SESSION['sugarMergeRunResults'])) { $merger = new SugarMerge($_SESSION['unzip_dir'] . '/' . $_SESSION['zip_from_dir']); //Perform the actual merge and store which modules were merged. We will rolllback the files if the //user determines that they did not want to upgade a particular module. $_SESSION['sugarMergeRunResults'] = $merger->mergeAll(TRUE, TRUE, TRUE); logThis('Commit step finished SugarMerge run with the following results:' . print_r($_SESSION['sugarMergeRunResults'], true)); } } //Bug #47110 if (file_exists("include/Expressions/Actions/SetValueAction.php")) { require_once "include/Expressions/Actions/SetValueAction.php"; } //COPY ALL FILES FROM UPLOADED UPGRADE PACKAGE if (!didThisStepRunBefore('commit', 'commitCopyNewFiles')) { set_upgrade_progress('commit', 'in_progress', 'commitCopyNewFiles', 'in_progress'); $split = commitCopyNewFiles($unzip_dir, $zip_from_dir); $copiedFiles = $split['copiedFiles'];
function test_project_merge() { require_once 'modules/UpgradeWizard/SugarMerge/SugarMerge.php'; $sugar_merge = new SugarMerge('tests/modules/UpgradeWizard/SugarMerge/od_metadata_files/custom'); $sugar_merge->mergeModule('Project'); $this->assertTrue(file_exists('custom/modules/Project/metadata/detailviewdefs.php.suback.php')); $this->assertTrue(file_exists('custom/modules/Project/metadata/editviewdefs.php.suback.php')); require 'custom/modules/Project/metadata/detailviewdefs.php'; $this->assertTrue(isset($viewdefs['Project']['DetailView']['panels']['lbl_panel_1']), 'Assert that the original panel index is preserved'); require 'custom/modules/Project/metadata/editviewdefs.php'; $this->assertTrue(isset($viewdefs['Project']['EditView']['panels']['default']), 'Assert that the original panel index is preserved'); }
/** * Ensure that a history item is created when SugarMerge executes and that the file contents are identical. * */ function testHistoryCreationForUpgradedMetadataFiles() { $accountsHistoryMetadataLocation = 'custom/history/modules/Accounts/metadata'; $this->clearFilesInDirectory('custom/modules/Accounts/metadata'); $this->clearFilesInDirectory($accountsHistoryMetadataLocation); $customFile = "tests/modules/UpgradeWizard/SugarMerge/od_metadata_files/610/custom/modules/Accounts/metadata/detailviewdefs.php"; $customFileTo = "custom/modules/Accounts/metadata/detailviewdefs.php"; copy($customFile, $customFileTo); require_once 'modules/UpgradeWizard/SugarMerge/SugarMerge.php'; $sugar_merge = new SugarMerge('tests/modules/UpgradeWizard/SugarMerge/od_metadata_files/610/custom'); $mergedFiles = $sugar_merge->mergeModule('Accounts'); $this->assertTrue(file_exists('custom/modules/Accounts/metadata/detailviewdefs.php'), "Custom metadata file not created."); $this->assertTrue($this->checkForHistoryRecords('Accounts')); //Ensure history file and custom file are the same. $oldCustomFile = file_get_contents($customFile); $newHistoryFile = $this->getFirstFileContentsInDirectory($accountsHistoryMetadataLocation); $this->assertEquals($oldCustomFile, $newHistoryFile, "Error previous custom file before merge and new history record are not identical."); }
$allModFiles = array(); $allModFiles = findAllFiles($cachedir, $allModFiles); foreach ($allModFiles as $file) { //$file_md5_ref = str_replace(clean_path(getcwd()),'',$file); if (file_exists($file)) { unlink($file); } } } //Also add the three-way merge here. The idea is after the 451 html files have //been converted run the 3-way merge. If 500 then just run the 3-way merge $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'); if (file_exists('modules/UpgradeWizard/SugarMerge/SugarMerge.php')) { require_once 'modules/UpgradeWizard/SugarMerge/SugarMerge.php'; if (isset($_SESSION['unzip_dir']) && isset($_SESSION['zip_from_dir']) && !isset($_SESSION['sugarMergeRunResults'])) { $merger = new SugarMerge($_SESSION['unzip_dir'] . '/' . $_SESSION['zip_from_dir']); //Perform the actual merge and store which modules were merged. We will rolllback the files if the //user determines that they did not want to upgade a particular module. $_SESSION['sugarMergeRunResults'] = $merger->mergeAll(true, true, true); logThis('Commit step finished SugarMerge run with the following results:' . print_r($_SESSION['sugarMergeRunResults'], true)); } } //Bug #47110 if (file_exists('include/Expressions/Actions/SetValueAction.php')) { require_once 'include/Expressions/Actions/SetValueAction.php'; } //COPY ALL FILES FROM UPLOADED UPGRADE PACKAGE if (!didThisStepRunBefore('commit', 'commitCopyNewFiles')) { set_upgrade_progress('commit', 'in_progress', 'commitCopyNewFiles', 'in_progress'); $split = commitCopyNewFiles($unzip_dir, $zip_from_dir); $copiedFiles = $split['copiedFiles'];