Fixed error with cli command
This commit is contained in:
parent
5a7c74c5d9
commit
2303cb263f
5 changed files with 28 additions and 5 deletions
|
@ -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.
|
||||
|
|
15
bin/migrate
15
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)]);
|
||||
|
|
|
@ -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": {
|
||||
|
|
2
composer.lock
generated
2
composer.lock
generated
|
@ -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",
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue