Requests
Enhance admin/upgrade cli to allow it to run non-interactive
Under Consideration
When running php /path/to/index.php admin/upgrade it is not possible to call the command from a non-interactive shell - I'd like to be able to run this process non-interactively as part of our deployment plan from our git repo.
You can't vote. Please authorize!
You can't vote. Please authorize!
You can't vote. Please authorize!
You can't vote. Please authorize!

I like this idea
here's one suggested method to make this work (that I've tested successfully)
update admin_upgrade.php:136-140 from
$this->Console->output('Upgrade from ' . $this->database_version . ' to ' . $this->file_version . '? (Y/N): ');
if (strtolower(substr($this->Console->getLine(), 0, 1)) != 'y') {
$this->Console->output("Upgrade will not be performed. Goodbye.\n");
exit;
}
to: -----------------------------------
if ((function_exists('posix_isatty') && posix_isatty(STDIN)) || !function_exists('posix_isatty')) {
$this->Console->output('Upgrade from ' . $this->database_version . ' to ' . $this->file_version . '? (Y/N): ');
if (strtolower(substr($this->Console->getLine(), 0, 1)) != 'y') {
$this->Console->output("Upgrade will not be performed. Goodbye.\n");
exit;
}
} else {
$this->Console->output('Running non-interactive upgrade from ' . $this->database_version . ' to ' . $this->file_version . '. ');
}
and finally - an untested addition that includes windows interactive mode detection
if (
(function_exists('posix_isatty') && posix_isatty(STDIN)) ||
(
!function_exists('posix_isatty') && ((function_exists('stream_isatty') && stream_isatty(STDIN)) || !function_exists('stream_isatty'))
)
) {
$this->Console->output('Upgrade from ' . $this->database_version . ' to ' . $this->file_version . '? (Y/N): ');
if (strtolower(substr($this->Console->getLine(), 0, 1)) != 'y') {
$this->Console->output("Upgrade will not be performed. Goodbye.\n");
exit;
}
} else {
$this->Console->output('Running non-interactive upgrade from ' . $this->database_version . ' to ' . $this->file_version . '. ');
}
Comments have been locked on this page!