Fixed error with migrate command (closes #115)

This commit is contained in:
Sergio Brighenti 2019-12-04 12:27:23 +01:00
parent 3b8eba3b5e
commit 3b7e2fadde
7 changed files with 85 additions and 80 deletions

View file

@ -1,3 +1,7 @@
## v.3.0.2
+ Fixed error with migrate command.
+ Updated translations.
## v.3.0.1
+ Fixed error with older mysql versions.
+ Fixed config is compiled with the di container.

View file

@ -436,13 +436,14 @@ if (!function_exists('dsnFromConfig')) {
/**
* Return the database DSN from config.
*
* @param array $config
* @param array $config
*
* @param string $baseDir
* @return string
*/
function dsnFromConfig(array $config): string
function dsnFromConfig(array $config, $baseDir = BASE_DIR): string
{
$dsn = $config['db']['connection'] === 'sqlite' ? BASE_DIR.$config['db']['dsn'] : $config['db']['dsn'];
$dsn = $config['db']['connection'] === 'sqlite' ? $baseDir.$config['db']['dsn'] : $config['db']['dsn'];
return $config['db']['connection'].':'.$dsn;
}

View file

@ -24,7 +24,7 @@ if ($config['db']['connection'] === 'sqlite' && !file_exists(__DIR__.'/../'.$con
$firstMigrate = true;
}
$db = new DB(dsnFromConfig($config), $config['db']['username'], $config['db']['password']);
$db = new DB(dsnFromConfig($config, getcwd().DIRECTORY_SEPARATOR), $config['db']['username'], $config['db']['password']);
$migrator = new Migrator($db, 'resources/schemas', $firstMigrate);
$migrator->migrate();

View file

@ -1,6 +1,6 @@
{
"name": "sergix44/xbackbone",
"version": "3.0.1",
"version": "3.0.2",
"description": "A lightweight ShareX PHP backend",
"type": "project",
"require": {

142
composer.lock generated
View file

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "142d01d6c92e762a71ad2f2e7890e522",
"content-hash": "9e8abd66e7b27ece61e41aae2cc27114",
"packages": [
{
"name": "aws/aws-sdk-php",
"version": "3.122.0",
"version": "3.127.0",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "43b4af8179c91d220f6e4bbe1e57588ed5ad4f27"
"reference": "c7f8c962ad2bb1430e673f14505870d8573a55d6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/43b4af8179c91d220f6e4bbe1e57588ed5ad4f27",
"reference": "43b4af8179c91d220f6e4bbe1e57588ed5ad4f27",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/c7f8c962ad2bb1430e673f14505870d8573a55d6",
"reference": "c7f8c962ad2bb1430e673f14505870d8573a55d6",
"shasum": ""
},
"require": {
@ -42,7 +42,8 @@
"nette/neon": "^2.3",
"phpunit/phpunit": "^4.8.35|^5.4.3",
"psr/cache": "^1.0",
"psr/simple-cache": "^1.0"
"psr/simple-cache": "^1.0",
"sebastian/comparator": "^1.2.3"
},
"suggest": {
"aws/aws-php-sns-message-validator": "To validate incoming SNS notifications",
@ -87,7 +88,7 @@
"s3",
"sdk"
],
"time": "2019-11-25T19:13:38+00:00"
"time": "2019-12-04T01:40:14+00:00"
},
{
"name": "firebase/php-jwt",
@ -1862,15 +1863,15 @@
"authors": [
{
"name": "Freek Van der Herten",
"role": "Developer",
"email": "freek@spatie.be",
"homepage": "https://spatie.be"
"homepage": "https://spatie.be",
"role": "Developer"
},
{
"name": "Alex Vanderbist",
"role": "Developer",
"email": "alex.vanderbist@gmail.com",
"homepage": "https://spatie.be"
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "A minimal implementation of Dropbox API v2",
@ -1886,16 +1887,16 @@
},
{
"name": "spatie/flysystem-dropbox",
"version": "1.2.1",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/spatie/flysystem-dropbox.git",
"reference": "8aa19e6f63d36f66d716f13a4d4dec23012d16e2"
"reference": "512e8d59b3f9b8a6710f932c421032cb490e9869"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/flysystem-dropbox/zipball/8aa19e6f63d36f66d716f13a4d4dec23012d16e2",
"reference": "8aa19e6f63d36f66d716f13a4d4dec23012d16e2",
"url": "https://api.github.com/repos/spatie/flysystem-dropbox/zipball/512e8d59b3f9b8a6710f932c421032cb490e9869",
"reference": "512e8d59b3f9b8a6710f932c421032cb490e9869",
"shasum": ""
},
"require": {
@ -1934,7 +1935,7 @@
"spatie",
"v2"
],
"time": "2019-09-14T17:00:10+00:00"
"time": "2019-12-04T08:18:17+00:00"
},
{
"name": "superbalist/flysystem-google-storage",
@ -1985,16 +1986,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.12.0",
"version": "v1.13.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "550ebaac289296ce228a706d0867afc34687e3f4"
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4",
"reference": "550ebaac289296ce228a706d0867afc34687e3f4",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
"shasum": ""
},
"require": {
@ -2006,7 +2007,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.12-dev"
"dev-master": "1.13-dev"
}
},
"autoload": {
@ -2039,20 +2040,20 @@
"polyfill",
"portable"
],
"time": "2019-08-06T08:03:45+00:00"
"time": "2019-11-27T13:56:44+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.12.0",
"version": "v1.13.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17"
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17",
"reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f",
"shasum": ""
},
"require": {
@ -2064,7 +2065,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.12-dev"
"dev-master": "1.13-dev"
}
},
"autoload": {
@ -2098,20 +2099,20 @@
"portable",
"shim"
],
"time": "2019-08-06T08:03:45+00:00"
"time": "2019-11-27T14:18:11+00:00"
},
{
"name": "symfony/polyfill-php56",
"version": "v1.12.0",
"version": "v1.13.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php56.git",
"reference": "0e3b212e96a51338639d8ce175c046d7729c3403"
"reference": "53dd1cdf3cb986893ccf2b96665b25b3abb384f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/0e3b212e96a51338639d8ce175c046d7729c3403",
"reference": "0e3b212e96a51338639d8ce175c046d7729c3403",
"url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/53dd1cdf3cb986893ccf2b96665b25b3abb384f4",
"reference": "53dd1cdf3cb986893ccf2b96665b25b3abb384f4",
"shasum": ""
},
"require": {
@ -2121,7 +2122,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.12-dev"
"dev-master": "1.13-dev"
}
},
"autoload": {
@ -2154,20 +2155,20 @@
"portable",
"shim"
],
"time": "2019-08-06T08:03:45+00:00"
"time": "2019-11-27T13:56:44+00:00"
},
{
"name": "symfony/polyfill-util",
"version": "v1.12.0",
"version": "v1.13.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-util.git",
"reference": "4317de1386717b4c22caed7725350a8887ab205c"
"reference": "964a67f293b66b95883a5ed918a65354fcd2258f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-util/zipball/4317de1386717b4c22caed7725350a8887ab205c",
"reference": "4317de1386717b4c22caed7725350a8887ab205c",
"url": "https://api.github.com/repos/symfony/polyfill-util/zipball/964a67f293b66b95883a5ed918a65354fcd2258f",
"reference": "964a67f293b66b95883a5ed918a65354fcd2258f",
"shasum": ""
},
"require": {
@ -2176,7 +2177,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.12-dev"
"dev-master": "1.13-dev"
}
},
"autoload": {
@ -2206,7 +2207,7 @@
"polyfill",
"shim"
],
"time": "2019-08-06T08:03:45+00:00"
"time": "2019-11-27T13:56:44+00:00"
},
{
"name": "twig/twig",
@ -2901,35 +2902,34 @@
},
{
"name": "ocramius/package-versions",
"version": "1.5.1",
"version": "1.4.2",
"source": {
"type": "git",
"url": "https://github.com/Ocramius/PackageVersions.git",
"reference": "1d32342b8c1eb27353c8887c366147b4c2da673c"
"reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/1d32342b8c1eb27353c8887c366147b4c2da673c",
"reference": "1d32342b8c1eb27353c8887c366147b4c2da673c",
"url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/44af6f3a2e2e04f2af46bcb302ad9600cba41c7d",
"reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0.0",
"php": "^7.3.0"
"php": "^7.1.0"
},
"require-dev": {
"composer/composer": "^1.8.6",
"doctrine/coding-standard": "^6.0.0",
"composer/composer": "^1.6.3",
"doctrine/coding-standard": "^5.0.1",
"ext-zip": "*",
"infection/infection": "^0.13.4",
"phpunit/phpunit": "^8.2.5",
"vimeo/psalm": "^3.4.9"
"infection/infection": "^0.7.1",
"phpunit/phpunit": "^7.5.17"
},
"type": "composer-plugin",
"extra": {
"class": "PackageVersions\\Installer",
"branch-alias": {
"dev-master": "1.6.x-dev"
"dev-master": "2.0.x-dev"
}
},
"autoload": {
@ -2948,7 +2948,7 @@
}
],
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
"time": "2019-07-17T15:49:50+00:00"
"time": "2019-11-15T16:17:10+00:00"
},
{
"name": "phpstan/phpdoc-parser",
@ -3074,16 +3074,16 @@
},
{
"name": "symfony/console",
"version": "v4.4.0",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "35d9077f495c6d184d9930f7a7ecbd1ad13c7ab8"
"reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/35d9077f495c6d184d9930f7a7ecbd1ad13c7ab8",
"reference": "35d9077f495c6d184d9930f7a7ecbd1ad13c7ab8",
"url": "https://api.github.com/repos/symfony/console/zipball/f0aea3df20d15635b3cb9730ca5eea1c65b7f201",
"reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201",
"shasum": ""
},
"require": {
@ -3146,11 +3146,11 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2019-11-13T07:39:40+00:00"
"time": "2019-12-01T10:06:17+00:00"
},
{
"name": "symfony/finder",
"version": "v4.4.0",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
@ -3199,16 +3199,16 @@
},
{
"name": "symfony/polyfill-php73",
"version": "v1.12.0",
"version": "v1.13.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php73.git",
"reference": "2ceb49eaccb9352bff54d22570276bb75ba4a188"
"reference": "4b0e2222c55a25b4541305a053013d5647d3a25f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/2ceb49eaccb9352bff54d22570276bb75ba4a188",
"reference": "2ceb49eaccb9352bff54d22570276bb75ba4a188",
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f",
"reference": "4b0e2222c55a25b4541305a053013d5647d3a25f",
"shasum": ""
},
"require": {
@ -3217,7 +3217,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.12-dev"
"dev-master": "1.13-dev"
}
},
"autoload": {
@ -3253,24 +3253,24 @@
"portable",
"shim"
],
"time": "2019-08-06T08:03:45+00:00"
"time": "2019-11-27T16:25:15+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v2.0.0",
"version": "v1.1.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "9d99e1556417bf227a62e14856d630672bf10eaf"
"reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/9d99e1556417bf227a62e14856d630672bf10eaf",
"reference": "9d99e1556417bf227a62e14856d630672bf10eaf",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffc7f5692092df31515df2a5ecf3b7302b3ddacf",
"reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf",
"shasum": ""
},
"require": {
"php": "^7.2.9",
"php": "^7.1.3",
"psr/container": "^1.0"
},
"suggest": {
@ -3279,7 +3279,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "1.1-dev"
}
},
"autoload": {
@ -3311,7 +3311,7 @@
"interoperability",
"standards"
],
"time": "2019-11-09T09:18:34+00:00"
"time": "2019-10-14T12:27:06+00:00"
}
],
"aliases": [],

6
package-lock.json generated
View file

@ -103,9 +103,9 @@
}
},
"bootstrap": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.3.1.tgz",
"integrity": "sha512-rXqOmH1VilAt2DyPzluTi2blhk17bO7ef+zLLPlWvG494pDxcM234pJ8wTc/6R40UWizAIIMgxjvxZg5kmsbag=="
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.4.1.tgz",
"integrity": "sha512-tbx5cHubwE6e2ZG7nqM3g/FZ5PQEDMWmMGNrCUBVRPHXTJaH7CBDdsLeu3eCh3B1tzAxTnAbtmrzvWEvT2NNEA=="
},
"brace-expansion": {
"version": "1.1.11",

View file

@ -1,7 +1,7 @@
{
"dependencies": {
"@fortawesome/fontawesome-free": "^5.11.2",
"bootstrap": "^4.3.1",
"bootstrap": "^4.4.1",
"clipboard": "^2.0.4",
"dropzone": "^5.5.1",
"highlightjs": "^9.16.2",