mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
82 lines
1.7 KiB
PHP
82 lines
1.7 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;
|
|
|
|
/**
|
|
* Console command to tear down the database.
|
|
*
|
|
* This destroys all database tables that are registered for October and all plugins.
|
|
*
|
|
* @package october\system
|
|
* @author Alexey Bobkov, Samuel Georges
|
|
*/
|
|
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 handle()
|
|
{
|
|
if (!$this->confirmToProceed('This will DESTROY all database tables.')) {
|
|
return;
|
|
}
|
|
|
|
UpdateManager::instance()
|
|
->setNotesOutput($this->output)
|
|
->uninstall()
|
|
;
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
};
|
|
}
|
|
}
|