7 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 170
170
// The password to use when connecting to MySQL.
171
171
'mysql.pass ' => '' ,
172
172
173
- // The MySQL server to connect to. If you want to connect to a different
174
- // port than the default (which is 3306), specify it in the hostname
175
- // (e.g., db.example.com:1234).
173
+ // The MySQL server to connect to.
176
174
'mysql.host ' => 'localhost ' ,
177
175
176
+ // If you want to connect to a different port than the default (which is 3306)
177
+ 'mysql.port ' => '3306 ' ,
178
+
178
179
// Phabricator supports PHP extensions MySQL and MySQLi. It is possible to
179
180
// implement also other access mechanism (e.g. PDO_MySQL). The class must
180
181
// extend AphrontMySQLDatabaseConnectionBase.
Original file line number Diff line number Diff line change 25
25
26
26
$ default_user = $ conf ->getUser ();
27
27
$ default_host = $ conf ->getHost ();
28
+ $ default_port = $ conf ->getPort ();
28
29
$ default_namespace = PhabricatorLiskDAO::getDefaultStorageNamespace ();
29
30
30
31
try {
82
83
$ api ->setUser ($ args ->getArg ('user ' ));
83
84
PhabricatorEnv::overrideConfig ('mysql.user ' , $ args ->getArg ('user ' ));
84
85
$ api ->setHost ($ default_host );
86
+ $ api ->setPort ($ default_port );
85
87
$ api ->setPassword ($ password );
86
88
$ api ->setNamespace ($ args ->getArg ('namespace ' ));
87
89
Original file line number Diff line number Diff line change @@ -12,13 +12,15 @@ protected function executeChecks() {
12
12
$ conn_user = $ conf ->getUser ();
13
13
$ conn_pass = $ conf ->getPassword ();
14
14
$ conn_host = $ conf ->getHost ();
15
+ $ conn_port = $ conf ->getPort ();
15
16
16
17
ini_set ('mysql.connect_timeout ' , 2 );
17
18
18
19
$ config = array (
19
20
'user ' => $ conn_user ,
20
21
'pass ' => $ conn_pass ,
21
22
'host ' => $ conn_host ,
23
+ 'port ' => $ conn_port ,
22
24
'database ' => null ,
23
25
);
24
26
@@ -40,6 +42,7 @@ protected function executeChecks() {
40
42
->setMessage ($ message )
41
43
->setIsFatal (true )
42
44
->addRelatedPhabricatorConfig ('mysql.host ' )
45
+ ->addRelatedPhabricatorConfig ('mysql.port ' )
43
46
->addRelatedPhabricatorConfig ('mysql.user ' )
44
47
->addRelatedPhabricatorConfig ('mysql.pass ' );
45
48
return ;
Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ public function getOptions() {
69
69
"this namespace if you want. Normally, you should not do this " .
70
70
"unless you are developing Phabricator and using namespaces to " .
71
71
"separate multiple sandbox datasets. " )),
72
+ $ this ->newOption ('mysql.port ' , 'string ' , null )
73
+ ->setLocked (true )
74
+ ->setDescription (
75
+ pht ("MySQL port to use when connecting to the database. " )),
72
76
);
73
77
}
74
78
Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ public function getHost() {
29
29
return PhabricatorEnv::getEnvConfig ('mysql.host ' );
30
30
}
31
31
32
+ public function getPort () {
33
+ return PhabricatorEnv::getEnvConfig ('mysql.port ' );
34
+ }
35
+
32
36
public function getDatabase () {
33
37
if (!$ this ->getDao ()) {
34
38
return null ;
Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ public function establishLiveConnection($mode) {
110
110
'user ' => $ conf ->getUser (),
111
111
'pass ' => $ conf ->getPassword (),
112
112
'host ' => $ conf ->getHost (),
113
+ 'port ' => $ conf ->getPort (),
113
114
'database ' => $ conf ->getDatabase (),
114
115
'retries ' => 3 ,
115
116
),
Original file line number Diff line number Diff line change @@ -45,6 +45,15 @@ public function getHost() {
45
45
return $ this ->host ;
46
46
}
47
47
48
+ public function setPort ($ port ) {
49
+ $ this ->port = $ port ;
50
+ return $ this ;
51
+ }
52
+
53
+ public function getPort () {
54
+ return $ this ->port ;
55
+ }
56
+
48
57
public function getDatabaseName ($ fragment ) {
49
58
return $ this ->namespace .'_ ' .$ fragment ;
50
59
}
@@ -74,6 +83,7 @@ public function getConn($fragment) {
74
83
'user ' => $ this ->user ,
75
84
'pass ' => $ this ->password ,
76
85
'host ' => $ this ->host ,
86
+ 'port ' => $ this ->port ,
77
87
'database ' => $ fragment
78
88
? $ database
79
89
: null ,
0 commit comments