X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FConsole%2FCommands%2FChatlibDatabase.php;fp=app%2FConsole%2FCommands%2FChatlibDatabase.php;h=b701ad144b3d0aed3abc26cb481813e4347b0b4e;hb=710b9c7447f9776ce8f8e0a4ca281c17ac141a7a;hp=280d4a0c6351e29fd04a2ee0d31c4d0a68fe1712;hpb=ac6921da72ff4b0beab9e5f1308788a55aae3ad9;p=alttp.git diff --git a/app/Console/Commands/ChatlibDatabase.php b/app/Console/Commands/ChatlibDatabase.php index 280d4a0..b701ad1 100644 --- a/app/Console/Commands/ChatlibDatabase.php +++ b/app/Console/Commands/ChatlibDatabase.php @@ -28,6 +28,8 @@ class ChatlibDatabase extends Command { * @return int */ public function handle() { + $count = 0; + $de = new ChatLib(); $en = new ChatLib(); @@ -37,7 +39,7 @@ class ChatlibDatabase extends Command { ->where('created_at', '<', now()->sub(7, 'day')) ->whereNotIn('classification', ['gg', 'gl', 'number', 'o7']) ->whereRaw('LENGTH(`text_content`) > 12') - ->chunk(5000, function ($msgs) use ($de, $en) { + ->chunk(5000, function ($msgs) use (&$count, $de, $en) { foreach ($msgs as $msg) { if ($msg->detected_language === 'de') { $de->addMessage($msg); @@ -47,7 +49,9 @@ class ChatlibDatabase extends Command { $de->addMessage($msg); $en->addMessage($msg); } + ++$count; } + $this->line($count); }); $de->compile();