From 2303cb263f8d1725e2529b99fb1b8152ee864033 Mon Sep 17 00:00:00 2001 From: Sergio Brighenti Date: Mon, 13 Apr 2020 17:46:10 +0200 Subject: [PATCH] Fixed error with cli command --- CHANGELOG.md | 7 +++++++ bin/migrate | 15 ++++++++++++--- composer.json | 2 +- composer.lock | 2 +- docs/changelog.md | 7 +++++++ 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1c2452..b19c25a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [3.1.4] - 2020-04-13 +### Changed +- Now the migrate command resync the system quota for each user. + +### Fixed +- Fixed error with the migrate command. + ## [3.1.3] - 2020-04-13 ### Changed - Added changelog page. diff --git a/bin/migrate b/bin/migrate index 6d1c9f5..e95f3e7 100644 --- a/bin/migrate +++ b/bin/migrate @@ -5,23 +5,32 @@ if (php_sapi_name() !== 'cli') { die(); } -use App\Database\DB; use App\Database\Migrator; +use DI\ContainerBuilder; require __DIR__.'/../vendor/autoload.php'; +define('BASE_DIR', realpath(__DIR__.'/../').DIRECTORY_SEPARATOR); + $config = include __DIR__.'/../config.php'; if (!$config) { die('config.php not found. Please create a new one.'); } -chdir(__DIR__.'/../'); +chdir(BASE_DIR); -$db = new DB(dsnFromConfig($config), $config['db']['username'], $config['db']['password']); +$builder = new ContainerBuilder(); +$builder->addDefinitions(BASE_DIR.'bootstrap/container.php'); + +$container = $builder->build(); +$container->set('config', $config); + +$db = $container->get('database'); $migrator = new Migrator($db, 'resources/schemas'); $migrator->migrate(); +$migrator->reSyncQuotas($container->get('storage')); if (isset($argv[1]) && $argv[1] === '--install') { $db->query("INSERT INTO `users` (`email`, `username`, `password`, `is_admin`, `user_code`) VALUES ('admin@example.com', 'admin', ?, 1, ?)", [password_hash('admin', PASSWORD_DEFAULT), humanRandomString(5)]); diff --git a/composer.json b/composer.json index f6830f0..ad310b2 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "sergix44/xbackbone", "license": "AGPL-3.0", - "version": "3.1.3", + "version": "3.1.4", "description": "A lightweight ShareX PHP backend", "type": "project", "require": { diff --git a/composer.lock b/composer.lock index f445521..4254b05 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "3a1bab97259e3ebc3e6ffcdeeae0f8c0", + "content-hash": "ff10819e8baf13d2451593e29f1d76a2", "packages": [ { "name": "aws/aws-sdk-php", diff --git a/docs/changelog.md b/docs/changelog.md index 44d1172..8dae226 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -8,6 +8,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [3.1.4] - 2020-04-13 +### Changed +- Now the migrate command resync the system quota for each user. + +### Fixed +- Fixed error with the migrate command. + ## [3.1.3] - 2020-04-13 ### Changed - Added changelog page.