$options->cmd = UpgradeHandler::CMD_RUN_SPECIFIC;
$options->uuid = strtolower(str_replace('-', '', $opt['r']));
}
$options->verbosity = isset($opt['v']);
$options->interactive = isset($opt['i']);
if (isset($opt['help']) || isset($opt['h'])) {
$showusage();
}
if (isset($opt['n']) || isset($opt['new'])) {
$template = UpgradeHandler::getPathToUpdates() . '/Template.php';
if (!is_readable($template)) {
$console->error('Could not open template file for reading ' . $template);
exit;
}
$released = gmdate('YmdHis');
$pathname = UpgradeHandler::getPathToUpdates() . '/Update' . $released . '.php';
$tpl = PhpTemplate::load($template, array('upd_released' => $released, 'upd_uuid' => \Scalr::GenerateUID()));
if ($console->confirm("Are you sure you want to create a new upgrade class?")) {
if (file_put_contents($pathname, $tpl) === false) {
$console->error('Could not write to file "%s"', $pathname);
exit;
}
$console->success('Upgrade class "%s" has been successfully created.', realpath($pathname));
}
exit;
}
if (isset($opt['force'])) {
UpgradeHandler::removePid();
}
$upgrade = new UpgradeHandler($options);
if (!$upgrade->run()) {