mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Customizable MySQL implementation
Test Plan: - / - upgrade_schema.php - Setup - Try disabling mysql_connect. Reviewers: epriestley Reviewed By: epriestley CC: aran Differential Revision: https://secure.phabricator.com/D2133
This commit is contained in:
parent
34ca4a9ba7
commit
d4c5761f41
10 changed files with 34 additions and 24 deletions
|
@ -120,6 +120,11 @@ return array(
|
|||
// The number of times to try reconnecting to the MySQL database
|
||||
'mysql.connection-retries' => 3,
|
||||
|
||||
// Phabricator supports PHP extensions MySQL and MySQLi. It is possible to
|
||||
// implement also other access mechanism (e.g. PDO_MySQL). The class must
|
||||
// extend AphrontMySQLDatabaseConnectionBase.
|
||||
'mysql.implementation' => 'AphrontMySQLDatabaseConnection',
|
||||
|
||||
|
||||
// -- Email ----------------------------------------------------------------- //
|
||||
|
||||
|
|
|
@ -83,12 +83,15 @@ if ($uri->getPort()) {
|
|||
$conn_bare_hostname = $conn_host;
|
||||
}
|
||||
|
||||
$conn = new AphrontMySQLDatabaseConnection(
|
||||
$conn = PhabricatorEnv::newObjectFromConfig(
|
||||
'mysql.implementation',
|
||||
array(
|
||||
'user' => $conn_user,
|
||||
'pass' => $conn_pass,
|
||||
'host' => $conn_host,
|
||||
'database' => null,
|
||||
array(
|
||||
'user' => $conn_user,
|
||||
'pass' => $conn_pass,
|
||||
'host' => $conn_host,
|
||||
'database' => null,
|
||||
),
|
||||
));
|
||||
|
||||
try {
|
||||
|
|
|
@ -55,7 +55,9 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin {
|
|||
// For each SELECT query, go issue an EXPLAIN on it so we can flag stuff
|
||||
// causing table scans, etc.
|
||||
if (preg_match('/^\s*SELECT\b/i', $entry['query'])) {
|
||||
$conn = new AphrontMySQLDatabaseConnection($entry['config']);
|
||||
$conn = PhabricatorEnv::newObjectFromConfig(
|
||||
'mysql.implementation',
|
||||
array($entry['config']));
|
||||
try {
|
||||
$explain = queryfx_all(
|
||||
$conn,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
|
||||
phutil_require_module('phabricator', 'aphront/console/plugin/base');
|
||||
phutil_require_module('phabricator', 'storage/connection/mysql/mysql');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
phutil_require_module('phabricator', 'storage/queryfx');
|
||||
phutil_require_module('phabricator', 'view/control/table');
|
||||
|
||||
|
|
|
@ -71,12 +71,15 @@ abstract class PhabricatorLiskDAO extends LiskDAO {
|
|||
PhutilSymbolLoader::loadClass($conf_provider);
|
||||
$conf = newv($conf_provider, array($this, $mode));
|
||||
|
||||
return new AphrontMySQLDatabaseConnection(
|
||||
return PhabricatorEnv::newObjectFromConfig(
|
||||
'mysql.implementation',
|
||||
array(
|
||||
'user' => $conf->getUser(),
|
||||
'pass' => $conf->getPassword(),
|
||||
'host' => $conf->getHost(),
|
||||
'database' => $conf->getDatabase(),
|
||||
array(
|
||||
'user' => $conf->getUser(),
|
||||
'pass' => $conf->getPassword(),
|
||||
'host' => $conf->getHost(),
|
||||
'database' => $conf->getDatabase(),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
phutil_require_module('phabricator', 'storage/connection/mysql/mysql');
|
||||
phutil_require_module('phabricator', 'storage/lisk/dao');
|
||||
|
||||
phutil_require_module('phutil', 'symbols');
|
||||
|
|
1
src/infrastructure/env/PhabricatorEnv.php
vendored
1
src/infrastructure/env/PhabricatorEnv.php
vendored
|
@ -55,6 +55,7 @@ final class PhabricatorEnv {
|
|||
'AphrontApplicationConfiguration',
|
||||
'controller.oauth-registration' =>
|
||||
'PhabricatorOAuthRegistrationController',
|
||||
'mysql.implementation' => 'AphrontMySQLDatabaseConnectionBase',
|
||||
'differential.attach-task-class' => 'DifferentialTasksAttacher',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -473,12 +473,15 @@ final class PhabricatorSetup {
|
|||
|
||||
ini_set('mysql.connect_timeout', 2);
|
||||
|
||||
$conn_raw = new AphrontMySQLDatabaseConnection(
|
||||
$conn_raw = PhabricatorEnv::newObjectFromConfig(
|
||||
'mysql.implementation',
|
||||
array(
|
||||
'user' => $conn_user,
|
||||
'pass' => $conn_pass,
|
||||
'host' => $conn_host,
|
||||
'database' => null,
|
||||
array(
|
||||
'user' => $conn_user,
|
||||
'pass' => $conn_pass,
|
||||
'host' => $conn_host,
|
||||
'database' => null,
|
||||
),
|
||||
));
|
||||
|
||||
try {
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
phutil_require_module('phabricator', 'applications/base/storage/configuration');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
phutil_require_module('phabricator', 'infrastructure/setup/sql');
|
||||
phutil_require_module('phabricator', 'storage/connection/mysql/mysql');
|
||||
phutil_require_module('phabricator', 'storage/queryfx');
|
||||
|
||||
phutil_require_module('phutil', 'filesystem');
|
||||
|
|
|
@ -46,11 +46,6 @@ if (!$env) {
|
|||
"is one of 'development', 'production', or a custom environment.");
|
||||
}
|
||||
|
||||
if (!function_exists('mysql_connect')) {
|
||||
phabricator_fatal_config_error(
|
||||
"The PHP MySQL extension is not installed. This extension is required.");
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['__path__'])) {
|
||||
phabricator_fatal_config_error(
|
||||
"__path__ is not set. Your rewrite rules are not configured correctly.");
|
||||
|
|
Loading…
Reference in a new issue