1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 02:32:42 +01:00

Remove "mysql.implementation" configuration

Summary:
Ref T11044. Fixes T10931. This option has essentially never been useful for anything, and we've picked the best implementation for a long time (MySQLi if available, MySQL if not).

I am not aware of any reason to ever set this manually. If someone comes up with some bizarre but legitimate use case that I haven't thought of, we can modularize it.

Test Plan: Browsed around. Grepped for `mysql.implementation`.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10931, T11044

Differential Revision: https://secure.phabricator.com/D16909
This commit is contained in:
epriestley 2016-11-21 17:02:42 -08:00
parent 88a966993b
commit bac27fb403
6 changed files with 23 additions and 41 deletions

View file

@ -341,6 +341,9 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
'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;

View file

@ -48,23 +48,6 @@ final class PhabricatorMySQLConfigOptions
'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(

View file

@ -57,9 +57,7 @@ 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 = PhabricatorEnv::newObjectFromConfig(
'mysql.implementation',
array($entry['config']));
$conn = PhabricatorDatabaseRef::newRawConnection($entry['config']);
try {
$explain = queryfx_all(
$conn,

View file

@ -663,11 +663,15 @@ final class PhabricatorDatabaseRef
'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);
}
}
}

View file

@ -101,9 +101,7 @@ abstract class PhabricatorLiskDAO extends LiskDAO {
'mysql.configuration-provider',
array($this, $mode, $namespace));
return PhabricatorEnv::newObjectFromConfig(
'mysql.implementation',
array(
return PhabricatorDatabaseRef::newRawConnection(
array(
'user' => $conf->getUser(),
'pass' => $conf->getPassword(),
@ -112,7 +110,6 @@ abstract class PhabricatorLiskDAO extends LiskDAO {
'database' => $database,
'retries' => 3,
'timeout' => 10,
),
));
}

View file

@ -109,9 +109,7 @@ final class PhabricatorStorageManagementAPI extends Phobject {
$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,7 +118,6 @@ final class PhabricatorStorageManagementAPI extends Phobject {
'database' => $fragment
? $database
: null,
),
));
}
return $return;