@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

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

+23 -41
+3
src/applications/config/check/PhabricatorExtraConfigSetupCheck.php
··· 341 341 'maniphest.priorities.unbreak-now' => $dashboard_reason, 342 342 'maniphest.priorities.needs-triage' => $dashboard_reason, 343 343 344 + 'mysql.implementation' => pht( 345 + 'Phabricator now automatically selects the best available '. 346 + 'MySQL implementation.'), 344 347 ); 345 348 346 349 return $ancient_config;
-17
src/applications/config/option/PhabricatorMySQLConfigOptions.php
··· 48 48 'Phabricator chooses which database to connect to through a '. 49 49 'swappable configuration provider. You almost certainly do not '. 50 50 'need to change this.')), 51 - $this->newOption( 52 - 'mysql.implementation', 53 - 'class', 54 - (extension_loaded('mysqli') 55 - ? 'AphrontMySQLiDatabaseConnection' 56 - : 'AphrontMySQLDatabaseConnection')) 57 - ->setLocked(true) 58 - ->setBaseClass('AphrontMySQLDatabaseConnectionBase') 59 - ->setSummary( 60 - pht('Configure database connection class.')) 61 - ->setDescription( 62 - pht( 63 - 'Phabricator connects to MySQL through a swappable abstraction '. 64 - 'layer. You can choose an alternate implementation by setting '. 65 - 'this option. To provide your own implementation, extend '. 66 - '`%s`. It is very unlikely that you need to change this.', 67 - 'AphrontMySQLDatabaseConnectionBase')), 68 51 $this->newOption('storage.default-namespace', 'string', 'phabricator') 69 52 ->setLocked(true) 70 53 ->setSummary(
+1 -3
src/applications/console/plugin/DarkConsoleServicesPlugin.php
··· 57 57 // For each SELECT query, go issue an EXPLAIN on it so we can flag stuff 58 58 // causing table scans, etc. 59 59 if (preg_match('/^\s*SELECT\b/i', $entry['query'])) { 60 - $conn = PhabricatorEnv::newObjectFromConfig( 61 - 'mysql.implementation', 62 - array($entry['config'])); 60 + $conn = PhabricatorDatabaseRef::newRawConnection($entry['config']); 63 61 try { 64 62 $explain = queryfx_all( 65 63 $conn,
+9 -5
src/infrastructure/cluster/PhabricatorDatabaseRef.php
··· 663 663 'timeout' => $default_timeout, 664 664 ); 665 665 666 - return PhabricatorEnv::newObjectFromConfig( 667 - 'mysql.implementation', 668 - array( 669 - $spec, 670 - )); 666 + return self::newRawConnection($spec); 667 + } 668 + 669 + public static function newRawConnection(array $options) { 670 + if (extension_loaded('mysqli')) { 671 + return new AphrontMySQLiDatabaseConnection($options); 672 + } else { 673 + return new AphrontMySQLDatabaseConnection($options); 674 + } 671 675 } 672 676 673 677 }
+8 -11
src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
··· 101 101 'mysql.configuration-provider', 102 102 array($this, $mode, $namespace)); 103 103 104 - return PhabricatorEnv::newObjectFromConfig( 105 - 'mysql.implementation', 104 + return PhabricatorDatabaseRef::newRawConnection( 106 105 array( 107 - array( 108 - 'user' => $conf->getUser(), 109 - 'pass' => $conf->getPassword(), 110 - 'host' => $conf->getHost(), 111 - 'port' => $conf->getPort(), 112 - 'database' => $database, 113 - 'retries' => 3, 114 - 'timeout' => 10, 115 - ), 106 + 'user' => $conf->getUser(), 107 + 'pass' => $conf->getPassword(), 108 + 'host' => $conf->getHost(), 109 + 'port' => $conf->getPort(), 110 + 'database' => $database, 111 + 'retries' => 3, 112 + 'timeout' => 10, 116 113 )); 117 114 } 118 115
+2 -5
src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php
··· 109 109 $database = $this->getDatabaseName($fragment); 110 110 $return = &$this->conns[$this->host][$this->user][$database]; 111 111 if (!$return) { 112 - $return = PhabricatorEnv::newObjectFromConfig( 113 - 'mysql.implementation', 114 - array( 112 + $return = PhabricatorDatabaseRef::newRawConnection( 115 113 array( 116 114 'user' => $this->user, 117 115 'pass' => $this->password, ··· 120 118 'database' => $fragment 121 119 ? $database 122 120 : null, 123 - ), 124 - )); 121 + )); 125 122 } 126 123 return $return; 127 124 }