Skip to content

Commit

Permalink
Fixed error with cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
sergix44 committed Apr 13, 2020
1 parent 5a7c74c commit 2303cb2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 12 additions & 3 deletions bin/migrate
Original file line number Diff line number Diff line change
Expand Up @@ -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);

$builder = new ContainerBuilder();
$builder->addDefinitions(BASE_DIR.'bootstrap/container.php');

$container = $builder->build();
$container->set('config', $config);

$db = new DB(dsnFromConfig($config), $config['db']['username'], $config['db']['password']);
$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 ('[email protected]', 'admin', ?, 1, ?)", [password_hash('admin', PASSWORD_DEFAULT), humanRandomString(5)]);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2303cb2

Please sign in to comment.