Page MenuHomePhabricator

D16909.diff
No OneTemporary

D16909.diff

diff --git a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php
--- a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php
+++ b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php
@@ -341,6 +341,9 @@
'maniphest.priorities.unbreak-now' => $dashboard_reason,
'maniphest.priorities.needs-triage' => $dashboard_reason,
+ 'mysql.implementation' => pht(
+ 'Phabricator now automatically selects the best available '.
+ 'MySQL implementation.'),
);
return $ancient_config;
diff --git a/src/applications/config/option/PhabricatorMySQLConfigOptions.php b/src/applications/config/option/PhabricatorMySQLConfigOptions.php
--- a/src/applications/config/option/PhabricatorMySQLConfigOptions.php
+++ b/src/applications/config/option/PhabricatorMySQLConfigOptions.php
@@ -48,23 +48,6 @@
'Phabricator chooses which database to connect to through a '.
'swappable configuration provider. You almost certainly do not '.
'need to change this.')),
- $this->newOption(
- 'mysql.implementation',
- 'class',
- (extension_loaded('mysqli')
- ? 'AphrontMySQLiDatabaseConnection'
- : 'AphrontMySQLDatabaseConnection'))
- ->setLocked(true)
- ->setBaseClass('AphrontMySQLDatabaseConnectionBase')
- ->setSummary(
- pht('Configure database connection class.'))
- ->setDescription(
- pht(
- 'Phabricator connects to MySQL through a swappable abstraction '.
- 'layer. You can choose an alternate implementation by setting '.
- 'this option. To provide your own implementation, extend '.
- '`%s`. It is very unlikely that you need to change this.',
- 'AphrontMySQLDatabaseConnectionBase')),
$this->newOption('storage.default-namespace', 'string', 'phabricator')
->setLocked(true)
->setSummary(
diff --git a/src/applications/console/plugin/DarkConsoleServicesPlugin.php b/src/applications/console/plugin/DarkConsoleServicesPlugin.php
--- a/src/applications/console/plugin/DarkConsoleServicesPlugin.php
+++ b/src/applications/console/plugin/DarkConsoleServicesPlugin.php
@@ -57,9 +57,7 @@
// 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 = PhabricatorEnv::newObjectFromConfig(
- 'mysql.implementation',
- array($entry['config']));
+ $conn = PhabricatorDatabaseRef::newRawConnection($entry['config']);
try {
$explain = queryfx_all(
$conn,
diff --git a/src/infrastructure/cluster/PhabricatorDatabaseRef.php b/src/infrastructure/cluster/PhabricatorDatabaseRef.php
--- a/src/infrastructure/cluster/PhabricatorDatabaseRef.php
+++ b/src/infrastructure/cluster/PhabricatorDatabaseRef.php
@@ -663,11 +663,15 @@
'timeout' => $default_timeout,
);
- return PhabricatorEnv::newObjectFromConfig(
- 'mysql.implementation',
- array(
- $spec,
- ));
+ return self::newRawConnection($spec);
+ }
+
+ public static function newRawConnection(array $options) {
+ if (extension_loaded('mysqli')) {
+ return new AphrontMySQLiDatabaseConnection($options);
+ } else {
+ return new AphrontMySQLDatabaseConnection($options);
+ }
}
}
diff --git a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
--- a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
+++ b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
@@ -101,18 +101,15 @@
'mysql.configuration-provider',
array($this, $mode, $namespace));
- return PhabricatorEnv::newObjectFromConfig(
- 'mysql.implementation',
+ return PhabricatorDatabaseRef::newRawConnection(
array(
- array(
- 'user' => $conf->getUser(),
- 'pass' => $conf->getPassword(),
- 'host' => $conf->getHost(),
- 'port' => $conf->getPort(),
- 'database' => $database,
- 'retries' => 3,
- 'timeout' => 10,
- ),
+ 'user' => $conf->getUser(),
+ 'pass' => $conf->getPassword(),
+ 'host' => $conf->getHost(),
+ 'port' => $conf->getPort(),
+ 'database' => $database,
+ 'retries' => 3,
+ 'timeout' => 10,
));
}
diff --git a/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php b/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php
--- a/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php
+++ b/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php
@@ -109,9 +109,7 @@
$database = $this->getDatabaseName($fragment);
$return = &$this->conns[$this->host][$this->user][$database];
if (!$return) {
- $return = PhabricatorEnv::newObjectFromConfig(
- 'mysql.implementation',
- array(
+ $return = PhabricatorDatabaseRef::newRawConnection(
array(
'user' => $this->user,
'pass' => $this->password,
@@ -120,8 +118,7 @@
'database' => $fragment
? $database
: null,
- ),
- ));
+ ));
}
return $return;
}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 3:51 AM (22 h, 37 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6719053
Default Alt Text
D16909.diff (5 KB)

Event Timeline