Merge pull request #394 from ControlPanel-gg/development

Hotfixes: Logging
This commit is contained in:
Dennis 2022-02-08 11:01:09 +01:00 committed by GitHub
commit 2afb705fe3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 208 additions and 156 deletions

View file

@ -6,7 +6,6 @@ use App\Models\Egg;
use App\Models\Nest;
use App\Models\Node;
use App\Models\Server;
use App\Models\Settings;
use Exception;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Http\Client\Response;
@ -36,9 +35,25 @@ class Pterodactyl
/**
* @return Exception
*/
private static function getException(): Exception
private static function getException(string $message = "", int $status = 0): Exception
{
return new Exception('Request Failed, is pterodactyl set-up correctly?');
if ($status == 404) {
return new Exception("Ressource does not exist on pterodactyl - " . $message, 404);
}
if ($status == 403) {
return new Exception("No permission on pterodactyl, check pterodactyl token and permissions - " . $message, 403);
}
if ($status == 401) {
return new Exception("No pterodactyl token set - " . $message, 401);
}
if ($status == 500) {
return new Exception("Pterodactyl server error - " . $message, 500);
}
return new Exception('Request Failed, is pterodactyl set-up correctly? - ' . $message);
}
/**
@ -51,9 +66,9 @@ class Pterodactyl
try {
$response = self::client()->get("/application/nests/{$nest->id}/eggs?include=nest,variables&per_page=" . self::PER_PAGE);
} catch (Exception $e) {
throw self::getException();
throw self::getException($e->getMessage());
}
if ($response->failed()) throw self::getException();
if ($response->failed()) throw self::getException("Failed to get eggs from pterodactyl - ", $response->status());
return $response->json()['data'];
}
@ -66,9 +81,9 @@ class Pterodactyl
try {
$response = self::client()->get('/application/nodes?per_page=' . self::PER_PAGE);
} catch (Exception $e) {
throw self::getException();
throw self::getException($e->getMessage());
}
if ($response->failed()) throw self::getException();
if ($response->failed()) throw self::getException("Failed to get nodes from pterodactyl - ", $response->status());
return $response->json()['data'];
}
@ -81,9 +96,9 @@ class Pterodactyl
try {
$response = self::client()->get('/application/nests?per_page=' . self::PER_PAGE);
} catch (Exception $e) {
throw self::getException();
throw self::getException($e->getMessage());
}
if ($response->failed()) throw self::getException();
if ($response->failed()) throw self::getException("Failed to get nests from pterodactyl", $response->status());
return $response->json()['data'];
}
@ -96,9 +111,9 @@ class Pterodactyl
try {
$response = self::client()->get('/application/locations?per_page=' . self::PER_PAGE);
} catch (Exception $e) {
throw self::getException();
throw self::getException($e->getMessage());
}
if ($response->failed()) throw self::getException();
if ($response->failed()) throw self::getException("Failed to get locations from pterodactyl - ", $response->status());
return $response->json()['data'];
}
@ -145,9 +160,9 @@ class Pterodactyl
try {
$response = self::client()->get("/application/nodes/{$node->id}/allocations?per_page={$per_page}");
} catch (Exception $e) {
throw self::getException();
throw self::getException($e->getMessage());
}
if ($response->failed()) throw self::getException();
if ($response->failed()) throw self::getException("Failed to get allocations from pterodactyl - ", $response->status());
return $response->json();
}
@ -200,9 +215,9 @@ class Pterodactyl
try {
$response = self::client()->post("/application/servers/$server->pterodactyl_id/suspend");
} catch (Exception $e) {
throw self::getException();
throw self::getException($e->getMessage());
}
if ($response->failed()) throw self::getException();
if ($response->failed()) throw self::getException("Failed to suspend server from pterodactyl - ", $response->status());
return $response;
}
@ -212,9 +227,9 @@ class Pterodactyl
try {
$response = self::client()->post("/application/servers/$server->pterodactyl_id/unsuspend");
} catch (Exception $e) {
throw self::getException();
throw self::getException($e->getMessage());
}
if ($response->failed()) throw self::getException();
if ($response->failed()) throw self::getException("Failed to unsuspend server from pterodactyl - ", $response->status());
return $response;
}
@ -229,9 +244,9 @@ class Pterodactyl
try {
$response = self::client()->get("/application/users/{$pterodactylId}");
} catch (Exception $e) {
throw self::getException();
throw self::getException($e->getMessage());
}
if ($response->failed()) throw self::getException();
if ($response->failed()) throw self::getException("Failed to get user from pterodactyl - ", $response->status());
return $response->json()['attributes'];
}
@ -246,9 +261,14 @@ class Pterodactyl
try {
$response = self::client()->get("/application/servers/{$pterodactylId}?include=egg,node,nest,location");
} catch (Exception $e) {
throw self::getException();
throw self::getException($e->getMessage());
}
if ($response->failed()) throw self::getException();
//print response body
if ($response->failed()) throw self::getException("Failed to get server attributes from pterodactyl - ", $response->status());
return $response->json()['attributes'];
}
}

View file

@ -5,9 +5,11 @@ namespace App\Providers;
use App\Models\Settings;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider;
use Exception;
class AppServiceProvider extends ServiceProvider
{
@ -51,7 +53,7 @@ class AppServiceProvider extends ServiceProvider
});
//only run if the installer has been executed
if (file_exists(base_path()."/install.lock")) {
try {
$settings = Settings::all();
// Set all configs from database
foreach ($settings as $setting) {
@ -103,6 +105,9 @@ class AppServiceProvider extends ServiceProvider
// Set Discord-API Config
config(['services.discord.client_id' => config('SETTINGS::DISCORD:CLIENT_ID')]);
config(['services.discord.client_secret' => config('SETTINGS::DISCORD:CLIENT_SECRET')]);
} catch (Exception $e) {
error_log("Settings Error: Could not load settings from database");
Log::error("Settings Error: Could not load settings from database");
}
}
}

View file

@ -28,7 +28,7 @@
"spatie/laravel-query-builder": "^3.6",
"spatie/laravel-validation-rules": "^3.0",
"stripe/stripe-php": "^7.107",
"symfony/intl": "^6.0",
"symfony/intl": "^5.4",
"yajra/laravel-datatables-oracle": "~9.0"
},
"require-dev": {

263
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d932d84040780b815f087c1d18a1e41d",
"content-hash": "cea74440bd82b208471c3bdfba8da815",
"packages": [
{
"name": "asm89/stack-cors",
@ -434,16 +434,16 @@
},
{
"name": "doctrine/dbal",
"version": "3.3.0",
"version": "3.3.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "a4b37db6f186b6843474189b424aed6a7cc5de4b"
"reference": "35eae239ef515d55ebb24e9d4715cad09a4f58ed"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/a4b37db6f186b6843474189b424aed6a7cc5de4b",
"reference": "a4b37db6f186b6843474189b424aed6a7cc5de4b",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/35eae239ef515d55ebb24e9d4715cad09a4f58ed",
"reference": "35eae239ef515d55ebb24e9d4715cad09a4f58ed",
"shasum": ""
},
"require": {
@ -525,7 +525,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/3.3.0"
"source": "https://github.com/doctrine/dbal/tree/3.3.2"
},
"funding": [
{
@ -541,7 +541,7 @@
"type": "tidelift"
}
],
"time": "2022-01-18T00:13:52+00:00"
"time": "2022-02-05T16:33:45+00:00"
},
{
"name": "doctrine/deprecations",
@ -849,23 +849,23 @@
},
{
"name": "dompdf/dompdf",
"version": "v1.1.1",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/dompdf/dompdf.git",
"reference": "de4aad040737a89fae2129cdeb0f79c45513128d"
"reference": "60b704331479a69e9bcdb3496da2315b5c4f94fd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/de4aad040737a89fae2129cdeb0f79c45513128d",
"reference": "de4aad040737a89fae2129cdeb0f79c45513128d",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/60b704331479a69e9bcdb3496da2315b5c4f94fd",
"reference": "60b704331479a69e9bcdb3496da2315b5c4f94fd",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-mbstring": "*",
"phenx/php-font-lib": "^0.5.2",
"phenx/php-svg-lib": "^0.3.3",
"phenx/php-font-lib": "^0.5.4",
"phenx/php-svg-lib": "^0.3.3 || ^0.4.0",
"php": "^7.1 || ^8.0"
},
"require-dev": {
@ -910,9 +910,9 @@
"homepage": "https://github.com/dompdf/dompdf",
"support": {
"issues": "https://github.com/dompdf/dompdf/issues",
"source": "https://github.com/dompdf/dompdf/tree/v1.1.1"
"source": "https://github.com/dompdf/dompdf/tree/v1.2.0"
},
"time": "2021-11-24T00:45:04+00:00"
"time": "2022-02-07T13:02:10+00:00"
},
{
"name": "dragonmantank/cron-expression",
@ -1687,16 +1687,16 @@
},
{
"name": "laravel/framework",
"version": "v8.81.0",
"version": "v8.82.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "9cc0efd724ce67a190b1695ba31a27bbb1ae9177"
"reference": "411d5243c58cbf12b0fc89cab1ceb50088968c27"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/9cc0efd724ce67a190b1695ba31a27bbb1ae9177",
"reference": "9cc0efd724ce67a190b1695ba31a27bbb1ae9177",
"url": "https://api.github.com/repos/laravel/framework/zipball/411d5243c58cbf12b0fc89cab1ceb50088968c27",
"reference": "411d5243c58cbf12b0fc89cab1ceb50088968c27",
"shasum": ""
},
"require": {
@ -1856,20 +1856,20 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2022-01-25T16:41:46+00:00"
"time": "2022-02-01T16:13:57+00:00"
},
{
"name": "laravel/serializable-closure",
"version": "v1.0.5",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/serializable-closure.git",
"reference": "25de3be1bca1b17d52ff0dc02b646c667ac7266c"
"reference": "65c9faf50d567b65d81764a44526545689e3fe63"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/25de3be1bca1b17d52ff0dc02b646c667ac7266c",
"reference": "25de3be1bca1b17d52ff0dc02b646c667ac7266c",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/65c9faf50d567b65d81764a44526545689e3fe63",
"reference": "65c9faf50d567b65d81764a44526545689e3fe63",
"shasum": ""
},
"require": {
@ -1915,20 +1915,20 @@
"issues": "https://github.com/laravel/serializable-closure/issues",
"source": "https://github.com/laravel/serializable-closure"
},
"time": "2021-11-30T15:53:04+00:00"
"time": "2022-02-01T16:29:39+00:00"
},
{
"name": "laravel/socialite",
"version": "v5.4.0",
"version": "v5.5.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/socialite.git",
"reference": "4b1999232a572dfe61f42c7295490d1372dad097"
"reference": "cb5b5538c207efa19aa5d7f46cd76acb03ec3055"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/socialite/zipball/4b1999232a572dfe61f42c7295490d1372dad097",
"reference": "4b1999232a572dfe61f42c7295490d1372dad097",
"url": "https://api.github.com/repos/laravel/socialite/zipball/cb5b5538c207efa19aa5d7f46cd76acb03ec3055",
"reference": "cb5b5538c207efa19aa5d7f46cd76acb03ec3055",
"shasum": ""
},
"require": {
@ -1984,7 +1984,7 @@
"issues": "https://github.com/laravel/socialite/issues",
"source": "https://github.com/laravel/socialite"
},
"time": "2022-01-25T20:10:22+00:00"
"time": "2022-02-01T16:31:36+00:00"
},
{
"name": "laravel/tinker",
@ -3300,21 +3300,22 @@
},
{
"name": "phenx/php-svg-lib",
"version": "0.3.4",
"version": "0.4.0",
"source": {
"type": "git",
"url": "https://github.com/PhenX/php-svg-lib.git",
"reference": "f627771eb854aa7f45f80add0f23c6c4d67ea0f2"
"url": "https://github.com/dompdf/php-svg-lib.git",
"reference": "3ffbbb037f0871c3a819e90cff8b36dd7e656189"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PhenX/php-svg-lib/zipball/f627771eb854aa7f45f80add0f23c6c4d67ea0f2",
"reference": "f627771eb854aa7f45f80add0f23c6c4d67ea0f2",
"url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/3ffbbb037f0871c3a819e90cff8b36dd7e656189",
"reference": "3ffbbb037f0871c3a819e90cff8b36dd7e656189",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.4 || ^8.0",
"sabberworm/php-css-parser": "^8.3"
"sabberworm/php-css-parser": "^8.4"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
@ -3338,10 +3339,10 @@
"description": "A library to read, parse and export to PDF SVG files.",
"homepage": "https://github.com/PhenX/php-svg-lib",
"support": {
"issues": "https://github.com/PhenX/php-svg-lib/issues",
"source": "https://github.com/PhenX/php-svg-lib/tree/0.3.4"
"issues": "https://github.com/dompdf/php-svg-lib/issues",
"source": "https://github.com/dompdf/php-svg-lib/tree/0.4.0"
},
"time": "2021-10-18T02:13:32+00:00"
"time": "2021-12-17T14:08:35+00:00"
},
{
"name": "phpoption/phpoption",
@ -4320,12 +4321,12 @@
}
},
"autoload": {
"psr-4": {
"Spatie\\Activitylog\\": "src"
},
"files": [
"src/helpers.php"
]
],
"psr-4": {
"Spatie\\Activitylog\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -4520,16 +4521,16 @@
},
{
"name": "stripe/stripe-php",
"version": "v7.112.0",
"version": "v7.113.0",
"source": {
"type": "git",
"url": "https://github.com/stripe/stripe-php.git",
"reference": "f5213ccb88795663f73841bc65f467a0e1e61180"
"reference": "1aef1ccffad48f39952073e0ed53cb8f3f1b1d8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/f5213ccb88795663f73841bc65f467a0e1e61180",
"reference": "f5213ccb88795663f73841bc65f467a0e1e61180",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/1aef1ccffad48f39952073e0ed53cb8f3f1b1d8c",
"reference": "1aef1ccffad48f39952073e0ed53cb8f3f1b1d8c",
"shasum": ""
},
"require": {
@ -4574,9 +4575,9 @@
],
"support": {
"issues": "https://github.com/stripe/stripe-php/issues",
"source": "https://github.com/stripe/stripe-php/tree/v7.112.0"
"source": "https://github.com/stripe/stripe-php/tree/v7.113.0"
},
"time": "2022-01-25T19:42:36+00:00"
"time": "2022-02-03T23:46:29+00:00"
},
{
"name": "swiftmailer/swiftmailer",
@ -5256,16 +5257,16 @@
},
{
"name": "symfony/http-kernel",
"version": "v5.4.3",
"version": "v5.4.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "936ca1ba7fb197c9e100a68d7e963b93d99db26e"
"reference": "49f40347228c773688a0488feea0175aa7f4d268"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/936ca1ba7fb197c9e100a68d7e963b93d99db26e",
"reference": "936ca1ba7fb197c9e100a68d7e963b93d99db26e",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/49f40347228c773688a0488feea0175aa7f4d268",
"reference": "49f40347228c773688a0488feea0175aa7f4d268",
"shasum": ""
},
"require": {
@ -5348,7 +5349,7 @@
"description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-kernel/tree/v5.4.3"
"source": "https://github.com/symfony/http-kernel/tree/v5.4.4"
},
"funding": [
{
@ -5364,33 +5365,41 @@
"type": "tidelift"
}
],
"time": "2022-01-28T11:06:03+00:00"
"time": "2022-01-29T18:08:07+00:00"
},
{
"name": "symfony/intl",
"version": "v6.0.3",
"version": "v5.4.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/intl.git",
"reference": "eeddf6ca4cb4767e554c82182d1ddd5a7ff94f4d"
"reference": "29e326276b2455bcfa4ce02abcf7689e884acdac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/intl/zipball/eeddf6ca4cb4767e554c82182d1ddd5a7ff94f4d",
"reference": "eeddf6ca4cb4767e554c82182d1ddd5a7ff94f4d",
"url": "https://api.github.com/repos/symfony/intl/zipball/29e326276b2455bcfa4ce02abcf7689e884acdac",
"reference": "29e326276b2455bcfa4ce02abcf7689e884acdac",
"shasum": ""
},
"require": {
"php": ">=8.0.2"
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-php80": "^1.16"
},
"require-dev": {
"symfony/filesystem": "^5.4|^6.0"
"symfony/filesystem": "^4.4|^5.0|^6.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Intl\\": ""
},
"classmap": [
"Resources/stubs"
],
"files": [
"Resources/functions.php"
],
"exclude-from-classmap": [
"/Tests/"
]
@ -5428,7 +5437,7 @@
"localization"
],
"support": {
"source": "https://github.com/symfony/intl/tree/v6.0.3"
"source": "https://github.com/symfony/intl/tree/v5.4.3"
},
"funding": [
{
@ -5444,7 +5453,7 @@
"type": "tidelift"
}
],
"time": "2022-01-02T09:55:41+00:00"
"time": "2022-01-02T09:53:40+00:00"
},
{
"name": "symfony/mime",
@ -5645,12 +5654,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Iconv\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Iconv\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -5725,12 +5734,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Grapheme\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Grapheme\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -5808,12 +5817,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Idn\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Idn\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -5893,12 +5902,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Normalizer\\": ""
},
"classmap": [
"Resources/stubs"
]
@ -6057,12 +6066,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php72\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Php72\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -6133,12 +6142,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php73\\": ""
},
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php73\\": ""
},
"classmap": [
"Resources/stubs"
]
@ -6212,12 +6221,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [
"Resources/stubs"
]
@ -6295,12 +6304,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php81\\": ""
},
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php81\\": ""
},
"classmap": [
"Resources/stubs"
]
@ -7238,12 +7247,12 @@
}
},
"autoload": {
"psr-4": {
"Yajra\\DataTables\\": "src/"
},
"files": [
"src/helper.php"
]
],
"psr-4": {
"Yajra\\DataTables\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -7281,26 +7290,26 @@
"packages-dev": [
{
"name": "barryvdh/laravel-debugbar",
"version": "v3.6.5",
"version": "v3.6.6",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-debugbar.git",
"reference": "ccf109f8755dcc7e58779d1aeb1051b04e0b4bef"
"reference": "f92fe967b40b36ad1ee8ed2fd59c05ae67a1ebba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/ccf109f8755dcc7e58779d1aeb1051b04e0b4bef",
"reference": "ccf109f8755dcc7e58779d1aeb1051b04e0b4bef",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/f92fe967b40b36ad1ee8ed2fd59c05ae67a1ebba",
"reference": "f92fe967b40b36ad1ee8ed2fd59c05ae67a1ebba",
"shasum": ""
},
"require": {
"illuminate/routing": "^6|^7|^8",
"illuminate/session": "^6|^7|^8",
"illuminate/support": "^6|^7|^8",
"illuminate/routing": "^6|^7|^8|^9",
"illuminate/session": "^6|^7|^8|^9",
"illuminate/support": "^6|^7|^8|^9",
"maximebf/debugbar": "^1.17.2",
"php": ">=7.2",
"symfony/debug": "^4.3|^5",
"symfony/finder": "^4.3|^5"
"symfony/debug": "^4.3|^5|^6",
"symfony/finder": "^4.3|^5|^6"
},
"require-dev": {
"mockery/mockery": "^1.3.3",
@ -7350,7 +7359,7 @@
],
"support": {
"issues": "https://github.com/barryvdh/laravel-debugbar/issues",
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.6.5"
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.6.6"
},
"funding": [
{
@ -7362,7 +7371,7 @@
"type": "github"
}
],
"time": "2021-12-14T14:45:18+00:00"
"time": "2021-12-21T18:20:10+00:00"
},
{
"name": "doctrine/instantiator",
@ -7631,16 +7640,16 @@
},
{
"name": "fakerphp/faker",
"version": "v1.18.0",
"version": "v1.19.0",
"source": {
"type": "git",
"url": "https://github.com/FakerPHP/Faker.git",
"reference": "2e77a868f6540695cf5ebf21e5ab472c65f47567"
"reference": "d7f08a622b3346766325488aa32ddc93ccdecc75"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FakerPHP/Faker/zipball/2e77a868f6540695cf5ebf21e5ab472c65f47567",
"reference": "2e77a868f6540695cf5ebf21e5ab472c65f47567",
"url": "https://api.github.com/repos/FakerPHP/Faker/zipball/d7f08a622b3346766325488aa32ddc93ccdecc75",
"reference": "d7f08a622b3346766325488aa32ddc93ccdecc75",
"shasum": ""
},
"require": {
@ -7653,10 +7662,12 @@
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"doctrine/persistence": "^1.3 || ^2.0",
"ext-intl": "*",
"symfony/phpunit-bridge": "^4.4 || ^5.2"
},
"suggest": {
"doctrine/orm": "Required to use Faker\\ORM\\Doctrine",
"ext-curl": "Required by Faker\\Provider\\Image to download images.",
"ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.",
"ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.",
@ -7665,7 +7676,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "v1.18-dev"
"dev-main": "v1.19-dev"
}
},
"autoload": {
@ -7690,9 +7701,9 @@
],
"support": {
"issues": "https://github.com/FakerPHP/Faker/issues",
"source": "https://github.com/FakerPHP/Faker/tree/v1.18.0"
"source": "https://github.com/FakerPHP/Faker/tree/v1.19.0"
},
"time": "2022-01-23T17:56:23+00:00"
"time": "2022-02-02T17:38:57+00:00"
},
{
"name": "filp/whoops",
@ -8040,12 +8051,12 @@
},
"type": "library",
"autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
},
"files": [
"src/DeepCopy/deep_copy.php"
]
],
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -8220,16 +8231,16 @@
},
{
"name": "phar-io/version",
"version": "3.1.0",
"version": "3.1.1",
"source": {
"type": "git",
"url": "https://github.com/phar-io/version.git",
"reference": "bae7c545bef187884426f042434e561ab1ddb182"
"reference": "15a90844ad40f127afd244c0cad228de2a80052a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182",
"reference": "bae7c545bef187884426f042434e561ab1ddb182",
"url": "https://api.github.com/repos/phar-io/version/zipball/15a90844ad40f127afd244c0cad228de2a80052a",
"reference": "15a90844ad40f127afd244c0cad228de2a80052a",
"shasum": ""
},
"require": {
@ -8265,9 +8276,9 @@
"description": "Library for handling version information and constraints",
"support": {
"issues": "https://github.com/phar-io/version/issues",
"source": "https://github.com/phar-io/version/tree/3.1.0"
"source": "https://github.com/phar-io/version/tree/3.1.1"
},
"time": "2021-02-23T14:00:09+00:00"
"time": "2022-02-07T21:56:48+00:00"
},
{
"name": "phpdocumentor/reflection-common",
@ -8876,11 +8887,11 @@
}
},
"autoload": {
"classmap": [
"src/"
],
"files": [
"src/Framework/Assert/Functions.php"
],
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",

View file

@ -29,6 +29,7 @@ if (isset($_POST['checkDB'])) {
$db = new mysqli($_POST["databasehost"], $_POST["databaseuser"], $_POST["databaseuserpass"], $_POST["database"], $_POST["databaseport"]);
if ($db->connect_error) {
wh_log($db->connect_error);
header("LOCATION: index.php?step=2&message=Could not connect to the Database");
die();
}
@ -78,14 +79,12 @@ if (isset($_POST['feedDB'])) {
}
$logs .= run_console('php artisan storage:link');
$logsfile = fopen("logs.txt", "w") or die("Unable to open file!");
fwrite($logsfile, $logs);
fclose($logsfile);
wh_log($logs);
if (strpos(getEnvironmentValue("APP_KEY"), 'base64') !== false) {
header("LOCATION: index.php?step=3");
} else {
header("LOCATION: index.php?step=2.5&message=There was an error. Please check install/logs.txt !");
header("LOCATION: index.php?step=2.5&message=There was an error. Please check the .txt file in install/log !");
}
@ -123,7 +122,8 @@ if (isset($_POST['checkSMTP'])) {
$db = new mysqli(getEnvironmentValue("DB_HOST"), getEnvironmentValue("DB_USERNAME"), getEnvironmentValue("DB_PASSWORD"), getEnvironmentValue("DB_DATABASE"), getEnvironmentValue("DB_PORT"));
if ($db->connect_error) {
header("LOCATION: index.php?step=4&message=Could not connect to the Database");
wh_log($db->connect_error);
header("LOCATION: index.php?step=4&message=Could not connect to the Database: ");
die();
}
$values = [
@ -181,6 +181,7 @@ if (isset($_POST['checkPtero'])) {
$db = new mysqli(getEnvironmentValue("DB_HOST"), getEnvironmentValue("DB_USERNAME"), getEnvironmentValue("DB_PASSWORD"), getEnvironmentValue("DB_DATABASE"), getEnvironmentValue("DB_PORT"));
if ($db->connect_error) {
wh_log($db->connect_error);
header("LOCATION: index.php?step=5&message=Could not connect to the Database");
die();
}
@ -188,6 +189,7 @@ if (isset($_POST['checkPtero'])) {
if ($db->query($query1) && $db->query($query2)) {
header("LOCATION: index.php?step=6");
} else {
wh_log($db->error);
header("LOCATION: index.php?step=5&message=Something went wrong when communicating with the Database!");
}
}
@ -198,6 +200,7 @@ if (isset($_POST['checkPtero'])) {
if (isset($_POST['createUser'])) {
$db = new mysqli(getEnvironmentValue("DB_HOST"), getEnvironmentValue("DB_USERNAME"), getEnvironmentValue("DB_PASSWORD"), getEnvironmentValue("DB_DATABASE"), getEnvironmentValue("DB_PORT"));
if ($db->connect_error) {
wh_log($db->connect_error);
header("LOCATION: index.php?step=6&message=Could not connect to the Database");
die();
}
@ -273,8 +276,8 @@ if (isset($_POST['createUser'])) {
if ($db->query($query1)) {
header("LOCATION: index.php?step=7");
} else {
header("LOCATION: index.php?step=6&message=Something went wrong when communicating with the Database!");
wh_log($db->error);
header("LOCATION: index.php?step=6&message=Something went wrong when communicating with the Database");
}

View file

@ -130,4 +130,17 @@ function run_console($command)
return shell_exec($cmd);
}
function wh_log($log_msg)
{
$log_filename = "log";
if (!file_exists($log_filename))
{
// create directory/folder uploads.
mkdir($log_filename, 0777, true);
}
$log_file_data = $log_filename.'/log_' . date('d-M-Y') . '.log';
// if you don't add `FILE_APPEND`, the file will be erased each time you add a log
file_put_contents($log_file_data, "[".date('h:i:s')."] " . $log_msg . "\n", FILE_APPEND);
}
?>