feat: update dbPool class
This commit is contained in:
parent
43ec31e393
commit
392775b9ab
3 changed files with 25 additions and 27 deletions
26
composer.lock
generated
26
composer.lock
generated
|
@ -236,16 +236,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "chillerlan/php-settings-container",
|
"name": "chillerlan/php-settings-container",
|
||||||
"version": "2.1.3",
|
"version": "2.1.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/chillerlan/php-settings-container.git",
|
"url": "https://github.com/chillerlan/php-settings-container.git",
|
||||||
"reference": "125dd573b45ffc7cabecf385986a356ba2c6f602"
|
"reference": "1beb7df3c14346d4344b0b2e12f6f9a74feabd4a"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/125dd573b45ffc7cabecf385986a356ba2c6f602",
|
"url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/1beb7df3c14346d4344b0b2e12f6f9a74feabd4a",
|
||||||
"reference": "125dd573b45ffc7cabecf385986a356ba2c6f602",
|
"reference": "1beb7df3c14346d4344b0b2e12f6f9a74feabd4a",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -296,20 +296,20 @@
|
||||||
"type": "ko_fi"
|
"type": "ko_fi"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2022-03-09T13:18:58+00:00"
|
"time": "2022-07-05T22:32:14+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "colinmollenhour/credis",
|
"name": "colinmollenhour/credis",
|
||||||
"version": "v1.13.0",
|
"version": "v1.13.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/colinmollenhour/credis.git",
|
"url": "https://github.com/colinmollenhour/credis.git",
|
||||||
"reference": "afec8e58ec93d2291c127fa19709a048f28641e5"
|
"reference": "85df015088e00daf8ce395189de22c8eb45c8d49"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/colinmollenhour/credis/zipball/afec8e58ec93d2291c127fa19709a048f28641e5",
|
"url": "https://api.github.com/repos/colinmollenhour/credis/zipball/85df015088e00daf8ce395189de22c8eb45c8d49",
|
||||||
"reference": "afec8e58ec93d2291c127fa19709a048f28641e5",
|
"reference": "85df015088e00daf8ce395189de22c8eb45c8d49",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -341,9 +341,9 @@
|
||||||
"homepage": "https://github.com/colinmollenhour/credis",
|
"homepage": "https://github.com/colinmollenhour/credis",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/colinmollenhour/credis/issues",
|
"issues": "https://github.com/colinmollenhour/credis/issues",
|
||||||
"source": "https://github.com/colinmollenhour/credis/tree/v1.13.0"
|
"source": "https://github.com/colinmollenhour/credis/tree/v1.13.1"
|
||||||
},
|
},
|
||||||
"time": "2022-04-07T14:57:22+00:00"
|
"time": "2022-06-20T22:56:59+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "composer/package-versions-deprecated",
|
"name": "composer/package-versions-deprecated",
|
||||||
|
@ -1639,7 +1639,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/deprecation-contracts",
|
"name": "symfony/deprecation-contracts",
|
||||||
"version": "v3.1.0",
|
"version": "v3.1.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/deprecation-contracts.git",
|
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||||
|
@ -1686,7 +1686,7 @@
|
||||||
"description": "A generic function and convention to trigger deprecation notices",
|
"description": "A generic function and convention to trigger deprecation notices",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.0"
|
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.1"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -316,7 +316,6 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./app:/usr/src/code/app
|
- ./app:/usr/src/code/app
|
||||||
- ./src:/usr/src/code/src
|
- ./src:/usr/src/code/src
|
||||||
# - ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
- mariadb
|
- mariadb
|
||||||
|
@ -693,15 +692,15 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- appwrite
|
- appwrite
|
||||||
|
|
||||||
# redis-commander:
|
redis-commander:
|
||||||
# image: rediscommander/redis-commander:latest
|
image: rediscommander/redis-commander:latest
|
||||||
# restart: unless-stopped
|
restart: unless-stopped
|
||||||
# networks:
|
networks:
|
||||||
# - appwrite
|
- appwrite
|
||||||
# environment:
|
environment:
|
||||||
# - REDIS_HOSTS=redis
|
- REDIS_HOSTS=redis
|
||||||
# ports:
|
ports:
|
||||||
# - "8081:8081"
|
- "8081:8081"
|
||||||
|
|
||||||
# resque:
|
# resque:
|
||||||
# image: appwrite/resque-web:1.1.0
|
# image: appwrite/resque-web:1.1.0
|
||||||
|
|
|
@ -123,7 +123,6 @@ class DatabasePool {
|
||||||
|
|
||||||
$pdo = $this->getPDO($this->consoleDB);
|
$pdo = $this->getPDO($this->consoleDB);
|
||||||
$cache = new Cache(new RedisCache($redis));
|
$cache = new Cache(new RedisCache($redis));
|
||||||
|
|
||||||
$database = new Database(new MariaDB($pdo), $cache);
|
$database = new Database(new MariaDB($pdo), $cache);
|
||||||
$database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite'));
|
$database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite'));
|
||||||
$database->setNamespace("_console");
|
$database->setNamespace("_console");
|
||||||
|
@ -141,10 +140,10 @@ class DatabasePool {
|
||||||
*
|
*
|
||||||
* @return ?Database
|
* @return ?Database
|
||||||
*/
|
*/
|
||||||
public function getDB(string $projectID, \Redis $cache): ?Database
|
public function getDB(string $projectID, \Redis $redis): ?Database
|
||||||
{
|
{
|
||||||
/** Get DB name from the console database */
|
/** Get DB name from the console database */
|
||||||
$name = $this->getName($projectID, $cache);
|
$name = $this->getName($projectID, $redis);
|
||||||
|
|
||||||
if (empty($name)) {
|
if (empty($name)) {
|
||||||
throw new Exception("Database with name : $name not found.", 500);
|
throw new Exception("Database with name : $name not found.", 500);
|
||||||
|
@ -152,7 +151,7 @@ class DatabasePool {
|
||||||
|
|
||||||
/** Get a PDO instance using the databse name */
|
/** Get a PDO instance using the databse name */
|
||||||
$pdo = $this->getPDO($name);
|
$pdo = $this->getPDO($name);
|
||||||
$cache = new Cache(new RedisCache($cache));
|
$cache = new Cache(new RedisCache($redis));
|
||||||
$database = new Database(new MariaDB($pdo), $cache);
|
$database = new Database(new MariaDB($pdo), $cache);
|
||||||
$database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite'));
|
$database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite'));
|
||||||
$database->setNamespace("_{$projectID}");
|
$database->setNamespace("_{$projectID}");
|
||||||
|
|
Loading…
Reference in a new issue