mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
65 lines
1.4 KiB
PHP
65 lines
1.4 KiB
PHP
<?php namespace System\Console;
|
|
|
|
use Illuminate\Console\Command;
|
|
use System\Classes\UpdateManager;
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
|
|
/**
|
|
* Console command to tear down the database.
|
|
*
|
|
* This destroys all database tables that are registered for Winter and all plugins.
|
|
*
|
|
* @package winter\wn-system-module
|
|
* @author Alexey Bobkov, Samuel Georges
|
|
*/
|
|
class WinterDown extends Command
|
|
{
|
|
use \Illuminate\Console\ConfirmableTrait;
|
|
|
|
/**
|
|
* The console command name.
|
|
*/
|
|
protected $name = 'winter:down';
|
|
|
|
/**
|
|
* The console command description.
|
|
*/
|
|
protected $description = 'Destroys all database tables for Winter and all plugins.';
|
|
|
|
/**
|
|
* 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 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;
|
|
};
|
|
}
|
|
}
|