diff --git a/app/Console/Commands/MonthlyRequestsGather.php b/app/Console/Commands/MonthlyRequestsGather.php index f2cbb06c0ba36bf144d1b876e782b9c3bf1743b1..ef9b138a816e43f389360c7b36f8efd94a1ae8a0 100644 --- a/app/Console/Commands/MonthlyRequestsGather.php +++ b/app/Console/Commands/MonthlyRequestsGather.php @@ -64,7 +64,7 @@ class MonthlyRequestsGather extends Command $this->disableOverusedEngines($sumaFile, $sumas); $this->disableOverusedEngines($sumaEnFile, $sumasEn); - + DB::disconnect('mysql'); } } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 0e5b83e3537b4e08257ec5dc00e36d4614c15fa2..c3bb802d43f4c09ba36579fc7d28580a8231090d 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -29,12 +29,14 @@ class Kernel extends ConsoleKernel $schedule->call(function () { DB::table('monthlyrequests')->truncate(); + DB::disconnect('mysql'); })->monthlyOn(1, '00:00'); // Delete all of the old humanverification entries $schedule->call(function () { DB::delete('DELETE FROM humanverification WHERE updated_at < (now() - interval 72 hour) AND whitelist = 0 ORDER BY updated_at DESC'); DB::delete('DELETE FROM humanverification WHERE updated_at < (now() - interval 2 week) AND whitelist = 1 ORDER BY updated_at DESC'); + DB::disconnect('mysql'); })->everyThirtyMinutes(); } diff --git a/app/Http/Controllers/HumanVerification.php b/app/Http/Controllers/HumanVerification.php index cd46d78e016ec18315e7bb844a8b74119f9f2da1..2498a09f113d1d11fb41631aa6feb8fc70987b45 100644 --- a/app/Http/Controllers/HumanVerification.php +++ b/app/Http/Controllers/HumanVerification.php @@ -51,6 +51,7 @@ class HumanVerification extends Controller ->with('id', $id) ->with('url', $url) ->with('image', $captcha["img"]); + } public static function remove(Request $request) diff --git a/app/Http/Controllers/StartpageController.php b/app/Http/Controllers/StartpageController.php index 3e77346481630f7a250ab32ed65be9bd5b3bec76..e3288540ff25caba05778dd8920ee2030dacc934 100644 --- a/app/Http/Controllers/StartpageController.php +++ b/app/Http/Controllers/StartpageController.php @@ -48,6 +48,7 @@ class StartpageController extends Controller $sponsors = []; try { $sponsors = DB::table('sponsorenlinks')->where('langcode', 'de')->orderByRaw('LENGTH(linktext)', 'ASC')->get(); + DB::disconnect('mysql'); } catch (\Illuminate\Database\QueryException $e) { Log::info($e); } diff --git a/app/Http/Middleware/HumanVerification.php b/app/Http/Middleware/HumanVerification.php index ee1ceb335ac8e0f52e9760cecd08bf9682845fc2..56ee27b6949159a4d6c27de3f5404573f01833d2 100644 --- a/app/Http/Middleware/HumanVerification.php +++ b/app/Http/Middleware/HumanVerification.php @@ -126,10 +126,8 @@ class HumanVerification # The user currently isn't locked # We have different security gates: - # 50, 75, 85, >=90 => Captcha validated Result Pages + # 50 and then every 25 => Captcha validated Result Pages # If the user shows activity on our result page the counter will be deleted - # Maybe I'll add a ban if the user reaches 100 - if ($user["unusedResultPages"] === 50 || ($user["unusedResultPages"] > 50 && $user["unusedResultPages"] % 25 === 0)) { $user["locked"] = true; } @@ -138,8 +136,8 @@ class HumanVerification } catch (\Illuminate\Database\QueryException $e) { // Failure in contacting metager3.de } finally { - // Update the user in the database if ($update) { + // Update the user in the database if ($newUser) { DB::table('humanverification')->insert( [ @@ -168,8 +166,10 @@ class HumanVerification ); } } + DB::disconnect('mysql'); } $request->request->add(['verification_id' => $user["uid"], 'verification_count' => $user["unusedResultPages"]]); return $next($request); + } } diff --git a/config/database.php b/config/database.php index cfa1f15ee721b7e71d632acbf43dfc7bc443f37c..891fb9238df9dfe845c28f80e786b75ce453386f 100644 --- a/config/database.php +++ b/config/database.php @@ -48,7 +48,7 @@ return [ 'sqlite' => [ 'driver' => 'sqlite', - 'database' => database_path(env('DB_DATABASE', 'database.sqlite')), + 'database' => database_path(env('SQLITE_DATABASE', 'database.sqlite')), 'prefix' => '', ], diff --git a/config/queue.php b/config/queue.php index d3bc74f4c0bd1b4df78c532edde308243fddc5c6..81de65edac43bdaf9f7f848bd0ffc5278d805bcd 100644 --- a/config/queue.php +++ b/config/queue.php @@ -9,7 +9,7 @@ return [ | API, giving you convenient access to each back-end using the same | syntax for every one. Here you may define a default connection. | - */ + */ 'default' => env('QUEUE_CONNECTION', 'sync'), /* |-------------------------------------------------------------------------- @@ -22,7 +22,7 @@ return [ | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" | - */ + */ 'connections' => [ 'sync' => [ 'driver' => 'sync', @@ -64,9 +64,9 @@ return [ | can control which database and table are used to store the jobs that | have failed. You may change them to any database / table you wish. | - */ + */ 'failed' => [ - 'database' => env('DB_CONNECTION', 'mysql'), + 'database' => 'sqlite', 'table' => 'failed_jobs', ], -]; \ No newline at end of file +];