Update console commands

This commit is contained in:
DariusIII
2019-03-03 17:38:17 +01:00
parent fef52a8262
commit 7941f9592b
6 changed files with 17 additions and 21 deletions
+2
View File
@@ -1,3 +1,5 @@
2019-03-03 DariusIII
* Chg: Update console commands
2019-03-02 DariusIII
* Chg: Update code style on AniDB processing class
* Chg: Update code style of adult processing classes
+4 -4
View File
@@ -73,9 +73,9 @@ class InstallNntmux extends Command
}
$this->info('Migrating tables and seeding them with initial data');
if (config('app.env') !== 'production') {
$this->call('migrate:fresh', ['--seed' => true]);
$this->call('migrate:fresh --seed');
} else {
$this->call('migrate:fresh', ['--force' => true, '--seed' => true]);
$this->call('migrate:fresh --force --seed');
}
$paths = $this->updatePaths();
@@ -93,7 +93,7 @@ class InstallNntmux extends Command
if (! $error && $this->addAdminUser()) {
File::put(base_path().'/_install/install.lock', 'application install locked on '.now());
$this->info('Generating application key');
$this->call('key:generate', ['--force' => true]);
$this->call('key:generate --force');
$this->info('NNTmux installation completed successfully');
exit();
}
@@ -166,7 +166,7 @@ class InstallNntmux extends Command
$this->info('Adding admin user to database');
try {
User::add(config('nntmux.admin_username'), config('nntmux.admin_password'), config('nntmux.admin_email'), 2, '', '', '', '');
User::where('username', config('nntmux.admin_username'))->update(['verified' => 1]);
User::where('username', config('nntmux.admin_username'))->update(['verified' => 1, 'email_verified_at' => now()]);
} catch (\Throwable $e) {
echo $e->getMessage();
$this->error('Unable to add admin user!');
+2 -3
View File
@@ -14,15 +14,14 @@ class NntmuxResetTruncate extends Command
*
* @var string
*/
protected $signature = 'nntmux:reset-truncate {type}';
protected $signature = 'nntmux:reset-truncate';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This command removes releases with no NZBs, resets all groups, truncates or drops(tpg)
article tables. All other releases are left alone.';
protected $description = 'This command removes releases with no NZBs, resets all groups, truncates article tables. All other releases are left alone.';
/**
* Create a new command instance.
+7 -12
View File
@@ -44,7 +44,7 @@ class UpdateNNTmux extends Command
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
$maintenance = $this->appDown();
$running = $this->stopTmux();
@@ -78,7 +78,7 @@ class UpdateNNTmux extends Command
}
if ($maintenance === true) {
$this->appUp();
$this->call('up');
}
if ($running === true) {
$this->startTmux();
@@ -88,9 +88,9 @@ class UpdateNNTmux extends Command
/**
* @return bool
*/
private function appDown()
private function appDown(): bool
{
if (App::isDownForMaintenance() === false) {
if ($this->appDown() === false) {
$this->call('down');
return true;
@@ -99,18 +99,13 @@ class UpdateNNTmux extends Command
return false;
}
private function appUp()
{
$this->call('up');
}
/**
* @return bool
*/
private function stopTmux()
private function stopTmux(): bool
{
if ((new Tmux())->isRunning() === true) {
$this->call('tmux-ui:stop', ['--kill' => true]);
$this->call('tmux-ui:stop --kill');
return true;
}
@@ -118,7 +113,7 @@ class UpdateNNTmux extends Command
return false;
}
private function startTmux()
private function startTmux(): void
{
$this->call('tmux-ui:start');
}
+1 -1
View File
@@ -35,7 +35,7 @@ class UpdateNNTmuxDB extends Command
if (config('app.env') !== 'production') {
$this->call('migrate');
} else {
$this->call('migrate', ['--force' => true]);
$this->call('migrate --force=true');
}
}
}
+1 -1
View File
@@ -46,7 +46,7 @@ class UpdateNNTmuxGit extends Command
if ((new Tmux())->isRunning() === true) {
$wasRunning = true;
$this->call('tmux-ui:stop', ['--kill' => true]);
$this->call('tmux-ui:stop --kill');
}
$this->info('Getting changes from Github');
$result = $this->git->gitPull();