Commit 7b18cd0a authored by Dominik Hebeler's avatar Dominik Hebeler

Added DB disconnections

parent 172b0fd3
...@@ -64,7 +64,7 @@ class MonthlyRequestsGather extends Command ...@@ -64,7 +64,7 @@ class MonthlyRequestsGather extends Command
$this->disableOverusedEngines($sumaFile, $sumas); $this->disableOverusedEngines($sumaFile, $sumas);
$this->disableOverusedEngines($sumaEnFile, $sumasEn); $this->disableOverusedEngines($sumaEnFile, $sumasEn);
DB::disconnect('mysql');
} }
} }
......
...@@ -29,12 +29,14 @@ class Kernel extends ConsoleKernel ...@@ -29,12 +29,14 @@ class Kernel extends ConsoleKernel
$schedule->call(function () { $schedule->call(function () {
DB::table('monthlyrequests')->truncate(); DB::table('monthlyrequests')->truncate();
DB::disconnect('mysql');
})->monthlyOn(1, '00:00'); })->monthlyOn(1, '00:00');
// Delete all of the old humanverification entries // Delete all of the old humanverification entries
$schedule->call(function () { $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 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::delete('DELETE FROM humanverification WHERE updated_at < (now() - interval 2 week) AND whitelist = 1 ORDER BY updated_at DESC');
DB::disconnect('mysql');
})->everyThirtyMinutes(); })->everyThirtyMinutes();
} }
......
...@@ -48,6 +48,7 @@ class StartpageController extends Controller ...@@ -48,6 +48,7 @@ class StartpageController extends Controller
$sponsors = []; $sponsors = [];
try { try {
$sponsors = DB::table('sponsorenlinks')->where('langcode', 'de')->orderByRaw('LENGTH(linktext)', 'ASC')->get(); $sponsors = DB::table('sponsorenlinks')->where('langcode', 'de')->orderByRaw('LENGTH(linktext)', 'ASC')->get();
DB::disconnect('mysql');
} catch (\Illuminate\Database\QueryException $e) { } catch (\Illuminate\Database\QueryException $e) {
Log::info($e); Log::info($e);
} }
......
...@@ -166,6 +166,7 @@ class HumanVerification ...@@ -166,6 +166,7 @@ class HumanVerification
); );
} }
} }
DB::disconnect('mysql');
} }
$request->request->add(['verification_id' => $user["uid"], 'verification_count' => $user["unusedResultPages"]]); $request->request->add(['verification_id' => $user["uid"], 'verification_count' => $user["unusedResultPages"]]);
return $next($request); return $next($request);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment