From 63c332a69785a10f411fdab2af8cc9e716106749 Mon Sep 17 00:00:00 2001 From: Sergio Brighenti Date: Mon, 6 Apr 2020 12:43:47 +0200 Subject: [PATCH] 3.1.RC1 Fixed installer issues --- CHANGELOG.md | 2 +- Gruntfile.js | 2 +- app/helpers.php | 7 ++++- bootstrap/app.php | 2 +- composer.json | 3 +- composer.lock | 52 +++++++++++++++++++++++++++++++++- docs/changelog.md | 2 +- docs/installation.md | 2 +- install/index.php | 5 ++-- install/templates/install.twig | 12 ++++---- src/js/installer.js | 6 ++-- 11 files changed, 75 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a172e67..dcf37ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## v.3.1 (WIP) +## v.3.1 + Added tagging system (add, delete, search of tagged files). + Added basic media auto-tagging on upload. + Added registration system. diff --git a/Gruntfile.js b/Gruntfile.js index ea0939e..92a09f1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -154,7 +154,7 @@ module.exports = function (grunt) { command: '"./vendor/bin/phpstan" analyse app resources/lang bin install' }, composer_no_dev: { - command: 'composer install --no-dev' + command: 'composer install --no-dev --prefer-dist' } } diff --git a/app/helpers.php b/app/helpers.php index af107e0..5c5a478 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -468,7 +468,12 @@ if (!function_exists('dsnFromConfig')) { */ function dsnFromConfig(array $config): string { - return $config['db']['connection'].':'.$config['db']['dsn']; + $dsn = $config['db']['dsn']; + if ($config['db']['connection'] === 'sqlite' && file_exists($config['db']['dsn'])) { + $dsn = realpath($config['db']['dsn']); + } + + return $config['db']['connection'].':'.$dsn; } } diff --git a/bootstrap/app.php b/bootstrap/app.php index b552f9c..29c2175 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -34,7 +34,7 @@ $config = array_replace_recursive([ 'maintenance' => false, 'db' => [ 'connection' => 'sqlite', - 'dsn' => BASE_DIR.'resources/database/xbackbone.db', + 'dsn' => BASE_DIR.implode(DIRECTORY_SEPARATOR, ['resources', 'database', 'xbackbone.db']), 'username' => null, 'password' => null, ], diff --git a/composer.json b/composer.json index c13bf6e..937d7f0 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "slim/slim": "^4.0", "spatie/flysystem-dropbox": "^1.0", "superbalist/flysystem-google-storage": "^7.2", - "twig/twig": "^2.12" + "twig/twig": "^2.12", + "avto-dev/composer-cleanup-plugin": "^2.0" }, "config": { "optimize-autoloader": true, diff --git a/composer.lock b/composer.lock index bad4178..6b393b4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,58 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "979e04cb72a48a50d7872132f8efa29f", + "content-hash": "1963bb9b1a8f5fad240b9f85112ac008", "packages": [ + { + "name": "avto-dev/composer-cleanup-plugin", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/avto-dev/composer-cleanup-plugin.git", + "reference": "62d55ce097b7ea4336fa89b872ef21cacd5f82cd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/avto-dev/composer-cleanup-plugin/zipball/62d55ce097b7ea4336fa89b872ef21cacd5f82cd", + "reference": "62d55ce097b7ea4336fa89b872ef21cacd5f82cd", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "php": "^7.1.3" + }, + "require-dev": { + "composer/composer": "^1.8.6", + "phpstan/phpstan": "~0.12", + "phpunit/phpunit": "~7.5", + "symfony/var-dumper": "~3.2 || ^4.0" + }, + "type": "composer-plugin", + "extra": { + "class": "AvtoDev\\Composer\\Cleanup\\Plugin" + }, + "autoload": { + "psr-4": { + "AvtoDev\\Composer\\Cleanup\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "avto-dev", + "homepage": "https://github.com/avto-dev" + }, + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "A composer cleanup plugin, to remove tests and documentation to save space", + "time": "2020-02-09T18:06:15+00:00" + }, { "name": "aws/aws-sdk-php", "version": "3.134.3", diff --git a/docs/changelog.md b/docs/changelog.md index 59474da..2692da3 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,7 +4,7 @@ title: Changelog nav_order: 8 --- -## v.3.1 (WIP) +## v.3.1 + Added tagging system (add, delete, search of tagged files). + Added basic media auto-tagging on upload. + Added registration system. diff --git a/docs/installation.md b/docs/installation.md index eaeaa3b..a1f1b36 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -44,7 +44,7 @@ return [ ], 'db' => [ 'connection' => 'sqlite', // current support for sqlite and mysql - 'dsn' => realpath(__DIR__).'/resources/database/xbackbone.db', // if sqlite, this must be an absolute path + 'dsn' => 'abs/path/to/resources/database/xbackbone.db', // if sqlite should be an absolute path 'username' => null, // username and password not needed for sqlite 'password' => null, ] diff --git a/install/index.php b/install/index.php index 2024e44..80e93b1 100644 --- a/install/index.php +++ b/install/index.php @@ -6,7 +6,6 @@ require __DIR__.'/../vendor/autoload.php'; use App\Database\DB; use App\Database\Migrator; use App\Factories\ViewFactory; -use App\Web\Media; use App\Web\Session; use App\Web\View; use DI\Bridge\Slim\Bridge; @@ -29,7 +28,7 @@ $config = [ 'debug' => true, 'db' => [ 'connection' => 'sqlite', - 'dsn' => realpath(__DIR__.'/../').DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, ['resources', 'database', 'xbackbone.db']), + 'dsn' => BASE_DIR.implode(DIRECTORY_SEPARATOR, ['resources', 'database', 'xbackbone.db']), 'username' => null, 'password' => null, ], @@ -227,7 +226,7 @@ $app->post('/', function (Request $request, Response $response, Filesystem $stor cleanDirectory(__DIR__.'/../resources/cache'); cleanDirectory(__DIR__.'/../resources/sessions'); - //removeDirectory(__DIR__.'/../install'); + removeDirectory(__DIR__.'/../install'); // Installed successfully, destroy the installer session $session->destroy(); diff --git a/install/templates/install.twig b/install/templates/install.twig index 673daf5..d4a986e 100644 --- a/install/templates/install.twig +++ b/install/templates/install.twig @@ -6,13 +6,13 @@ - - - + + + - - - + + +
diff --git a/src/js/installer.js b/src/js/installer.js index 7a51a79..4c4b474 100644 --- a/src/js/installer.js +++ b/src/js/installer.js @@ -10,15 +10,15 @@ $(document).ready(function () { $connection.change(function () { $allDatabaseOptions.hide(); - $allDatabaseInputs.prop('required', ''); + $allDatabaseInputs.prop('required', '').prop('disabled', 'disabled'); switch ($(this).val()) { case 'sqlite': $('#dsn').val(sqliteDSN); break; case 'mysql': $('#dsn').val('host=localhost;port=3306;dbname=xbackbone'); - $('#db_user').prop('required', 'required').parent().parent().show(); - $('#db_password').prop('required', 'required').parent().parent().show(); + $('#db_user').prop('disabled', '').prop('required', 'required').parent().parent().show(); + $('#db_password').prop('disabled', '').prop('required', 'required').parent().parent().show(); break; } });