Unset debug after installation

This commit is contained in:
Sergio Brighenti 2019-11-22 12:21:02 +01:00
parent 0f93a96d6b
commit 12063d4542
4 changed files with 36 additions and 33 deletions

View file

@ -8,6 +8,6 @@ class AppErrorHandler extends ErrorHandler
{
protected function logError(string $error): void
{
resolve('logger')->critical($error);
resolve('logger')->error($error);
}
}

View file

@ -19,7 +19,7 @@ class CheckForMaintenanceMiddleware extends Middleware
*/
public function __invoke(Request $request, RequestHandler $handler): Response
{
if (isset($this->config['maintenance']) && $this->config['maintenance'] && !$this->database->query('SELECT `id`, `is_admin` FROM `users` WHERE `id` = ? LIMIT 1', [$this->session->get('user_id')])->fetch()->is_admin) {
if ($this->config['maintenance'] && !$this->database->query('SELECT `id`, `is_admin` FROM `users` WHERE `id` = ? LIMIT 1', [$this->session->get('user_id')])->fetch()->is_admin) {
throw new UnderMaintenanceException($request);
}

61
composer.lock generated
View file

@ -8,16 +8,16 @@
"packages": [
{
"name": "aws/aws-sdk-php",
"version": "3.118.0",
"version": "3.121.0",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "e4600c22cb69c94d1aa65bf91af5c225f2a109fd"
"reference": "7c89b0f455d7b2b36e09080adf72861888725ba5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/e4600c22cb69c94d1aa65bf91af5c225f2a109fd",
"reference": "e4600c22cb69c94d1aa65bf91af5c225f2a109fd",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/7c89b0f455d7b2b36e09080adf72861888725ba5",
"reference": "7c89b0f455d7b2b36e09080adf72861888725ba5",
"shasum": ""
},
"require": {
@ -87,7 +87,7 @@
"s3",
"sdk"
],
"time": "2019-11-18T19:13:19+00:00"
"time": "2019-11-21T19:10:15+00:00"
},
{
"name": "firebase/php-jwt",
@ -2646,16 +2646,16 @@
},
{
"name": "nette/php-generator",
"version": "v3.2.3",
"version": "v3.3.1",
"source": {
"type": "git",
"url": "https://github.com/nette/php-generator.git",
"reference": "aea6e81437bb238e5f0e5b5ce06337433908e63b"
"reference": "4240fd7adf499138c07b814ef9b9a6df9f6d7187"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/php-generator/zipball/aea6e81437bb238e5f0e5b5ce06337433908e63b",
"reference": "aea6e81437bb238e5f0e5b5ce06337433908e63b",
"url": "https://api.github.com/repos/nette/php-generator/zipball/4240fd7adf499138c07b814ef9b9a6df9f6d7187",
"reference": "4240fd7adf499138c07b814ef9b9a6df9f6d7187",
"shasum": ""
},
"require": {
@ -2669,7 +2669,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
"dev-master": "3.3-dev"
}
},
"autoload": {
@ -2701,7 +2701,7 @@
"php",
"scaffolding"
],
"time": "2019-07-05T13:01:56+00:00"
"time": "2019-11-22T11:12:11+00:00"
},
{
"name": "nette/robot-loader",
@ -3073,27 +3073,28 @@
},
{
"name": "symfony/console",
"version": "v4.3.8",
"version": "v4.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "831424efae0a1fe6642784bd52aae14ece6538e6"
"reference": "35d9077f495c6d184d9930f7a7ecbd1ad13c7ab8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/831424efae0a1fe6642784bd52aae14ece6538e6",
"reference": "831424efae0a1fe6642784bd52aae14ece6538e6",
"url": "https://api.github.com/repos/symfony/console/zipball/35d9077f495c6d184d9930f7a7ecbd1ad13c7ab8",
"reference": "35d9077f495c6d184d9930f7a7ecbd1ad13c7ab8",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php73": "^1.8",
"symfony/service-contracts": "^1.1"
"symfony/service-contracts": "^1.1|^2"
},
"conflict": {
"symfony/dependency-injection": "<3.4",
"symfony/event-dispatcher": "<4.3",
"symfony/event-dispatcher": "<4.3|>=5",
"symfony/lock": "<4.4",
"symfony/process": "<3.3"
},
"provide": {
@ -3101,12 +3102,12 @@
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/config": "^3.4|^4.0|^5.0",
"symfony/dependency-injection": "^3.4|^4.0|^5.0",
"symfony/event-dispatcher": "^4.3",
"symfony/lock": "~3.4|~4.0",
"symfony/process": "~3.4|~4.0",
"symfony/var-dumper": "^4.3"
"symfony/lock": "^4.4|^5.0",
"symfony/process": "^3.4|^4.0|^5.0",
"symfony/var-dumper": "^4.3|^5.0"
},
"suggest": {
"psr/log": "For using the console logger",
@ -3117,7 +3118,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.3-dev"
"dev-master": "4.4-dev"
}
},
"autoload": {
@ -3144,20 +3145,20 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2019-11-13T07:29:07+00:00"
"time": "2019-11-13T07:39:40+00:00"
},
{
"name": "symfony/finder",
"version": "v4.3.8",
"version": "v4.4.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "72a068f77e317ae77c0a0495236ad292cfb5ce6f"
"reference": "ce8743441da64c41e2a667b8eb66070444ed911e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/72a068f77e317ae77c0a0495236ad292cfb5ce6f",
"reference": "72a068f77e317ae77c0a0495236ad292cfb5ce6f",
"url": "https://api.github.com/repos/symfony/finder/zipball/ce8743441da64c41e2a667b8eb66070444ed911e",
"reference": "ce8743441da64c41e2a667b8eb66070444ed911e",
"shasum": ""
},
"require": {
@ -3166,7 +3167,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.3-dev"
"dev-master": "4.4-dev"
}
},
"autoload": {
@ -3193,7 +3194,7 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2019-10-30T12:53:54+00:00"
"time": "2019-11-17T21:56:56+00:00"
},
{
"name": "symfony/polyfill-php73",

View file

@ -97,13 +97,15 @@ $app->post('/', function (Request $request, Response $response, Filesystem $stor
// Check if there is a previous installation, if not, setup the config file
$installed = true;
// disable debug in production
unset($config['debug']);
if (!file_exists(__DIR__.'/../config.php')) {
$installed = false;
// config file setup
$config['base_url'] = param($request, 'base_url');
$config['storage']['driver'] = param($request, 'storage_driver');
unset($config['debug']);
$config['db']['connection'] = param($request, 'connection');
$config['db']['dsn'] = param($request, 'dsn');
$config['db']['username'] = param($request, 'db_user');