Make database classes handle hyphens in $wgDBname
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 17 Sep 2016 04:39:57 +0000 (21:39 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Sat, 17 Sep 2016 22:29:21 +0000 (15:29 -0700)
commit847b91bf1fdf466329ef3b5755d3c6df4f9bc946
tree03ae387f8fab8e88aec3ecbb15d4bded309dd538
parentf0d760a0773eaaf840b8e5a1649b5c6a0f705f9d
Make database classes handle hyphens in $wgDBname

* Add DatabaseDomain class to handle passing domains around.
It also can be cast to and from strings, which are of the same
format as wfWikiId() except with hyphens escaped.
* Make IDatabase::getDomainID() use these IDs so they can be
passed into LoadBalancer::getConnection() and friends without
breaking on sites with a hyphen in the DB name.
* Add more LBFactory unit tests for domains.

Bug: T145840
Change-Id: Icfed62b251af8cef706a899197c3ccdb730ef4d1
autoload.php
includes/db/loadbalancer/LBFactoryMW.php
includes/libs/rdbms/database/DBConnRef.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabaseDomain.php [new file with mode: 0644]
includes/libs/rdbms/lbfactory/LBFactory.php
includes/libs/rdbms/loadbalancer/LoadBalancer.php
tests/phpunit/includes/db/LBFactoryTest.php
tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php [new file with mode: 0644]