diff --git a/app/Console/Commands/ANSIDecode.php b/app/Console/Commands/ANSIDecode.php index d0dccc8..3c66940 100644 --- a/app/Console/Commands/ANSIDecode.php +++ b/app/Console/Commands/ANSIDecode.php @@ -26,10 +26,12 @@ class ANSIDecode extends Command /** * Execute the console command. * - * @return mixed + * @return int */ - public function handle() + public function handle(): int { echo ANSI::ansi($this->argument('file')); + + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/ANSIEncode.php b/app/Console/Commands/ANSIEncode.php index 5525133..e67a95c 100644 --- a/app/Console/Commands/ANSIEncode.php +++ b/app/Console/Commands/ANSIEncode.php @@ -26,9 +26,9 @@ class ANSIEncode extends Command /** * Execute the console command. * - * @return mixed + * @return int */ - public function handle() + public function handle(): int { foreach (ANSI::binary($this->argument('file')) as $line) { foreach (str_split(bin2hex($line),2) as $y) @@ -36,5 +36,7 @@ class ANSIEncode extends Command echo "\r"; } + + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/AddressIdle.php b/app/Console/Commands/AddressIdle.php index cd4cce1..bed54e7 100644 --- a/app/Console/Commands/AddressIdle.php +++ b/app/Console/Commands/AddressIdle.php @@ -28,12 +28,10 @@ class AddressIdle extends Command /** * Execute the console command. */ - public function handle() + public function handle(): int { $do = Domain::where('name',$this->argument('domain'))->singleOrFail(); - Job::dispatchSync($do,$this->option('ftn') ? Address::findFTN($this->option('ftn')) : NULL); - - return self::SUCCESS; + return Job::dispatchSync($do,$this->option('ftn') ? Address::findFTN($this->option('ftn')) : NULL); } } \ No newline at end of file diff --git a/app/Console/Commands/Areafix/Rescan.php b/app/Console/Commands/Areafix/Rescan.php index 38a22a3..08373f4 100644 --- a/app/Console/Commands/Areafix/Rescan.php +++ b/app/Console/Commands/Areafix/Rescan.php @@ -26,10 +26,10 @@ class Rescan extends Command /** * Execute the console command. * - * @return mixed + * @return int * @throws \Exception */ - public function handle() + public function handle(): int { if (($this->argument('days')) && (! is_numeric($this->argument('days')))) throw new \Exception('Days must be numeric: '.$this->argument('days')); diff --git a/app/Console/Commands/Debug/AddressCheck.php b/app/Console/Commands/Debug/AddressCheck.php index 66b902c..1b37bf1 100644 --- a/app/Console/Commands/Debug/AddressCheck.php +++ b/app/Console/Commands/Debug/AddressCheck.php @@ -13,7 +13,7 @@ class AddressCheck extends Command protected $description = 'Check the addresses we use for a node'; - public function handle() + public function handle(): int { $o = Address::findFTN($this->argument('ftn')); @@ -29,6 +29,6 @@ class AddressCheck extends Command $this->info(sprintf('Our Address: %s',our_address($o)?->ftn)); $this->info(sprintf('- Domain Addresses: %s',our_address($o->zone->domain)->pluck('ftn4d')->join(','))); - return Command::SUCCESS; + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/Debug/AddressCheckRole.php b/app/Console/Commands/Debug/AddressCheckRole.php index ad2533a..6fb8356 100644 --- a/app/Console/Commands/Debug/AddressCheckRole.php +++ b/app/Console/Commands/Debug/AddressCheckRole.php @@ -24,7 +24,7 @@ class AddressCheckRole extends Command /** * Execute the console command. */ - public function handle() + public function handle(): int { foreach (Address::withTrashed()->with(['zone.domain'])->cursor() as $o) { // Trim the role bit from role, since we now work out a role automatically. @@ -44,5 +44,7 @@ class AddressCheckRole extends Command } } } + + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/AddressMerge.php b/app/Console/Commands/Debug/AddressMerge.php similarity index 74% rename from app/Console/Commands/AddressMerge.php rename to app/Console/Commands/Debug/AddressMerge.php index ed88c09..45f7368 100644 --- a/app/Console/Commands/AddressMerge.php +++ b/app/Console/Commands/Debug/AddressMerge.php @@ -1,6 +1,6 @@ findOrfail($this->argument('src')); $dst = Address::withTrashed()->findOrfail($this->argument('dst')); if ((! $this->option('ignore')) && ($src->system_id !== $dst->system_id) && ($src->system->name !== System::default)) { $this->error(sprintf('FTN addresses are from different systems (%s/%s)',$src->system->name,$dst->system->name)); - exit(1); + + return self::FAILURE; } if ((! $this->option('force')) && ($src->ftn !== $dst->ftn)) { $this->error(sprintf('FTN addresses are not the same (%s:%s)',$src->ftn,$dst->ftn)); - exit(1); + + return self::FAILURE; } if ($src->active) { $this->error(sprintf('Source [%s] is still active',$src->ftn)); - exit(1); + + return self::FAILURE; } DB::beginTransaction(); // Find all echomail seenbys - $x = DB::update('update echomail_seenby set address_id=? where address_id=?',[$dst->id,$src->id]); + $x = DB::update('UPDATE echomail_seenby SET address_id=? WHERE address_id=?',[$dst->id,$src->id]); $this->info(sprintf('Updated [%d] echomail seenby records',$x)); // Find all echomail paths - $x = DB::update('update echomail_path set address_id=? where address_id=?',[$dst->id,$src->id]); + $x = DB::update('UPDATE echomail_path SET address_id=? WHERE address_id=?',[$dst->id,$src->id]); $this->info(sprintf('Updated [%d] echomail path records',$x)); // Find all echomails - $x = DB::update('update echomails set fftn_id=? where fftn_id=?',[$dst->id,$src->id]); + $x = DB::update('UPDATE echomails SET fftn_id=? WHERE fftn_id=?',[$dst->id,$src->id]); $this->info(sprintf('Updated [%d] echomail source records',$x)); // Find all netmails - $x = DB::update('update netmails set fftn_id=? where fftn_id=?',[$dst->id,$src->id]); + $x = DB::update('UPDATE netmails SET fftn_id=? WHERE fftn_id=?',[$dst->id,$src->id]); $this->info(sprintf('Updated [%d] netmail source records',$x)); // Find all netmails - $x = DB::update('update netmails set tftn_id=? where tftn_id=?',[$dst->id,$src->id]); + $x = DB::update('UPDATE netmails SET tftn_id=? WHERE tftn_id=?',[$dst->id,$src->id]); $this->info(sprintf('Updated [%d] netmail destination records',$x)); // Find all nodelist - $x = DB::update('update address_nodelist set address_id=? where address_id=?',[$dst->id,$src->id]); + $x = DB::update('UPDATE address_nodelist SET address_id=? WHERE address_id=?',[$dst->id,$src->id]); $this->info(sprintf('Updated [%d] nodelist records',$x)); // Find all file seenbys - $x = DB::update('update file_seenby set address_id=? where address_id=?',[$dst->id,$src->id]); + $x = DB::update('UPDATE file_seenby SET address_id=? WHERE address_id=?',[$dst->id,$src->id]); $this->info(sprintf('Updated [%d] file seenby records',$x)); // Find all files - $x = DB::update('update files set fftn_id=? where fftn_id=?',[$dst->id,$src->id]); + $x = DB::update('UPDATE files SET fftn_id=? WHERE fftn_id=?',[$dst->id,$src->id]); $this->info(sprintf('Updated [%d] file source records',$x)); // Resubscribe echoareas try { - $x = DB::update('update address_echoarea set address_id=? where address_id=?',[$dst->id,$src->id]); + $x = DB::update('UPDATE address_echoarea SET address_id=? WHERE address_id=?',[$dst->id,$src->id]); } catch (QueryException $e) { DB::rollback(); $this->error(sprintf('You may need to remove %s:%s (%d) from echoareas',$src->ftn,$src->system->name,$src->id)); - exit(1); + + return self::FAILURE; } $this->info(sprintf('Updated [%d] echomail subscription records',$x)); // Resubscribe fileareas try { - $x = DB::update('update address_filearea set address_id=? where address_id=?',[$dst->id,$src->id]); + $x = DB::update('UPDATE address_filearea SET address_id=? WHERE address_id=?',[$dst->id,$src->id]); } catch (QueryException $e) { DB::rollback(); $this->error(sprintf('You may need to remove %s:%s (%d) from fileareas',$src->ftn,$src->system->name,$src->id)); - exit(1); + + return self::FAILURE; } $this->info(sprintf('Updated [%d] filearea subscription records',$x)); @@ -117,7 +122,7 @@ class AddressMerge extends Command } else { if ($src->forceDelete()) { - $this->alert(sprintf('%s deleted.', $src->ftn)); + $this->alert(sprintf('%s deleted.',$src->ftn)); DB::commit(); } else { @@ -126,6 +131,6 @@ class AddressMerge extends Command } } - return Command::SUCCESS; + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/EchomailDump.php b/app/Console/Commands/Debug/EchomailDump.php similarity index 71% rename from app/Console/Commands/EchomailDump.php rename to app/Console/Commands/Debug/EchomailDump.php index 815e808..962148d 100644 --- a/app/Console/Commands/EchomailDump.php +++ b/app/Console/Commands/Debug/EchomailDump.php @@ -1,6 +1,6 @@ argument('id'))); + + return self::SUCCESS; } } diff --git a/app/Console/Commands/NetmailTest.php b/app/Console/Commands/Debug/NetmailTest.php similarity index 81% rename from app/Console/Commands/NetmailTest.php rename to app/Console/Commands/Debug/NetmailTest.php index 63e249e..54f04b6 100644 --- a/app/Console/Commands/NetmailTest.php +++ b/app/Console/Commands/Debug/NetmailTest.php @@ -1,6 +1,6 @@ argument('ftn')); Notification::route('netmail',$ao)->notify(new NetmailTestNotification()); + + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/Debug/PacketAddress.php b/app/Console/Commands/Debug/PacketAddress.php index 09fa76c..f0b0ec7 100644 --- a/app/Console/Commands/Debug/PacketAddress.php +++ b/app/Console/Commands/Debug/PacketAddress.php @@ -29,10 +29,10 @@ class PacketAddress extends Command /** * Execute the console command. * - * @return mixed + * @return int * @throws \Exception */ - public function handle() + public function handle(): int { $ao = Address::findFTN($this->argument('ftn')); @@ -57,6 +57,6 @@ class PacketAddress extends Command ->generate() ); - return Command::SUCCESS; + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/SendTestEmail.php b/app/Console/Commands/Debug/SendTestEmail.php similarity index 76% rename from app/Console/Commands/SendTestEmail.php rename to app/Console/Commands/Debug/SendTestEmail.php index 460e68f..5360bb6 100644 --- a/app/Console/Commands/SendTestEmail.php +++ b/app/Console/Commands/Debug/SendTestEmail.php @@ -1,6 +1,6 @@ argument('id')); Mail::to($uo->email) ->send(new MailTest($uo)); + + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/Debug/ZoneCheck.php b/app/Console/Commands/Debug/ZoneCheck.php index e5d6e46..3a68122 100644 --- a/app/Console/Commands/Debug/ZoneCheck.php +++ b/app/Console/Commands/Debug/ZoneCheck.php @@ -14,7 +14,7 @@ class ZoneCheck extends Command protected $description = 'Check that the addresses in a zone are configured correctly'; - public function handle() + public function handle(): int { $do = Domain::where('name',$this->argument('domain'))->singleOrFail(); @@ -42,6 +42,6 @@ class ZoneCheck extends Command })); } - return Command::SUCCESS; + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/EchoareaImport.php b/app/Console/Commands/EchoareaImport.php index 75ff521..6dfb3b8 100644 --- a/app/Console/Commands/EchoareaImport.php +++ b/app/Console/Commands/EchoareaImport.php @@ -30,9 +30,9 @@ class EchoareaImport extends Command /** * Execute the console command. * - * @return mixed + * @return int */ - public function handle() + public function handle(): int { $do = Domain::where('name',strtolower($this->argument('domain')))->singleOrFail(); return Job::dispatchSync($this->argument('file'),$do,$this->option('prefix'),$this->option('unlink')); diff --git a/app/Console/Commands/FileareaImport.php b/app/Console/Commands/FileareaImport.php index bfeb07a..6832e0e 100644 --- a/app/Console/Commands/FileareaImport.php +++ b/app/Console/Commands/FileareaImport.php @@ -30,9 +30,9 @@ class FileareaImport extends Command /** * Execute the console command. * - * @return mixed + * @return int */ - public function handle() + public function handle(): int { $do = Domain::where('name',strtolower($this->argument('domain')))->singleOrFail(); return Job::dispatchSync($this->argument('file'),$do,$this->option('prefix'),$this->option('unlink')); diff --git a/app/Console/Commands/Filefix/Rescan.php b/app/Console/Commands/Filefix/Rescan.php index d191fc6..4f9b795 100644 --- a/app/Console/Commands/Filefix/Rescan.php +++ b/app/Console/Commands/Filefix/Rescan.php @@ -26,10 +26,10 @@ class Rescan extends Command /** * Execute the console command. * - * @return mixed + * @return int * @throws \Exception */ - public function handle() + public function handle(): int { $ao = Address::findFtn($this->argument('ftn')); diff --git a/app/Console/Commands/FilesList.php b/app/Console/Commands/FilesList.php index dc46414..ad6c243 100644 --- a/app/Console/Commands/FilesList.php +++ b/app/Console/Commands/FilesList.php @@ -27,7 +27,7 @@ class FilesList extends Command * * @return int */ - public function handle() + public function handle(): int { $this->table([ 'files.id' => 'ID', @@ -37,6 +37,6 @@ class FilesList extends Command ->join('fileareas',['fileareas.id'=>'files.filearea_id']) ->cursor()); - return Command::SUCCESS; + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/JobList.php b/app/Console/Commands/JobList.php index fc1b60f..03072b4 100644 --- a/app/Console/Commands/JobList.php +++ b/app/Console/Commands/JobList.php @@ -25,7 +25,7 @@ class JobList extends Command /** * Execute the console command. */ - public function handle() + public function handle(): int { $lastq = NULL; @@ -45,5 +45,7 @@ class JobList extends Command $o->attempts ? sprintf(' (Created:%s)',$o->created_at) : '' )); } + + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/MailList.php b/app/Console/Commands/MailList.php index 4026bc3..db16976 100644 --- a/app/Console/Commands/MailList.php +++ b/app/Console/Commands/MailList.php @@ -28,7 +28,7 @@ class MailList extends Command * @return int * @throws \Exception */ - public function handle() + public function handle(): int { $ao = Address::findFTN($this->argument('ftn'),TRUE); diff --git a/app/Console/Commands/NodelistImport.php b/app/Console/Commands/NodelistImport.php index 801e79a..8a0e291 100644 --- a/app/Console/Commands/NodelistImport.php +++ b/app/Console/Commands/NodelistImport.php @@ -32,9 +32,9 @@ class NodelistImport extends Command /** * Execute the console command. * - * @return mixed + * @return int */ - public function handle() + public function handle():int { try { return Job::dispatchSync( @@ -50,6 +50,8 @@ class NodelistImport extends Command } catch (\Exception $e) { $this->error($e->getMessage()); + + return self::FAILURE; } } } \ No newline at end of file diff --git a/app/Console/Commands/PacketInfo.php b/app/Console/Commands/PacketInfo.php index 7b54526..3dc885d 100644 --- a/app/Console/Commands/PacketInfo.php +++ b/app/Console/Commands/PacketInfo.php @@ -30,10 +30,10 @@ class PacketInfo extends Command /** * Execute the console command. * - * @return mixed + * @return int * @throws \App\Exceptions\InvalidPacketException */ - public function handle() + public function handle():int { $fs = Storage::disk(config('fido.local_disk')); $rel_name = sprintf('%s/%s',config('fido.dir'),$this->argument('file')); @@ -109,5 +109,7 @@ class PacketInfo extends Command $this->line("\n"); } + + return self::SUCCESS; } } diff --git a/app/Console/Commands/PacketProcess.php b/app/Console/Commands/PacketProcess.php index 019a2de..a447d13 100644 --- a/app/Console/Commands/PacketProcess.php +++ b/app/Console/Commands/PacketProcess.php @@ -58,10 +58,10 @@ class PacketProcess extends Command /** * Execute the console command. * - * @return int|void + * @return int * @throws \Exception */ - public function handle() + public function handle(): int { $rel_name = sprintf('%s/%s',config('fido.dir'),$this->argument('file')); @@ -74,7 +74,8 @@ class PacketProcess extends Command } else { $this->error('Unable to determine sender FTN address'); - exit(1); + + return self::FAILURE; } Job::dispatchSync($rel_name,$ao->zone->domain,$this->option('dontqueue')); diff --git a/app/Console/Commands/PacketSystem.php b/app/Console/Commands/PacketSystem.php index 24637ba..27ecacb 100644 --- a/app/Console/Commands/PacketSystem.php +++ b/app/Console/Commands/PacketSystem.php @@ -29,7 +29,7 @@ class PacketSystem extends Command * @return int * @throws \Exception */ - public function handle() + public function handle(): int { $ao = Address::findFTN($this->argument('ftn')); diff --git a/app/Console/Commands/ServerStart.php b/app/Console/Commands/ServerStart.php index d51c386..af13dc1 100644 --- a/app/Console/Commands/ServerStart.php +++ b/app/Console/Commands/ServerStart.php @@ -30,10 +30,10 @@ class ServerStart extends Command /** * Execute the console command. * - * @return void + * @return int * @throws SocketException */ - public function handle() + public function handle(): int { Log::info(sprintf('%s:+ Server Starting (%d)',self::LOGKEY,getmypid())); $o = Setup::findOrFail(config('app.id')); @@ -71,7 +71,7 @@ class ServerStart extends Command if (! $start->count()) { Log::alert(sprintf('%s:! No servers configured to start',self::LOGKEY)); - return; + return self::FAILURE; } pcntl_signal(SIGCHLD,SIG_IGN); @@ -105,7 +105,7 @@ class ServerStart extends Command Log::info(sprintf('%s:= Finished: [%s]',self::LOGKEY,$item)); // Child finished we need to get out of this loop. - exit; + return self::SUCCESS; } Log::debug(sprintf('%s:- Forked for [%s] (%d)',self::LOGKEY,$item,$pid)); @@ -125,5 +125,7 @@ class ServerStart extends Command // Done Log::debug(sprintf('%s:= Finished.',self::LOGKEY)); + + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/SystemHeartbeat.php b/app/Console/Commands/SystemHeartbeat.php index e7cf71b..3196ca0 100644 --- a/app/Console/Commands/SystemHeartbeat.php +++ b/app/Console/Commands/SystemHeartbeat.php @@ -27,9 +27,9 @@ class SystemHeartbeat extends Command /** * Execute the console command. */ - public function handle() + public function handle(): int { Log::info('CSH:- Triggering heartbeat to systems'); - Job::dispatchSync($this->option('force')); + return Job::dispatchSync($this->option('force')); } } \ No newline at end of file diff --git a/app/Console/Commands/TicProcess.php b/app/Console/Commands/TicProcess.php index c3712ef..0f00106 100644 --- a/app/Console/Commands/TicProcess.php +++ b/app/Console/Commands/TicProcess.php @@ -29,11 +29,9 @@ class TicProcess extends Command * * @return int */ - public function handle() + public function handle(): int { // Dispatch job. - Job::dispatchSync($this->argument('file'),$this->argument('domain')); - - return Command::SUCCESS; + return Job::dispatchSync($this->argument('file'),$this->argument('domain')); } } \ No newline at end of file diff --git a/app/Console/Commands/UserCodeSend.php b/app/Console/Commands/UserCodeSend.php index 00fb83f..4b497b4 100644 --- a/app/Console/Commands/UserCodeSend.php +++ b/app/Console/Commands/UserCodeSend.php @@ -19,14 +19,16 @@ class UserCodeSend extends Command /** * Execute the console command. * - * @return mixed + * @return int * @throws \Exception */ - public function handle() + public function handle(): int { $ao = Address::findFTN($this->argument('ftn')); $uo = User::where('email',$this->argument('email'))->singleOrFail(); Notification::route('netmail',$ao->uplink())->notify(new AddressLink($uo)); + + return self::SUCCESS; } } \ No newline at end of file diff --git a/app/Console/Commands/UserMakeAdmin.php b/app/Console/Commands/UserMakeAdmin.php index 4846ea2..f393025 100644 --- a/app/Console/Commands/UserMakeAdmin.php +++ b/app/Console/Commands/UserMakeAdmin.php @@ -27,12 +27,14 @@ class UserMakeAdmin extends Command * * @return int */ - public function handle() + public function handle(): int { $o = User::where('email',$this->argument('email'))->firstOrfail(); $o->admin = ! $o->admin; $o->save(); $this->info(sprintf('User [%s] %s an admin',$o->email,$o->admin ? 'IS' : 'is NOT')); + + return self::SUCCESS; } } diff --git a/config/laravel-console-summary.php b/config/laravel-console-summary.php index 4304cf9..f4a1117 100644 --- a/config/laravel-console-summary.php +++ b/config/laravel-console-summary.php @@ -15,28 +15,44 @@ return [ */ 'hide' => [ + 'about', + 'auth:*', 'cache:*', + 'channel:*', + 'clear-compiled', 'completion', 'config:*', 'db:*', + 'docs', 'debugbar:*', 'event:*', + 'env:*', 'ide-helper:*', + 'install:*', 'inspire', 'key:generate', + 'lang:*', 'list', 'make:*', 'migrate:*', + 'model:*', 'model:prune', 'notifications:table', 'optimize:*', 'package:discover', + 'queue:listen', + 'queue:prune-batches', + 'queue:prune-failed', + 'queue:retry', + 'queue:retry-batch', + 'queue:work', 'route:*', + 'sanctum:*', 'serve', 'schedule:*', 'schema:dump', 'session:table', - 'storage:link', + 'storage:*', 'stub:publish', 'test', 'theme:*',