10 files changed +34
-24
lines changed Original file line number Diff line number Diff line change 120
120
// The number of times to try reconnecting to the MySQL database
121
121
'mysql.connection-retries ' => 3 ,
122
122
123
+ // Phabricator supports PHP extensions MySQL and MySQLi. It is possible to
124
+ // implement also other access mechanism (e.g. PDO_MySQL). The class must
125
+ // extend AphrontMySQLDatabaseConnectionBase.
126
+ 'mysql.implementation ' => 'AphrontMySQLDatabaseConnection ' ,
127
+
123
128
124
129
// -- Email ----------------------------------------------------------------- //
125
130
Original file line number Diff line number Diff line change 83
83
$ conn_bare_hostname = $ conn_host ;
84
84
}
85
85
86
- $ conn = new AphrontMySQLDatabaseConnection (
86
+ $ conn = PhabricatorEnv::newObjectFromConfig (
87
+ 'mysql.implementation ' ,
87
88
array (
88
- 'user ' => $ conn_user ,
89
- 'pass ' => $ conn_pass ,
90
- 'host ' => $ conn_host ,
91
- 'database ' => null ,
89
+ array (
90
+ 'user ' => $ conn_user ,
91
+ 'pass ' => $ conn_pass ,
92
+ 'host ' => $ conn_host ,
93
+ 'database ' => null ,
94
+ ),
92
95
));
93
96
94
97
try {
Original file line number Diff line number Diff line change @@ -55,7 +55,9 @@ public function generateData() {
55
55
// For each SELECT query, go issue an EXPLAIN on it so we can flag stuff
56
56
// causing table scans, etc.
57
57
if (preg_match ('/^\s*SELECT\b/i ' , $ entry ['query ' ])) {
58
- $ conn = new AphrontMySQLDatabaseConnection ($ entry ['config ' ]);
58
+ $ conn = PhabricatorEnv::newObjectFromConfig (
59
+ 'mysql.implementation ' ,
60
+ array ($ entry ['config ' ]));
59
61
try {
60
62
$ explain = queryfx_all (
61
63
$ conn ,
Original file line number Diff line number Diff line change 7
7
8
8
9
9
phutil_require_module ('phabricator ' , 'aphront/console/plugin/base ' );
10
- phutil_require_module ('phabricator ' , 'storage/connection/mysql/mysql ' );
10
+ phutil_require_module ('phabricator ' , 'infrastructure/env ' );
11
11
phutil_require_module ('phabricator ' , 'storage/queryfx ' );
12
12
phutil_require_module ('phabricator ' , 'view/control/table ' );
13
13
Original file line number Diff line number Diff line change @@ -71,12 +71,15 @@ public function establishLiveConnection($mode) {
71
71
PhutilSymbolLoader::loadClass ($ conf_provider );
72
72
$ conf = newv ($ conf_provider , array ($ this , $ mode ));
73
73
74
- return new AphrontMySQLDatabaseConnection (
74
+ return PhabricatorEnv::newObjectFromConfig (
75
+ 'mysql.implementation ' ,
75
76
array (
76
- 'user ' => $ conf ->getUser (),
77
- 'pass ' => $ conf ->getPassword (),
78
- 'host ' => $ conf ->getHost (),
79
- 'database ' => $ conf ->getDatabase (),
77
+ array (
78
+ 'user ' => $ conf ->getUser (),
79
+ 'pass ' => $ conf ->getPassword (),
80
+ 'host ' => $ conf ->getHost (),
81
+ 'database ' => $ conf ->getDatabase (),
82
+ ),
80
83
));
81
84
}
82
85
Original file line number Diff line number Diff line change 7
7
8
8
9
9
phutil_require_module ('phabricator ' , 'infrastructure/env ' );
10
- phutil_require_module ('phabricator ' , 'storage/connection/mysql/mysql ' );
11
10
phutil_require_module ('phabricator ' , 'storage/lisk/dao ' );
12
11
13
12
phutil_require_module ('phutil ' , 'symbols ' );
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ public static function getRequiredClasses() {
55
55
'AphrontApplicationConfiguration ' ,
56
56
'controller.oauth-registration ' =>
57
57
'PhabricatorOAuthRegistrationController ' ,
58
+ 'mysql.implementation ' => 'AphrontMySQLDatabaseConnectionBase ' ,
58
59
'differential.attach-task-class ' => 'DifferentialTasksAttacher ' ,
59
60
);
60
61
}
Original file line number Diff line number Diff line change @@ -473,12 +473,15 @@ public static function runSetup() {
473
473
474
474
ini_set ('mysql.connect_timeout ' , 2 );
475
475
476
- $ conn_raw = new AphrontMySQLDatabaseConnection (
476
+ $ conn_raw = PhabricatorEnv::newObjectFromConfig (
477
+ 'mysql.implementation ' ,
477
478
array (
478
- 'user ' => $ conn_user ,
479
- 'pass ' => $ conn_pass ,
480
- 'host ' => $ conn_host ,
481
- 'database ' => null ,
479
+ array (
480
+ 'user ' => $ conn_user ,
481
+ 'pass ' => $ conn_pass ,
482
+ 'host ' => $ conn_host ,
483
+ 'database ' => null ,
484
+ ),
482
485
));
483
486
484
487
try {
Original file line number Diff line number Diff line change 9
9
phutil_require_module ('phabricator ' , 'applications/base/storage/configuration ' );
10
10
phutil_require_module ('phabricator ' , 'infrastructure/env ' );
11
11
phutil_require_module ('phabricator ' , 'infrastructure/setup/sql ' );
12
- phutil_require_module ('phabricator ' , 'storage/connection/mysql/mysql ' );
13
12
phutil_require_module ('phabricator ' , 'storage/queryfx ' );
14
13
15
14
phutil_require_module ('phutil ' , 'filesystem ' );
Original file line number Diff line number Diff line change 46
46
"is one of 'development', 'production', or a custom environment. " );
47
47
}
48
48
49
- if (!function_exists ('mysql_connect ' )) {
50
- phabricator_fatal_config_error (
51
- "The PHP MySQL extension is not installed. This extension is required. " );
52
- }
53
-
54
49
if (!isset ($ _REQUEST ['__path__ ' ])) {
55
50
phabricator_fatal_config_error (
56
51
"__path__ is not set. Your rewrite rules are not configured correctly. " );
0 commit comments