Add a setup warning for port in mysql.host
				
					
				
			Summary: A pull from GitHub recently added `mysql.port`, for explicitly configuring the MySQL port. See: - https://github.com/facebook/libphutil/pull/27 - https://github.com/facebook/phabricator/pull/356 Add a setup warning for old-style configurations (which will still work properly), to get them to move to the new style. Test Plan: {F50113} Reviewers: btrahan, chad Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D6449
This commit is contained in:
		| @@ -174,7 +174,7 @@ return array( | |||||||
|   'mysql.host' => 'localhost', |   'mysql.host' => 'localhost', | ||||||
|  |  | ||||||
|   // If you want to connect to a different port than the default (which is 3306) |   // If you want to connect to a different port than the default (which is 3306) | ||||||
|   'mysql.port' => '3306', |   'mysql.port' => null, | ||||||
|  |  | ||||||
|   // Phabricator supports PHP extensions MySQL and MySQLi. It is possible to |   // Phabricator supports PHP extensions MySQL and MySQLi. It is possible to | ||||||
|   // implement also other access mechanism (e.g. PDO_MySQL). The class must |   // implement also other access mechanism (e.g. PDO_MySQL). The class must | ||||||
|   | |||||||
| @@ -107,5 +107,36 @@ final class PhabricatorSetupCheckDatabase extends PhabricatorSetupCheck { | |||||||
|             hsprintf('<tt>phabricator/ $</tt> ./bin/storage upgrade')); |             hsprintf('<tt>phabricator/ $</tt> ./bin/storage upgrade')); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     $host = PhabricatorEnv::getEnvConfig('mysql.host'); | ||||||
|  |     $matches = null; | ||||||
|  |     if (preg_match('/^([^:]+):(\d+)$/', $host, $matches)) { | ||||||
|  |       $host = $matches[1]; | ||||||
|  |       $port = $matches[2]; | ||||||
|  |  | ||||||
|  |       $this->newIssue('storage.mysql.hostport') | ||||||
|  |         ->setName(pht('Deprecated mysql.host Format')) | ||||||
|  |         ->setSummary( | ||||||
|  |           pht( | ||||||
|  |             'Move port information from `mysql.host` to `mysql.port` in your '. | ||||||
|  |             'config.')) | ||||||
|  |         ->setMessage( | ||||||
|  |           pht( | ||||||
|  |             'Your `mysql.host` configuration contains a port number, but '. | ||||||
|  |             'this usage is deprecated. Instead, put the port number in '. | ||||||
|  |             '`mysql.port`.')) | ||||||
|  |         ->addPhabricatorConfig('mysql.host') | ||||||
|  |         ->addPhabricatorConfig('mysql.port') | ||||||
|  |         ->addCommand( | ||||||
|  |           hsprintf( | ||||||
|  |             '<tt>phabricator/ $</tt> ./bin/config set mysql.host %s', | ||||||
|  |             $host)) | ||||||
|  |         ->addCommand( | ||||||
|  |           hsprintf( | ||||||
|  |             '<tt>phabricator/ $</tt> ./bin/config set mysql.port %s', | ||||||
|  |             $port)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 epriestley
					epriestley