File tree 2 files changed +23
-3
lines changed 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 75
75
// The password to use when connecting to MySQL.
76
76
'mysql.pass ' => '' ,
77
77
78
- // The MySQL server to connect to.
78
+ // The MySQL server to connect to. If you want to connect to a different
79
+ // port than the default (which is 3306), specify it in the hostname
80
+ // (e.g., db.example.com:1234).
79
81
'mysql.host ' => 'localhost ' ,
80
82
81
83
// -- Email ----------------------------------------------------------------- //
Original file line number Diff line number Diff line change 59
59
// Use always the version from the commandline if it is defined
60
60
$ next_version = isset ($ options ['v ' ]) ? (int )$ options ['v ' ] : null ;
61
61
62
+ // TODO: Get this stuff from DatabaseConfigurationProvider?
62
63
if ($ options ['u ' ]) {
63
64
$ conn_user = $ options ['u ' ];
64
65
$ conn_pass = $ options ['p ' ];
68
69
}
69
70
$ conn_host = PhabricatorEnv::getEnvConfig ('mysql.host ' );
70
71
72
+ // Split out port information, since the command-line client requires a
73
+ // separate flag for the port.
74
+ $ uri = new PhutilURI ('mysql:// ' .$ conn_host );
75
+ if ($ uri ->getPort ()) {
76
+ $ conn_port = $ uri ->getPort ();
77
+ $ conn_bare_hostname = $ uri ->getDomain ();
78
+ } else {
79
+ $ conn_port = null ;
80
+ $ conn_bare_hostname = $ conn_host ;
81
+ }
82
+
71
83
$ conn = new AphrontMySQLDatabaseConnection (
72
84
array (
73
85
'user ' => $ conn_user ,
118
130
$ short_name = basename ($ patch ['path ' ]);
119
131
print "Applying patch {$ short_name }... \n" ;
120
132
133
+ if ($ conn_port ) {
134
+ $ port = '--port= ' .(int )$ conn_port ;
135
+ } else {
136
+ $ port = null ;
137
+ }
138
+
121
139
list ($ stdout , $ stderr ) = execx (
122
- "mysql --user=%s --password=%s --host=%s < %s " ,
140
+ "mysql --user=%s --password=%s --host=%s { $ port } < %s " ,
123
141
$ conn_user ,
124
142
$ conn_pass ,
125
- $ conn_host ,
143
+ $ conn_bare_hostname ,
126
144
$ patch ['path ' ]);
127
145
128
146
if ($ stderr ) {
You can’t perform that action at this time.
0 commit comments