diff --git a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php index f28a6ab648..9fbb52ca22 100644 --- a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php +++ b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php @@ -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; diff --git a/src/applications/config/option/PhabricatorMySQLConfigOptions.php b/src/applications/config/option/PhabricatorMySQLConfigOptions.php index 28fa78d2ab..2ddaf91488 100644 --- a/src/applications/config/option/PhabricatorMySQLConfigOptions.php +++ b/src/applications/config/option/PhabricatorMySQLConfigOptions.php @@ -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( diff --git a/src/applications/console/plugin/DarkConsoleServicesPlugin.php b/src/applications/console/plugin/DarkConsoleServicesPlugin.php index 055315d641..ea5a100550 100644 --- a/src/applications/console/plugin/DarkConsoleServicesPlugin.php +++ b/src/applications/console/plugin/DarkConsoleServicesPlugin.php @@ -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, diff --git a/src/infrastructure/cluster/PhabricatorDatabaseRef.php b/src/infrastructure/cluster/PhabricatorDatabaseRef.php index 0559ba0c32..461fe8f17c 100644 --- a/src/infrastructure/cluster/PhabricatorDatabaseRef.php +++ b/src/infrastructure/cluster/PhabricatorDatabaseRef.php @@ -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); + } } } diff --git a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php index 3bc66720db..d206f20806 100644 --- a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php +++ b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php @@ -101,18 +101,15 @@ abstract class PhabricatorLiskDAO extends LiskDAO { '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 index 15b46300f1..d7104af323 100644 --- a/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php +++ b/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php @@ -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,8 +118,7 @@ final class PhabricatorStorageManagementAPI extends Phobject { 'database' => $fragment ? $database : null, - ), - )); + )); } return $return; }