} if (empty($argv[1])) { die("Use {$argv['0']} name (no zip or phar extension) [sugarVersion [buildNumber]]\n"); } $pathinfo = pathinfo($argv[1]); if (isset($pathinfo['extension']) && in_array($pathinfo['extension'], array('zip', 'phar'))) { $name = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $pathinfo['filename']; } else { $name = $argv[1]; } $params = array(); if (isset($argv[2])) { $params['version'] = $argv[2]; } if (isset($argv[3])) { $params['build'] = $argv[3]; } $phar = new Phar($name . '.phar'); packUpgradeWizardCli($phar, $params, $files); $stub = <<<'STUB' <?php Phar::mapPhar(); set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path()); require_once "ShadowUpgrader.php"; $upgrader = new ShadowUpgrader(); $upgrader->start(); __HALT_COMPILER(); STUB; $phar->setStub($stub); $zip = new ZipArchive(); $zip->open($name . '.zip', ZipArchive::CREATE); packUpgradeWizardCli($zip, $params, $files); $zip->close(); exit(0);
} if (empty($argv[1])) { die("Use {$argv['0']} name (no zip or phar extension) [sugarVersion [buildNumber]]\n"); } $pathinfo = pathinfo($argv[1]); if (isset($pathinfo['extension']) && in_array($pathinfo['extension'], array('zip', 'phar'))) { $name = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $pathinfo['filename']; } else { $name = $argv[1]; } $params = array(); if (isset($argv[2])) { $params['version'] = $argv[2]; } if (isset($argv[3])) { $params['build'] = $argv[3]; } $phar = new Phar($name . '.phar'); packUpgradeWizardCli($phar, $params); $stub = <<<'STUB' <?php Phar::mapPhar(); set_include_path('phar://' . __FILE__ . PATH_SEPARATOR . get_include_path()); require_once "CliUpgrader.php"; $upgrader = new CliUpgrader(); $upgrader->start(); __HALT_COMPILER(); STUB; $phar->setStub($stub); $zip = new ZipArchive(); $zip->open($name . '.zip', ZipArchive::CREATE); packUpgradeWizardCli($zip, $params); $zip->close(); exit(0);