Renamed DatabasePool to Pools
This commit is contained in:
parent
c23c5c686c
commit
a229eac2cc
7 changed files with 23 additions and 23 deletions
|
@ -131,7 +131,7 @@ App::post('/v1/projects')
|
||||||
'database' => $pdo->getName()
|
'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'));
|
$dbForProject->create(App::getEnv('_APP_DB_SCHEMA', 'appwrite'));
|
||||||
|
|
||||||
$audit = new Audit($dbForProject);
|
$audit = new Audit($dbForProject);
|
||||||
|
|
|
@ -908,14 +908,14 @@ App::setResource('dbForProject', function ($dbPool, $cache, Document $project) {
|
||||||
$database = $dbPool->getConsoleDB();
|
$database = $dbPool->getConsoleDB();
|
||||||
}
|
}
|
||||||
$pdo = $dbPool->getPDOFromPool($database);
|
$pdo = $dbPool->getPDOFromPool($database);
|
||||||
$database = DatabasePool::getDatabase($pdo->getConnection(), $cache, "_{$project->getInternalId()}");
|
$database = Pools::getDatabase($pdo->getConnection(), $cache, "_{$project->getInternalId()}");
|
||||||
return $database;
|
return $database;
|
||||||
}, ['dbPool', 'cache', 'project']);
|
}, ['dbPool', 'cache', 'project']);
|
||||||
|
|
||||||
App::setResource('dbForConsole', function ($dbPool, $cache) {
|
App::setResource('dbForConsole', function ($dbPool, $cache) {
|
||||||
$database = $dbPool->getConsoleDB();
|
$database = $dbPool->getConsoleDB();
|
||||||
$pdo = $dbPool->getPDOFromPool($database);
|
$pdo = $dbPool->getPDOFromPool($database);
|
||||||
$database = DatabasePool::getDatabase($pdo->getConnection(), $cache, '_console');
|
$database = Pools::getDatabase($pdo->getConnection(), $cache, '_console');
|
||||||
return $database;
|
return $database;
|
||||||
}, ['dbPool', 'cache']);
|
}, ['dbPool', 'cache']);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Appwrite\Auth\Auth;
|
use Appwrite\Auth\Auth;
|
||||||
use Appwrite\Database\DatabasePool;
|
use Appwrite\Database\Pools;
|
||||||
use Appwrite\Messaging\Adapter\Realtime;
|
use Appwrite\Messaging\Adapter\Realtime;
|
||||||
use Appwrite\Network\Validator\Origin;
|
use Appwrite\Network\Validator\Origin;
|
||||||
use Appwrite\Utopia\Response;
|
use Appwrite\Utopia\Response;
|
||||||
|
@ -100,8 +100,8 @@ function getDatabase(Registry &$register, string $projectId)
|
||||||
/** Get the console DB */
|
/** Get the console DB */
|
||||||
$database = $dbPool->getConsoleDB();
|
$database = $dbPool->getConsoleDB();
|
||||||
$pdo = $dbPool->getPDOFromPool($database);
|
$pdo = $dbPool->getPDOFromPool($database);
|
||||||
$database = DatabasePool::wait(
|
$database = Pools::wait(
|
||||||
DatabasePool::getDatabase($pdo->getConnection(), $redis, '_console'),
|
Pools::getDatabase($pdo->getConnection(), $redis, '_console'),
|
||||||
'realtime'
|
'realtime'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -109,8 +109,8 @@ function getDatabase(Registry &$register, string $projectId)
|
||||||
$project = Authorization::skip(fn() => $database->getDocument('projects', $projectId));
|
$project = Authorization::skip(fn() => $database->getDocument('projects', $projectId));
|
||||||
$database = $project->getAttribute('database', '');
|
$database = $project->getAttribute('database', '');
|
||||||
$pdo = $dbPool->getPDOFromPool($database);
|
$pdo = $dbPool->getPDOFromPool($database);
|
||||||
$database = DatabasePool::wait(
|
$database = Pools::wait(
|
||||||
DatabasePool::getDatabase($pdo->getConnection(), $redis, "_{$project->getInternalId()}"),
|
Pools::getDatabase($pdo->getConnection(), $redis, "_{$project->getInternalId()}"),
|
||||||
'realtime'
|
'realtime'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -479,13 +479,13 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
|
||||||
/** Get the console DB */
|
/** Get the console DB */
|
||||||
$database = $dbPool->getConsoleDB();
|
$database = $dbPool->getConsoleDB();
|
||||||
$pdo = $dbPool->getPDOFromPool($database);
|
$pdo = $dbPool->getPDOFromPool($database);
|
||||||
$database = DatabasePool::getDatabase($pdo->getConnection(), $redis, '_console');
|
$database = Pools::getDatabase($pdo->getConnection(), $redis, '_console');
|
||||||
|
|
||||||
if ($projectId !== 'console') {
|
if ($projectId !== 'console') {
|
||||||
$project = Authorization::skip(fn() => $database->getDocument('projects', $projectId));
|
$project = Authorization::skip(fn() => $database->getDocument('projects', $projectId));
|
||||||
$database = $project->getAttribute('database', '');
|
$database = $project->getAttribute('database', '');
|
||||||
$pdo = $dbPool->getPDOFromPool($database);
|
$pdo = $dbPool->getPDOFromPool($database);
|
||||||
$database = DatabasePool::getDatabase($pdo->getConnection(), $redis, "_{$project->getInternalId()}");
|
$database = Pools::getDatabase($pdo->getConnection(), $redis, "_{$project->getInternalId()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -96,7 +96,7 @@ $cli
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$dbPool = $register->get('dbPool'); /* @var $dbPool DatabasePool */
|
$dbPool = $register->get('dbPool'); /* @var $dbPool Pools */
|
||||||
$database = $dbPool->getConsoleDB();
|
$database = $dbPool->getConsoleDB();
|
||||||
$pdo = $dbPool->getPDO($database);
|
$pdo = $dbPool->getPDO($database);
|
||||||
Console::success('Database............connected 👍');
|
Console::success('Database............connected 👍');
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
global $cli;
|
global $cli;
|
||||||
|
|
||||||
use Appwrite\Auth\Auth;
|
use Appwrite\Auth\Auth;
|
||||||
use Appwrite\Database\DatabasePool;
|
use Appwrite\Database\Pools;
|
||||||
use Appwrite\Event\Certificate;
|
use Appwrite\Event\Certificate;
|
||||||
use Appwrite\Event\Delete;
|
use Appwrite\Event\Delete;
|
||||||
use Utopia\App;
|
use Utopia\App;
|
||||||
|
@ -121,8 +121,8 @@ $cli
|
||||||
|
|
||||||
$database = $dbPool->getConsoleDB();
|
$database = $dbPool->getConsoleDB();
|
||||||
$pdo = $dbPool->getPDO($database);
|
$pdo = $dbPool->getPDO($database);
|
||||||
$database = DatabasePool::wait(
|
$database = Pools::wait(
|
||||||
DatabasePool::getDatabase($pdo, $redis, '_console'),
|
Pools::getDatabase($pdo, $redis, '_console'),
|
||||||
'certificates',
|
'certificates',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
global $cli, $register;
|
global $cli, $register;
|
||||||
|
|
||||||
use Appwrite\Database\DatabasePool;
|
use Appwrite\Database\Pools;
|
||||||
use Appwrite\Usage\Calculators\Aggregator;
|
use Appwrite\Usage\Calculators\Aggregator;
|
||||||
use Appwrite\Usage\Calculators\Database;
|
use Appwrite\Usage\Calculators\Database;
|
||||||
use Appwrite\Usage\Calculators\TimeSeries;
|
use Appwrite\Usage\Calculators\TimeSeries;
|
||||||
|
@ -131,8 +131,8 @@ $cli
|
||||||
|
|
||||||
$database = $dbPool->getConsoleDB();
|
$database = $dbPool->getConsoleDB();
|
||||||
$pdo = $dbPool->getPDO($database);
|
$pdo = $dbPool->getPDO($database);
|
||||||
$database = DatabasePool::wait(
|
$database = Pools::wait(
|
||||||
DatabasePool::getDatabase($pdo, $redis, '_console'),
|
Pools::getDatabase($pdo, $redis, '_console'),
|
||||||
'projects',
|
'projects',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
namespace Appwrite\Resque;
|
namespace Appwrite\Resque;
|
||||||
|
|
||||||
use Appwrite\Database\DatabasePool;
|
use Exception;
|
||||||
|
use Appwrite\Database\Pools;
|
||||||
use Utopia\App;
|
use Utopia\App;
|
||||||
use Utopia\Database\Database;
|
use Utopia\Database\Database;
|
||||||
use Utopia\Storage\Device;
|
use Utopia\Storage\Device;
|
||||||
|
@ -13,7 +14,6 @@ use Utopia\Storage\Device\Linode;
|
||||||
use Utopia\Storage\Device\Wasabi;
|
use Utopia\Storage\Device\Wasabi;
|
||||||
use Utopia\Storage\Device\Backblaze;
|
use Utopia\Storage\Device\Backblaze;
|
||||||
use Utopia\Storage\Device\S3;
|
use Utopia\Storage\Device\S3;
|
||||||
use Exception;
|
|
||||||
use Utopia\Database\Document;
|
use Utopia\Database\Document;
|
||||||
use Utopia\Database\Validator\Authorization;
|
use Utopia\Database\Validator\Authorization;
|
||||||
|
|
||||||
|
@ -175,8 +175,8 @@ abstract class Worker
|
||||||
$dbPool = $register->get('dbPool');
|
$dbPool = $register->get('dbPool');
|
||||||
$namespace = "_$internalId";
|
$namespace = "_$internalId";
|
||||||
$pdo = $dbPool->getPDO($database);
|
$pdo = $dbPool->getPDO($database);
|
||||||
$dbForProject = DatabasePool::wait(
|
$dbForProject = Pools::wait(
|
||||||
DatabasePool::getDatabase($pdo, $cache, $namespace),
|
Pools::getDatabase($pdo, $cache, $namespace),
|
||||||
'projects'
|
'projects'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -199,8 +199,8 @@ abstract class Worker
|
||||||
|
|
||||||
$namespace = "_console";
|
$namespace = "_console";
|
||||||
$pdo = $dbPool->getPDO($database);
|
$pdo = $dbPool->getPDO($database);
|
||||||
$dbForConsole = DatabasePool::wait(
|
$dbForConsole = Pools::wait(
|
||||||
DatabasePool::getDatabase($pdo, $cache, $namespace),
|
Pools::getDatabase($pdo, $cache, $namespace),
|
||||||
'_metadata'
|
'_metadata'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue