Merge pull request #7302 from turbo124/v5-develop

Replace config:clear with optimize
This commit is contained in:
David Bomba 2022-03-18 10:33:56 +11:00 committed by GitHub
commit 901c800777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 44 deletions

View File

@ -61,10 +61,7 @@ class PostUpdate extends Command
try {
if(Ninja::isHosted())
Artisan::call('optimize');
else
Artisan::call('config:clear');
Artisan::call('optimize');
} catch (\Exception $e) {
info("I wasn't able to optimize.");

View File

@ -81,7 +81,7 @@ class SelfUpdateController extends BaseController
Artisan::call('clear-compiled');
Artisan::call('route:clear');
Artisan::call('view:clear');
Artisan::call('config:clear');
Artisan::call('optimize');
return response()->json(['message' => 'Update completed'], 200);

View File

@ -74,34 +74,6 @@ class SetupController extends Controller
return response('Oops, something went wrong. Check your logs.'); /* We should never reach this block, but just in case. */
}
// try {
// $db = SystemHealth::dbCheck($request);
// if ($db['success'] == false) {
// throw new Exception($db['message']);
// }
// } catch (Exception $e) {
// return response([
// 'message' => 'Oops, connection to database was not successful.',
// 'error' => $e->getMessage(),
// ]);
// }
// try {
// if ($request->mail_driver != 'log') {
// $smtp = SystemHealth::testMailServer($request);
// if ($smtp['success'] == false) {
// throw new Exception($smtp['message']);
// }
// }
// } catch (Exception $e) {
// return response([
// 'message' => 'Oops, connection to mail server was not successful.',
// 'error' => $e->getMessage(),
// ]);
// }
$mail_driver = $request->input('mail_driver');
$url = $request->input('url');
@ -164,15 +136,8 @@ class SetupController extends Controller
define('STDIN', fopen('php://stdin', 'r'));
/* Make sure no stale connections are cached */
DB::purge('db-ninja-01');
//DB::reconnect('db-ninja-01');
/* Run migrations */
if (!config('ninja.disable_auto_update')) {
Artisan::call('config:clear');
// Artisan::call('optimize');
}
DB::purge('mysql');
Artisan::call('optimize');
Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', ['--force' => true]);
@ -295,6 +260,30 @@ class SetupController extends Controller
}
}
public function clearCompiledCache()
{
$cacheCompiled = base_path('bootstrap/cache/compiled.php');
if (file_exists($cacheCompiled)) {
unlink ($cacheCompiled);
}
$cacheServices = base_path('bootstrap/cache/packages.php');
if (file_exists($cacheServices)) {
unlink ($cacheServices);
}
$cacheServices = base_path('bootstrap/cache/services.php');
if (file_exists($cacheServices)) {
unlink ($cacheServices);
}
$cacheRoute = base_path('bootstrap/cache/routes-v7.php');
if (file_exists($cacheRoute)) {
unlink ($cacheRoute);
}
}
public function update()
{
@ -319,7 +308,7 @@ class SetupController extends Controller
Artisan::call('clear-compiled');
Artisan::call('route:clear');
Artisan::call('view:clear');
Artisan::call('config:clear');
Artisan::call('optimize');
Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', ['--force' => true]);

View File

@ -52,7 +52,7 @@ class SchedulerCheck implements ShouldQueue
try {
Artisan::call('clear-compiled');
Artisan::call('route:clear');
Artisan::call('config:cache');
Artisan::call('optimize');
} catch (\Exception $e) {
nlog("I wasn't able to optimize.");
nlog($e->getMessage());