-
-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fixes #813 by adding a few more try-catch
- Loading branch information
Showing
6 changed files
with
86 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace App\MiddlewareFunctions; | ||
|
||
use Illuminate\Database\QueryException; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class IsInstalled | ||
{ | ||
public static function assert(): bool | ||
{ | ||
// this should not happen but you never know. | ||
// if the key is not provided AND | ||
// the database (config table exists) is set | ||
// or installed.log exists | ||
// this will generate an infinite loop. We do not want that. | ||
if (file_exists(base_path('.NO_SECURE_KEY'))) { | ||
return false; | ||
} | ||
|
||
// base safety | ||
if (file_exists(base_path('installed.log'))) { | ||
return true; | ||
} | ||
|
||
// This is the second safety: | ||
// Assume you do a "git pull" but forget to do the migration, | ||
// the installed.log will not be created!!! | ||
try { | ||
if (Schema::hasTable('configs')) { | ||
return true; | ||
} | ||
|
||
return false; | ||
} catch (QueryException $e) { | ||
return false; | ||
} | ||
} | ||
} |