1
0
Fork 0
mirror of synced 2024-06-30 04:00:34 +12:00

feat: update dbPool class

This commit is contained in:
Christy Jacob 2022-07-14 03:33:25 +04:00
parent 43ec31e393
commit 392775b9ab
3 changed files with 25 additions and 27 deletions

26
composer.lock generated
View file

@ -236,16 +236,16 @@
},
{
"name": "chillerlan/php-settings-container",
"version": "2.1.3",
"version": "2.1.4",
"source": {
"type": "git",
"url": "https://github.com/chillerlan/php-settings-container.git",
"reference": "125dd573b45ffc7cabecf385986a356ba2c6f602"
"reference": "1beb7df3c14346d4344b0b2e12f6f9a74feabd4a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/125dd573b45ffc7cabecf385986a356ba2c6f602",
"reference": "125dd573b45ffc7cabecf385986a356ba2c6f602",
"url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/1beb7df3c14346d4344b0b2e12f6f9a74feabd4a",
"reference": "1beb7df3c14346d4344b0b2e12f6f9a74feabd4a",
"shasum": ""
},
"require": {
@ -296,20 +296,20 @@
"type": "ko_fi"
}
],
"time": "2022-03-09T13:18:58+00:00"
"time": "2022-07-05T22:32:14+00:00"
},
{
"name": "colinmollenhour/credis",
"version": "v1.13.0",
"version": "v1.13.1",
"source": {
"type": "git",
"url": "https://github.com/colinmollenhour/credis.git",
"reference": "afec8e58ec93d2291c127fa19709a048f28641e5"
"reference": "85df015088e00daf8ce395189de22c8eb45c8d49"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/colinmollenhour/credis/zipball/afec8e58ec93d2291c127fa19709a048f28641e5",
"reference": "afec8e58ec93d2291c127fa19709a048f28641e5",
"url": "https://api.github.com/repos/colinmollenhour/credis/zipball/85df015088e00daf8ce395189de22c8eb45c8d49",
"reference": "85df015088e00daf8ce395189de22c8eb45c8d49",
"shasum": ""
},
"require": {
@ -341,9 +341,9 @@
"homepage": "https://github.com/colinmollenhour/credis",
"support": {
"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",
@ -1639,7 +1639,7 @@
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.1.0",
"version": "v3.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
@ -1686,7 +1686,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.0"
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.1"
},
"funding": [
{

View file

@ -316,7 +316,6 @@ services:
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
# - ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database
depends_on:
- redis
- mariadb
@ -693,15 +692,15 @@ services:
networks:
- appwrite
# redis-commander:
# image: rediscommander/redis-commander:latest
# restart: unless-stopped
# networks:
# - appwrite
# environment:
# - REDIS_HOSTS=redis
# ports:
# - "8081:8081"
redis-commander:
image: rediscommander/redis-commander:latest
restart: unless-stopped
networks:
- appwrite
environment:
- REDIS_HOSTS=redis
ports:
- "8081:8081"
# resque:
# image: appwrite/resque-web:1.1.0

View file

@ -123,7 +123,6 @@ class DatabasePool {
$pdo = $this->getPDO($this->consoleDB);
$cache = new Cache(new RedisCache($redis));
$database = new Database(new MariaDB($pdo), $cache);
$database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite'));
$database->setNamespace("_console");
@ -141,10 +140,10 @@ class DatabasePool {
*
* @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 */
$name = $this->getName($projectID, $cache);
$name = $this->getName($projectID, $redis);
if (empty($name)) {
throw new Exception("Database with name : $name not found.", 500);
@ -152,7 +151,7 @@ class DatabasePool {
/** Get a PDO instance using the databse 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->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite'));
$database->setNamespace("_{$projectID}");