Commit graph

21 commits

Author SHA1 Message Date
Thiemo Kreuz
5f3a92385b Fix visibility of setUp/tearDown
Change-Id: I636be48eb9f713680abac35d46091f7b49374696
2020-06-16 21:02:05 +02:00
Max Semenik
48a323f702 tests: Add explicit return type void to setUp() and tearDown()
Bug: T192167
Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43
Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
2019-10-30 14:31:22 -07:00
Aaron Schulz
55301a4bb6 Removed deprecated WikiMap::getWikiIdFromDomain() method
Also simplify WikiMap::isCurrentWikiDbDomain() slightly

Change-Id: I21358c5e5ae1d229228fc416894f50b4ee444182
2019-07-14 01:17:31 +01:00
Thiemo Kreuz
8a4e15db7f Add missing newline between <?php and namespace/use section
The rest of the codebase is using this code formatting standard.

Change-Id: I4d2ba61757a7e28d40096d9dc5915005c340d4f2
2019-06-03 13:36:48 +00:00
Aaron Schulz
7dbd37a7c7 Make WikiMap::isCurrentWikiDbDomain() more rigorous
This already requires a DB domain ID, so there is no reason to have
hacks for trying to handle a wiki ID being passed in instead. If the
provided domain has a schema, it should not simply be ignored in the
comparison.

Change-Id: I9ced7a46fa05f32843a9a7d17391c5d0576b099c
2019-03-29 19:03:28 +00:00
Aaron Schulz
c4e284f113 rdbms: codify DatabaseDomain table "_" prefix convention
Alos simplify isCompatible() slightly and make the string
case in convertToString() explicit.

Change-Id: Ifb61bb5fb012491520525bbebfbde2269fa55b52
2019-03-26 21:04:51 +00:00
Aaron Schulz
5196ac32c6 Rename WikiMap DB domain ID methods to reduce confusion with web domains
Those added in this same release do not need alias methods.

Change-Id: I05feeb9b0b13afe43aea1f95551965489cdbe094
2019-02-06 12:28:45 -08:00
Aaron Schulz
51945dbca3 Use DB domain in JobQueueGroup and make WikiMap domain ID methods stricter
Using domains means thats JobQueueDB has the right value to use for calls
like LoadBalancer::getConnection(). The full domain includes the schema in
the case of Postgres. This makes calls to getConnection() less awkward by
not relying on the fallback logic in reallyOpenConnection() for null schemas.

Make getWikiIdFromDomain/isCurrentWikiDomain account for the schema if it
is both defined and is not simply the generic "mediawiki" schema MediaWiki
uses by default. If all wikis use the default schema, the wiki IDs can get
by with DB/prefix alone, which various config and methods may be built around.
Otherwise, the config callbacks must account for schema and the config must
include it in various wiki domain ID lists to properly disambiguate wikis.

Also, clean up SiteConfiguration::siteFromDB() since it is not meant
to handle schemas unless the callback method was taylored to do so.

Finally, add more comments to DefaultSettings.php about already existing
limitations of wiki domain IDs and their components.

Change-Id: I8d94a650e5c99a19ee50551c5be9544318eb05b1
2018-11-07 04:46:56 +00:00
Aaron Schulz
dcd0a3d534 Add isCurrentWikiId()/isCurrentWikiDomain()/getCurrentWikiDomain() to WikiMap
Use these in place of various wfWikiID() calls.

Also cleanup UserRightsProxy wiki ID variable names and removed unused
and poorly named getDBname() method.

Change-Id: Ib28889663989382d845511f8d34712b08317f60e
2018-10-29 14:53:37 -07:00
Aaron Schulz
a005f1de98 Clean up wiki ID and DB domain ID handling
Bug: T174017
Change-Id: I42299a393c6691d39817db1d83a176a17df2474b
2017-09-30 10:25:03 +00:00
Aaron Schulz
15cb57b3b5 Avoid preemptive DB replication waits for farm cross-wiki redirects
This previously only worked if $wgLocalVirtualHosts was set, which
was too specific to check and not used by WMF. Use the more generic
WikiMap class.

Two methods have been added there to do the work of enumerating
canonical wiki farm URLs and checking them against a given URL.

Bug: T172357
Change-Id: Id2415bab5d7f5a08b9f536858c32d329138384a2
2017-08-23 15:37:35 -07:00
Brad Jorsch
010410265a Improve WikiMap::getWikiReferenceFromWgConf()
If we don't have a valid canonical server and path to pass, there's no
point in returning a WikiReference that will fail in strange and unusal
ways.

This also documents that $wgServer/$wgCanonicalServer and $wgArticlePath
are required in SiteConfiguration.

Change-Id: Ib08011e9f1d0817a5d1bb165aba6b424785eaa6a
2016-07-06 14:20:07 -04:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Marius Hoch
3d85fde609 Make WikiMap fall back to sites if a site couldn't be found using $wgConf
The mapping is not very good, but should be good enough, given
that only the URL parts are really being used.

Bug: T114107
Change-Id: I8186140aed5620cf7b4ba84aa4c9492c61f406d0
2015-10-07 14:59:31 +02:00
Amir E. Aharoni
93a673d24a Fix spelling of "fragment" in test descriptions
Change-Id: I97ca75b9c587443e195b1c162dcfee7880a5e226
2015-10-03 12:30:59 +00:00
Marius Hoch
725a203bc1 Remove unused minor and major in WikiReference
Given that the class is not constructed anywhere outside
of core the constructor can be altered without having to
worry about b/c.

Change-Id: Ie49c43a1724f05cb95a296dc0fad0f1c587d80ef
2015-10-01 19:12:07 +02:00
Amir E. Aharoni
f9d0c98e16 Make lines short to pass phpcs in 2 files under tests/phpunit/includes/
Bug: T102614
Change-Id: I21a7cbc40a3015c3d6cbea1b9d7df58a358beb6a
2015-09-30 16:17:35 +00:00
Ricordisamoa
4f72efe8d8 Remove excess newlines at the end of files
Many of them added with commit 776c865077

Change-Id: I481b15c45ead1f5f482e120cb40ea8f3297543cf
2015-09-27 00:02:05 +02:00
Reedy
8e8368ca65 Re-enable MediaWiki.WhiteSpace.SpaceyParenthesis.SingleSpaceBeforeCloseParenthesis
Change-Id: I8482f5dd9d79e4946e862b0ac03bd027d62e8646
2015-09-26 17:38:35 +01:00
daniel
5852451177 Add support for fragments to WikiMap
WikiMap::makeForeignUrl should support fragement IDs in the
generated URL.

Change-Id: I612d5f465822b56356a78b3e72fb441a888668f1
2015-09-11 16:25:53 +02:00
daniel
3cecad00c9 Add tests for WikiMap and WikiReference
Change-Id: Ie218296fc7c1ceba588fadef076d66be865b1905
2015-09-11 16:21:16 +02:00