winter/modules/system/console/OctoberDown.php
2014-10-18 11:58:50 +02:00

76 lines
1.6 KiB
PHP

<?php namespace System\Console;
use Illuminate\Console\Command;
use System\Classes\UpdateManager;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class OctoberDown extends Command
{
use \Illuminate\Console\ConfirmableTrait;
/**
* The console command name.
*/
protected $name = 'october:down';
/**
* The console command description.
*/
protected $description = 'Destroys all database tables for October and all plugins.';
/**
* Create a new command instance.
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function fire()
{
if (!$this->confirmToProceed('This will DESTROY all database tables.')) {
return;
}
$manager = UpdateManager::instance()->resetNotes()->uninstall();
foreach ($manager->getNotes() as $note) {
$this->output->writeln($note);
}
}
/**
* Get the console command arguments.
*/
protected function getArguments()
{
return [];
}
/**
* Get the console command options.
*/
protected function getOptions()
{
return [
['force', null, InputOption::VALUE_NONE, 'Force the operation to run.'],
];
}
/**
* Get the default confirmation callback.
* @return \Closure
*/
protected function getDefaultConfirmCallback()
{
return function () {
return true;
};
}
}