Fixed bad redirects (closes #62)
Improved installer extensions recognitions Improved cli commands
This commit is contained in:
parent
8cbef5ef39
commit
42883417e8
10 changed files with 132 additions and 83 deletions
|
@ -1,3 +1,9 @@
|
|||
## v2.6.1
|
||||
+ Fixed bad redirects on the web installer (#62).
|
||||
+ Improved shell commands.
|
||||
+ Added alert if required extensions are not loaded.
|
||||
+ Updated translations.
|
||||
|
||||
## v2.6
|
||||
+ Added support to use AWS S3, Google Cloud Storage, Dropbox and FTP(s) accounts as storage location.
|
||||
+ Fixed missing icon.
|
||||
|
|
13
README.md
13
README.md
|
@ -5,9 +5,11 @@ XBackBone is a simple, self-hosted, lightweight PHP backend for the instant shar
|
|||
## Features
|
||||
|
||||
+ Supports every upload type from ShareX.
|
||||
+ Low memory footprint.
|
||||
+ Multiple backends support: Local storage, AWS S3, Google Cloud, Dropbox, FTP.
|
||||
+ Code uploads syntax highlighting.
|
||||
+ Video uploads player.
|
||||
+ Files upload download page.
|
||||
+ Files preview page.
|
||||
+ Multi language support.
|
||||
+ User management, multi user features and roles.
|
||||
+ Public and private uploads.
|
||||
|
@ -16,9 +18,15 @@ XBackBone is a simple, self-hosted, lightweight PHP backend for the instant shar
|
|||
+ Auto config generator for ShareX.
|
||||
+ Share to Telegram.
|
||||
+ Linux client tools supported via a custom script.
|
||||
+ Direct downloads using curl or wget commands.
|
||||
|
||||
## How to Install
|
||||
XBackBone require PHP >= `7.1`, writable storage path and PDO, with installed the required extensions (ex. `php-sqlite3` for SQLite, `php-gd` and `php-json`).
|
||||
XBackBone require PHP >= `7.1`, writable storage path and PDO, with installed the required extensions:
|
||||
+ `php-sqlite3` for SQLite
|
||||
+ `php-mysql` for MariaDB/MySQL
|
||||
+ `php-gd`
|
||||
+ `php-json`
|
||||
+ `php-intl`
|
||||
|
||||
### Web installation
|
||||
+ **[release, stable]** Download latest release from GitHub: [Latest Release](https://github.com/SergiX44/XBackBone/releases/latest)
|
||||
|
@ -56,6 +64,7 @@ return [
|
|||
```sh
|
||||
php bin/migrate --install
|
||||
```
|
||||
+ Delete the `/install` directory.
|
||||
+ Now just login with `admin/admin`, **be sure to change these credentials after your first login**.
|
||||
|
||||
## How to update
|
||||
|
|
|
@ -92,7 +92,7 @@ if (!function_exists('redirect')) {
|
|||
*/
|
||||
function redirect(\Slim\Http\Response $response, string $path, $args = [], $status = null)
|
||||
{
|
||||
if ($path === '/' || $path === './' || substr($path, 0, 1) === '/') {
|
||||
if (substr($path, 0, 1) === '/' || substr($path, 0, 3) === '../' || substr($path, 0, 2) === './') {
|
||||
$url = urlFor($path);
|
||||
} else {
|
||||
$url = route($path, $args);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
die();
|
||||
}
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
$action = isset($argv[1]) ? $argv[1] : 'all';
|
||||
|
||||
switch ($action) {
|
||||
|
|
21
bin/migrate
21
bin/migrate
|
@ -1,20 +1,22 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use App\Database\DB;
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
die();
|
||||
}
|
||||
|
||||
$config = include 'config.php';
|
||||
use App\Database\DB;
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
$config = include __DIR__ . '/../config.php';
|
||||
|
||||
if (!$config) {
|
||||
die('config.php not found. Please create a new one.');
|
||||
}
|
||||
|
||||
chdir(__DIR__ . '/../');
|
||||
|
||||
DB::setDsn($config['db']['connection'] . ':' . $config['db']['dsn'], $config['db']['username'], $config['db']['password']);
|
||||
|
||||
$firstMigrate = false;
|
||||
|
@ -56,7 +58,7 @@ foreach ($files as $file) {
|
|||
if (basename($file) === $migration->name && $migration->migrated) {
|
||||
$continue = true;
|
||||
break;
|
||||
} elseif (basename($file) === $migration->name && !$migration->migrated) {
|
||||
} else if (basename($file) === $migration->name && !$migration->migrated) {
|
||||
$exists = true;
|
||||
break;
|
||||
}
|
||||
|
@ -86,4 +88,11 @@ if (isset($argv[1]) && $argv[1] === '--install') {
|
|||
DB::doQuery("INSERT INTO `users` (`email`, `username`, `password`, `is_admin`, `user_code`) VALUES ('admin@example.com', 'admin', ?, 1, ?)", [password_hash('admin', PASSWORD_DEFAULT), substr(md5(microtime()), rand(0, 26), 5)]);
|
||||
}
|
||||
|
||||
if (file_exists(__DIR__ . '/../install')) {
|
||||
removeDirectory(__DIR__ . '/../install');
|
||||
}
|
||||
|
||||
include __DIR__ . '/clean';
|
||||
|
||||
echo 'Done.' . PHP_EOL;
|
||||
exit(0);
|
|
@ -1,12 +1,14 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
die();
|
||||
}
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
chdir(__DIR__ . '/../');
|
||||
|
||||
$json = json_decode(file_get_contents('https://bootswatch.com/api/4.json'));
|
||||
|
||||
if (!isset($argv[1])) {
|
||||
|
|
117
composer.lock
generated
117
composer.lock
generated
|
@ -8,16 +8,16 @@
|
|||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
"version": "3.109.7",
|
||||
"version": "3.110.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||
"reference": "e8d3416f9b1e21029fc0eb63df075e325c690187"
|
||||
"reference": "57d9dd171a5afe0b48ce44f05be2d8875c2f7b34"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/e8d3416f9b1e21029fc0eb63df075e325c690187",
|
||||
"reference": "e8d3416f9b1e21029fc0eb63df075e325c690187",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/57d9dd171a5afe0b48ce44f05be2d8875c2f7b34",
|
||||
"reference": "57d9dd171a5afe0b48ce44f05be2d8875c2f7b34",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -87,7 +87,7 @@
|
|||
"s3",
|
||||
"sdk"
|
||||
],
|
||||
"time": "2019-08-19T18:08:45+00:00"
|
||||
"time": "2019-08-30T18:07:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "container-interop/container-interop",
|
||||
|
@ -219,16 +219,16 @@
|
|||
},
|
||||
{
|
||||
"name": "google/cloud-core",
|
||||
"version": "v1.31.0",
|
||||
"version": "v1.32.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/googleapis/google-cloud-php-core.git",
|
||||
"reference": "c7b8890cdab3761e341ecf8f5d7c141aa616978f"
|
||||
"reference": "1e5dceb51497baa295933588abaa93fa1e6f5e04"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/c7b8890cdab3761e341ecf8f5d7c141aa616978f",
|
||||
"reference": "c7b8890cdab3761e341ecf8f5d7c141aa616978f",
|
||||
"url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/1e5dceb51497baa295933588abaa93fa1e6f5e04",
|
||||
"reference": "1e5dceb51497baa295933588abaa93fa1e6f5e04",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -276,7 +276,7 @@
|
|||
"Apache-2.0"
|
||||
],
|
||||
"description": "Google Cloud PHP shared dependency, providing functionality useful to all components.",
|
||||
"time": "2019-08-07T20:57:43+00:00"
|
||||
"time": "2019-08-21T17:32:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "google/cloud-storage",
|
||||
|
@ -373,16 +373,16 @@
|
|||
},
|
||||
{
|
||||
"name": "graham-campbell/guzzle-factory",
|
||||
"version": "v3.0.1",
|
||||
"version": "v3.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/GrahamCampbell/Guzzle-Factory.git",
|
||||
"reference": "5953039c541533647110f8c8f48cbc428d51beb1"
|
||||
"reference": "6ccf9d73c4c2a55b9576f3a6edcf42af44c99fbb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/GrahamCampbell/Guzzle-Factory/zipball/5953039c541533647110f8c8f48cbc428d51beb1",
|
||||
"reference": "5953039c541533647110f8c8f48cbc428d51beb1",
|
||||
"url": "https://api.github.com/repos/GrahamCampbell/Guzzle-Factory/zipball/6ccf9d73c4c2a55b9576f3a6edcf42af44c99fbb",
|
||||
"reference": "6ccf9d73c4c2a55b9576f3a6edcf42af44c99fbb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -423,7 +423,7 @@
|
|||
"Guzzle-Factory",
|
||||
"http"
|
||||
],
|
||||
"time": "2019-06-30T12:48:08+00:00"
|
||||
"time": "2019-08-23T13:19:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
|
@ -684,16 +684,16 @@
|
|||
},
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
"version": "1.0.53",
|
||||
"version": "1.0.55",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/flysystem.git",
|
||||
"reference": "08e12b7628f035600634a5e76d95b5eb66cea674"
|
||||
"reference": "33c91155537c6dc899eacdc54a13ac6303f156e6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/08e12b7628f035600634a5e76d95b5eb66cea674",
|
||||
"reference": "08e12b7628f035600634a5e76d95b5eb66cea674",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/33c91155537c6dc899eacdc54a13ac6303f156e6",
|
||||
"reference": "33c91155537c6dc899eacdc54a13ac6303f156e6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -764,7 +764,7 @@
|
|||
"sftp",
|
||||
"storage"
|
||||
],
|
||||
"time": "2019-06-18T20:09:29+00:00"
|
||||
"time": "2019-08-24T11:17:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem-aws-s3-v3",
|
||||
|
@ -1320,20 +1320,23 @@
|
|||
},
|
||||
{
|
||||
"name": "slim/slim",
|
||||
"version": "3.12.1",
|
||||
"version": "3.12.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/slimphp/Slim.git",
|
||||
"reference": "eaee12ef8d0750db62b8c548016d82fb33addb6b"
|
||||
"reference": "200c6143f15baa477601879b64ab2326847aac0b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/slimphp/Slim/zipball/eaee12ef8d0750db62b8c548016d82fb33addb6b",
|
||||
"reference": "eaee12ef8d0750db62b8c548016d82fb33addb6b",
|
||||
"url": "https://api.github.com/repos/slimphp/Slim/zipball/200c6143f15baa477601879b64ab2326847aac0b",
|
||||
"reference": "200c6143f15baa477601879b64ab2326847aac0b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"container-interop/container-interop": "^1.2",
|
||||
"ext-json": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-simplexml": "*",
|
||||
"nikic/fast-route": "^1.0",
|
||||
"php": ">=5.5.0",
|
||||
"pimple/pimple": "^3.0",
|
||||
|
@ -1358,25 +1361,25 @@
|
|||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Rob Allen",
|
||||
"email": "rob@akrabat.com",
|
||||
"homepage": "http://akrabat.com"
|
||||
},
|
||||
{
|
||||
"name": "Josh Lockhart",
|
||||
"email": "hello@joshlockhart.com",
|
||||
"homepage": "https://joshlockhart.com"
|
||||
},
|
||||
{
|
||||
"name": "Gabriel Manricks",
|
||||
"email": "gmanricks@me.com",
|
||||
"homepage": "http://gabrielmanricks.com"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Smith",
|
||||
"email": "a.smith@silentworks.co.uk",
|
||||
"homepage": "http://silentworks.co.uk"
|
||||
},
|
||||
{
|
||||
"name": "Rob Allen",
|
||||
"email": "rob@akrabat.com",
|
||||
"homepage": "http://akrabat.com"
|
||||
},
|
||||
{
|
||||
"name": "Gabriel Manricks",
|
||||
"email": "gmanricks@me.com",
|
||||
"homepage": "http://gabrielmanricks.com"
|
||||
}
|
||||
],
|
||||
"description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs",
|
||||
|
@ -1387,7 +1390,7 @@
|
|||
"micro",
|
||||
"router"
|
||||
],
|
||||
"time": "2019-04-16T16:47:29+00:00"
|
||||
"time": "2019-08-20T18:46:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "slim/twig-view",
|
||||
|
@ -1532,9 +1535,9 @@
|
|||
"authors": [
|
||||
{
|
||||
"name": "Alex Vanderbist",
|
||||
"role": "Developer",
|
||||
"email": "alex.vanderbist@gmail.com",
|
||||
"homepage": "https://spatie.be"
|
||||
"homepage": "https://spatie.be",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Flysystem Adapter for the Dropbox v2 API",
|
||||
|
@ -2402,16 +2405,16 @@
|
|||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v4.2.3",
|
||||
"version": "v4.2.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "e612609022e935f3d0337c1295176505b41188c8"
|
||||
"reference": "97e59c7a16464196a8b9c77c47df68e4a39a45c4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/e612609022e935f3d0337c1295176505b41188c8",
|
||||
"reference": "e612609022e935f3d0337c1295176505b41188c8",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/97e59c7a16464196a8b9c77c47df68e4a39a45c4",
|
||||
"reference": "97e59c7a16464196a8b9c77c47df68e4a39a45c4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2449,7 +2452,7 @@
|
|||
"parser",
|
||||
"php"
|
||||
],
|
||||
"time": "2019-08-12T20:17:41+00:00"
|
||||
"time": "2019-09-01T07:51:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ocramius/package-versions",
|
||||
|
@ -2625,16 +2628,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v4.3.3",
|
||||
"version": "v4.3.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "8b0ae5742ce9aaa8b0075665862c1ca397d1c1d9"
|
||||
"reference": "de63799239b3881b8a08f8481b22348f77ed7b36"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/8b0ae5742ce9aaa8b0075665862c1ca397d1c1d9",
|
||||
"reference": "8b0ae5742ce9aaa8b0075665862c1ca397d1c1d9",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/de63799239b3881b8a08f8481b22348f77ed7b36",
|
||||
"reference": "de63799239b3881b8a08f8481b22348f77ed7b36",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2696,20 +2699,20 @@
|
|||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2019-07-24T17:13:59+00:00"
|
||||
"time": "2019-08-26T08:26:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v4.3.3",
|
||||
"version": "v4.3.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "9638d41e3729459860bb96f6247ccb61faaa45f2"
|
||||
"reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/9638d41e3729459860bb96f6247ccb61faaa45f2",
|
||||
"reference": "9638d41e3729459860bb96f6247ccb61faaa45f2",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/86c1c929f0a4b24812e1eb109262fc3372c8e9f2",
|
||||
"reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2745,7 +2748,7 @@
|
|||
],
|
||||
"description": "Symfony Finder Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2019-06-28T13:16:30+00:00"
|
||||
"time": "2019-08-14T12:26:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php73",
|
||||
|
@ -2807,16 +2810,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/service-contracts",
|
||||
"version": "v1.1.5",
|
||||
"version": "v1.1.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/service-contracts.git",
|
||||
"reference": "f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d"
|
||||
"reference": "ea7263d6b6d5f798b56a45a5b8d686725f2719a3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d",
|
||||
"reference": "f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d",
|
||||
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/ea7263d6b6d5f798b56a45a5b8d686725f2719a3",
|
||||
"reference": "ea7263d6b6d5f798b56a45a5b8d686725f2719a3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2861,7 +2864,7 @@
|
|||
"interoperability",
|
||||
"standards"
|
||||
],
|
||||
"time": "2019-06-13T11:15:36+00:00"
|
||||
"time": "2019-08-20T14:44:19+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
|
|
@ -9,6 +9,7 @@ use Google\Cloud\Storage\StorageClient;
|
|||
use League\Flysystem\Adapter\Local;
|
||||
use League\Flysystem\AwsS3v3\AwsS3Adapter;
|
||||
use League\Flysystem\Adapter\Ftp as FtpAdapter;
|
||||
use League\Flysystem\FileExistsException;
|
||||
use Spatie\Dropbox\Client as DropboxClient;
|
||||
use League\Flysystem\Filesystem;
|
||||
use Slim\App;
|
||||
|
@ -175,6 +176,18 @@ $app = new App($container);
|
|||
|
||||
$app->get('/', function (Request $request, Response $response) {
|
||||
|
||||
if (!extension_loaded('gd')) {
|
||||
$this->session->alert('The required "gd" extension is not loaded.', 'danger');
|
||||
}
|
||||
|
||||
if (!extension_loaded('intl')) {
|
||||
$this->session->alert('The required "intl" extension is not loaded.', 'danger');
|
||||
}
|
||||
|
||||
if (!extension_loaded('json')) {
|
||||
$this->session->alert('The required "json" extension is not loaded.', 'danger');
|
||||
}
|
||||
|
||||
if (!is_writable(__DIR__ . '/../resources/cache')) {
|
||||
$this->session->alert('The cache folder is not writable (' . __DIR__ . '/../resources/cache' . ')', 'danger');
|
||||
}
|
||||
|
@ -243,20 +256,25 @@ $app->post('/', function (Request $request, Response $response) use (&$config) {
|
|||
|
||||
// check if the storage is valid
|
||||
try {
|
||||
$success = $this->storage->write('storage_test.xbackbone.txt', 'XBACKBONE_TEST_FILE');
|
||||
try {
|
||||
$success = $this->storage->write('storage_test.xbackbone.txt', 'XBACKBONE_TEST_FILE');
|
||||
} catch (FileExistsException $fileExistsException) {
|
||||
$success = $this->storage->update('storage_test.xbackbone.txt', 'XBACKBONE_TEST_FILE');
|
||||
}
|
||||
|
||||
if (!$success) {
|
||||
throw new Exception('The storage is not writable.');
|
||||
}
|
||||
$this->storage->readAndDelete('test.install.txt');
|
||||
} catch (Exception $e) {
|
||||
$this->session->alert("Storage setup error: {$e->getMessage()} [{$e->getTraceAsString()}]", 'danger');
|
||||
return redirect($response, $request->getUri());
|
||||
$this->session->alert("Storage setup error: {$e->getMessage()} [{$e->getCode()}]", 'danger');
|
||||
return redirect($response, '/install');
|
||||
}
|
||||
|
||||
$ret = file_put_contents(__DIR__ . '/../config.php', '<?php' . PHP_EOL . 'return ' . var_export($config, true) . ';');
|
||||
if ($ret === false) {
|
||||
$this->session->alert('The config folder is not writable (' . __DIR__ . '/../config.php' . ')', 'danger');
|
||||
return redirect($response, $request->getUri());
|
||||
return redirect($response, '/install');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,9 +294,9 @@ $app->post('/', function (Request $request, Response $response) use (&$config) {
|
|||
DB::setDsn($config['db']['connection'] . ':' . $dsn, $config['db']['username'], $config['db']['password']);
|
||||
|
||||
migrate($config);
|
||||
} catch (PDOException $exception) {
|
||||
$this->session->alert("Cannot connect to the database: {$exception->getMessage()} [{$exception->getCode()}]", 'danger');
|
||||
return redirect($response, $request->getUri());
|
||||
} catch (PDOException $e) {
|
||||
$this->session->alert("Cannot connect to the database: {$e->getMessage()} [{$e->getCode()}]", 'danger');
|
||||
return redirect($response, '/install');
|
||||
}
|
||||
|
||||
// if not installed, create the default admin account
|
||||
|
@ -299,11 +317,13 @@ $app->post('/', function (Request $request, Response $response) use (&$config) {
|
|||
$ret = file_put_contents(__DIR__ . '/../config.php', '<?php' . PHP_EOL . 'return ' . var_export($config, true) . ';');
|
||||
if ($ret === false) {
|
||||
$this->session->alert('The config folder is not writable (' . __DIR__ . '/../config.php' . ')', 'danger');
|
||||
return redirect($response, $request->getUri());
|
||||
return redirect($response, '/install');
|
||||
}
|
||||
}
|
||||
|
||||
return $response->withRedirect('../?afterInstall=true');
|
||||
// Installed successfully, destroy the installer session
|
||||
session_destroy();
|
||||
return redirect($response, '../?afterInstall=true');
|
||||
});
|
||||
|
||||
$app->run();
|
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -11,9 +11,9 @@
|
|||
}
|
||||
},
|
||||
"@fortawesome/fontawesome-free": {
|
||||
"version": "5.8.2",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.8.2.tgz",
|
||||
"integrity": "sha512-E4fDUF4fbu9AxKpaQQqCN3XBnNzb/5e0Gvd9OaQsYkK574LVI57v/EqqPfIm/mC7jYbxaPNrhvT5AF+Yzwyizg=="
|
||||
"version": "5.10.2",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.10.2.tgz",
|
||||
"integrity": "sha512-9pw+Nsnunl9unstGEHQ+u41wBEQue6XPBsILXtJF/4fNN1L3avJcMF/gGF86rIjeTAgfLjTY9ndm68/X4f4idQ=="
|
||||
},
|
||||
"abbrev": {
|
||||
"version": "1.1.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^5.8.2",
|
||||
"@fortawesome/fontawesome-free": "^5.10.2",
|
||||
"bootstrap": "^4.3.1",
|
||||
"clipboard": "^2.0.4",
|
||||
"highlightjs": "^9.12.0",
|
||||
|
|
Loading…
Reference in a new issue