1
0
Fork 0
mirror of synced 2024-07-04 14:10:33 +12:00

Renamed DatabasePool to Pools

This commit is contained in:
Eldad Fux 2022-10-08 08:51:58 +03:00
parent c23c5c686c
commit a229eac2cc
7 changed files with 23 additions and 23 deletions

View file

@ -131,7 +131,7 @@ App::post('/v1/projects')
'database' => $pdo->getName()
]));
$dbForProject = DatabasePool::getDatabase($pdo->getConnection(), $cache, "_{$project->getInternalId()}");
$dbForProject = Pools::getDatabase($pdo->getConnection(), $cache, "_{$project->getInternalId()}");
$dbForProject->create(App::getEnv('_APP_DB_SCHEMA', 'appwrite'));
$audit = new Audit($dbForProject);

View file

@ -908,14 +908,14 @@ App::setResource('dbForProject', function ($dbPool, $cache, Document $project) {
$database = $dbPool->getConsoleDB();
}
$pdo = $dbPool->getPDOFromPool($database);
$database = DatabasePool::getDatabase($pdo->getConnection(), $cache, "_{$project->getInternalId()}");
$database = Pools::getDatabase($pdo->getConnection(), $cache, "_{$project->getInternalId()}");
return $database;
}, ['dbPool', 'cache', 'project']);
App::setResource('dbForConsole', function ($dbPool, $cache) {
$database = $dbPool->getConsoleDB();
$pdo = $dbPool->getPDOFromPool($database);
$database = DatabasePool::getDatabase($pdo->getConnection(), $cache, '_console');
$database = Pools::getDatabase($pdo->getConnection(), $cache, '_console');
return $database;
}, ['dbPool', 'cache']);

View file

@ -1,7 +1,7 @@
<?php
use Appwrite\Auth\Auth;
use Appwrite\Database\DatabasePool;
use Appwrite\Database\Pools;
use Appwrite\Messaging\Adapter\Realtime;
use Appwrite\Network\Validator\Origin;
use Appwrite\Utopia\Response;
@ -100,8 +100,8 @@ function getDatabase(Registry &$register, string $projectId)
/** Get the console DB */
$database = $dbPool->getConsoleDB();
$pdo = $dbPool->getPDOFromPool($database);
$database = DatabasePool::wait(
DatabasePool::getDatabase($pdo->getConnection(), $redis, '_console'),
$database = Pools::wait(
Pools::getDatabase($pdo->getConnection(), $redis, '_console'),
'realtime'
);
@ -109,8 +109,8 @@ function getDatabase(Registry &$register, string $projectId)
$project = Authorization::skip(fn() => $database->getDocument('projects', $projectId));
$database = $project->getAttribute('database', '');
$pdo = $dbPool->getPDOFromPool($database);
$database = DatabasePool::wait(
DatabasePool::getDatabase($pdo->getConnection(), $redis, "_{$project->getInternalId()}"),
$database = Pools::wait(
Pools::getDatabase($pdo->getConnection(), $redis, "_{$project->getInternalId()}"),
'realtime'
);
}
@ -479,13 +479,13 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
/** Get the console DB */
$database = $dbPool->getConsoleDB();
$pdo = $dbPool->getPDOFromPool($database);
$database = DatabasePool::getDatabase($pdo->getConnection(), $redis, '_console');
$database = Pools::getDatabase($pdo->getConnection(), $redis, '_console');
if ($projectId !== 'console') {
$project = Authorization::skip(fn() => $database->getDocument('projects', $projectId));
$database = $project->getAttribute('database', '');
$pdo = $dbPool->getPDOFromPool($database);
$database = DatabasePool::getDatabase($pdo->getConnection(), $redis, "_{$project->getInternalId()}");
$database = Pools::getDatabase($pdo->getConnection(), $redis, "_{$project->getInternalId()}");
}
/*

View file

@ -96,7 +96,7 @@ $cli
}
try {
$dbPool = $register->get('dbPool'); /* @var $dbPool DatabasePool */
$dbPool = $register->get('dbPool'); /* @var $dbPool Pools */
$database = $dbPool->getConsoleDB();
$pdo = $dbPool->getPDO($database);
Console::success('Database............connected 👍');

View file

@ -3,7 +3,7 @@
global $cli;
use Appwrite\Auth\Auth;
use Appwrite\Database\DatabasePool;
use Appwrite\Database\Pools;
use Appwrite\Event\Certificate;
use Appwrite\Event\Delete;
use Utopia\App;
@ -121,8 +121,8 @@ $cli
$database = $dbPool->getConsoleDB();
$pdo = $dbPool->getPDO($database);
$database = DatabasePool::wait(
DatabasePool::getDatabase($pdo, $redis, '_console'),
$database = Pools::wait(
Pools::getDatabase($pdo, $redis, '_console'),
'certificates',
);

View file

@ -2,7 +2,7 @@
global $cli, $register;
use Appwrite\Database\DatabasePool;
use Appwrite\Database\Pools;
use Appwrite\Usage\Calculators\Aggregator;
use Appwrite\Usage\Calculators\Database;
use Appwrite\Usage\Calculators\TimeSeries;
@ -131,8 +131,8 @@ $cli
$database = $dbPool->getConsoleDB();
$pdo = $dbPool->getPDO($database);
$database = DatabasePool::wait(
DatabasePool::getDatabase($pdo, $redis, '_console'),
$database = Pools::wait(
Pools::getDatabase($pdo, $redis, '_console'),
'projects',
);

View file

@ -2,7 +2,8 @@
namespace Appwrite\Resque;
use Appwrite\Database\DatabasePool;
use Exception;
use Appwrite\Database\Pools;
use Utopia\App;
use Utopia\Database\Database;
use Utopia\Storage\Device;
@ -13,7 +14,6 @@ use Utopia\Storage\Device\Linode;
use Utopia\Storage\Device\Wasabi;
use Utopia\Storage\Device\Backblaze;
use Utopia\Storage\Device\S3;
use Exception;
use Utopia\Database\Document;
use Utopia\Database\Validator\Authorization;
@ -175,8 +175,8 @@ abstract class Worker
$dbPool = $register->get('dbPool');
$namespace = "_$internalId";
$pdo = $dbPool->getPDO($database);
$dbForProject = DatabasePool::wait(
DatabasePool::getDatabase($pdo, $cache, $namespace),
$dbForProject = Pools::wait(
Pools::getDatabase($pdo, $cache, $namespace),
'projects'
);
@ -199,8 +199,8 @@ abstract class Worker
$namespace = "_console";
$pdo = $dbPool->getPDO($database);
$dbForConsole = DatabasePool::wait(
DatabasePool::getDatabase($pdo, $cache, $namespace),
$dbForConsole = Pools::wait(
Pools::getDatabase($pdo, $cache, $namespace),
'_metadata'
);