handleMGLogs(); } private function handleMGLogs() { $redis = null; $redis = Redis::connection(config('cache.stores.redis.connection')); if ($redis === null) { $this->error("No valid Redis Connection specified"); return; } $elements = []; $elementCount = $redis->llen(\App\Console\Commands\AppendLogs::LOGKEY); $elements = $redis->lpop(\App\Console\Commands\AppendLogs::LOGKEY, $elementCount); if (!is_array($elements) || sizeof($elements) <= 0) { return; } if (file_put_contents(\App\MetaGer::getMGLogFile(), implode(PHP_EOL, $elements) . PHP_EOL, FILE_APPEND) === false) { $this->error("Konnte Log Zeile(n) nicht schreiben"); $redis->lpush(\App\Console\Commands\AppendLogs::LOGKEY, array_reverse($elements)); } else { $this->info("Added " . sizeof($elements) . " lines to todays log!"); } } }