set_time_limit(0); $defaultExclude = array("#/\\.sass-cache(/|\$)#", "#/\\.sencha-backup(/|\$)#", "#/\\.emergence(/|\$)#"); if (empty($_GET['dumpWorkspace'])) { Benchmark::startLive(); } // get app name if (empty($_REQUEST['name'])) { die('Parameter name required'); } $appName = $_REQUEST['name']; $App = new Sencha_App($appName); Benchmark::mark("configured request: appName={$appName}"); // get framework $framework = $App->getFramework(); $frameworkVersion = $App->getFrameworkVersion(); $cmdVersion = $App->getBuildCfg('app.cmd.version'); if (!$frameworkVersion) { die("Unable to determine framework version, if this is an old application you need to manually set app.framework.version in .sencha/app/sencha.cfg"); } if (!$cmdVersion) { die("Unable to determine CMD version, if this is an old application you need to manually set app.cmd.version in .sencha/app/sencha.cfg"); } // set paths $workspacePath = 'sencha-workspace'; $workspaceConfigPath = "{$workspacePath}/.sencha"; $frameworkPath = "{$workspacePath}/{$framework}-{$frameworkVersion}"; $packagesPath = "{$workspacePath}/packages"; $appPath = "{$workspacePath}/{$appName}"; $buildPath = "sencha-build/{$appName}/production"; // get temporary directory and set paths $tmpPath = Emergence_FS::getTmpDir();
$cachedFiles = Emergence_FS::cacheTree($packagesPath); Benchmark::mark("precached {$packagesPath}"); $exportResult = Emergence_FS::exportTree($packagesPath, $packagesTmpPath); Benchmark::mark("exported {$packagesPath} to {$packagesTmpPath}: " . http_build_query($exportResult)); // ... framework $cachedFiles = Emergence_FS::cacheTree($frameworkPath); Benchmark::mark("precached {$frameworkPath}"); $exportResult = Emergence_FS::exportTree($frameworkPath, $frameworkTmpPath); Benchmark::mark("exported {$frameworkPath} to {$frameworkTmpPath}: " . http_build_query($exportResult)); // ... app $cachedFiles = Emergence_FS::cacheTree($appPath); Benchmark::mark("precached {$appPath}"); $exportResult = Emergence_FS::exportTree($appPath, $appTmpPath); Benchmark::mark("exported {$appPath} to {$appTmpPath}: " . http_build_query($exportResult)); // write any libraries from classpath $classPaths = explode(',', $App->getBuildCfg('app.classpath')); foreach ($classPaths as $classPath) { if (substr($classPath, 0, 2) == 'x/') { $classPathSource = 'ext-library' . substr($classPath, 1); $cachedFiles = Emergence_FS::cacheTree($classPathSource); Benchmark::mark("precached {$cachedFiles} files from {$classPathSource}"); $exportResult = Emergence_FS::exportTree($classPathSource, "{$appTmpPath}/{$classPath}"); Benchmark::mark("exported {$classPathSource} to {$appTmpPath}/{$classPath}: " . http_build_query($exportResult)); } } // change into app's directory chdir($appTmpPath); Benchmark::mark("chdir to: {$appTmpPath}"); // prepare and run upgrade command $upgradeCmd = Sencha::buildCmd($cmdVersion, 'app upgrade --noframework'); Benchmark::mark("running upgrade CMD: {$upgradeCmd}");
if (empty($_REQUEST['name'])) { die('Parameter name required'); } $appName = $_REQUEST['name']; $App = new Sencha_App($appName); // get build type if (empty($_REQUEST['buildType'])) { $buildType = 'production'; } else { $buildType = $_REQUEST['buildType']; } Benchmark::mark("configured request: appName={$appName}"); // get framework $framework = $App->getFramework(); $frameworkVersion = $App->getFrameworkVersion(); $cmdVersion = $App->getBuildCfg('app.cmd.version'); if (!$frameworkVersion) { die("Unable to determine framework version, if this is an old application you need to manually set app.framework.version in .sencha/app/sencha.cfg"); } if (!$cmdVersion) { die("Unable to determine CMD version, if this is an old application you need to manually set app.cmd.version in .sencha/app/sencha.cfg"); } // get app-level classpath $classPaths = array_unique(array_filter(array_merge(explode(',', $App->getBuildCfg('app.classpath')), explode(',', Sencha::getWorkspaceCfg('workspace.classpath'))))); // set paths $workspacePath = 'sencha-workspace'; $workspaceConfigPath = "{$workspacePath}/.sencha"; $frameworkPath = "{$workspacePath}/{$framework}-{$frameworkVersion}"; $packagesPath = "{$workspacePath}/packages"; $appPath = "{$workspacePath}/{$appName}"; $archivePath = "sencha-build/{$appName}/archive";