| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
I believe this makes such code much easier to read and less
error-prone.
Change-Id: I40023b28b934bc75d1217d23ad6ec181312db11e
|
|
|
|
|
|
|
|
| |
Versions are changed in 8e940c4f214ff7d17b53f51c6a46a5cf7fc2c92e,
but that makes the version wrong
Follow-Up: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
Change-Id: Iae43725b8e0fffc4d44bf57f6227334b41290bd9
|
|
|
|
| |
Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
|
|
|
|
|
|
|
|
| |
Or just remove it. It's not needed when the structure is already an
array. PHP will happily initialize multi-dimentional arrays when
needed.
Change-Id: I93845e8d6f870d147bd55cfe3827bc94b375d0ba
|
|
|
|
|
| |
Bug: T353458
Change-Id: I31f7cba42c02701e462eb3ed6bcc3928d438c1ef
|
|
|
|
|
|
|
|
| |
These exceptions are not documented with @throws and they're really not
meant to be caught.
Bug: T86704
Change-Id: I07f32e42c6fd4bc8785bac91547858f15a9fc2a8
|
|\ |
|
| |
| |
| |
| |
| |
| | |
Doc-only changes
Change-Id: I5177f582ae7ee70c357e9389fed14819faf79463
|
|/
|
|
|
| |
Depends-On: I3b893152ed278a72b5e74ccf91a3381f319bfcd9
Change-Id: I9f69a9316eaec23103262ec2ffd5b85baaf16f3f
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follows-up I5ed7e169c9753 (779df10d, T319219) which introduced a new
use of MWException, as per T86704.
While at it, also remove a few unhelpful `@throws` annotations that
do nothing other than save an outdated IDE scan of what throw
statements internally exist. These aren't meant to be caught and thus
aren't of use to consumers of these docs as per T321683.
Change-Id: I4ef964342de80eb2c1dec99cd6258727e6cd1a2c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Recognise CachingSiteStore as the internal class that it is.
* Clean up the file header and move ingroup annotation, similar to
other commits under
<https://gerrit.wikimedia.org/r/q/message:ingroup+owner:Krinkle>.
The one here was particularly odd as it placed the license inside
the class doc block rather than the file doc block.
* Remove unused $cacheKey and $cacheTimeout constructor args. They
were also not covered by any unit tests.
* Avoid use of `empty()` as per
<https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP>
* Use a more conventional cache key in CachingSiteStore, keeping
the dynamic part for a later segment and keeping the first segment
explicitly tied to a single concrete key group. This also improves
ergonomics of cache statistics e.g. in Grafana and makes the cache
key easier to locate in codesearch/grep, and more recognisable,
e.g. starting with the code component ("site").
Change-Id: I541ad62551ab76127d70ef665272fd1d590ab556
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Site::getPath() has returned null since change I08ffa6a970 (commit
a00337c3f8), almost ten years ago; I think on the whole it’s safer to
fix the prose documentation and keep the @return and actual returned
value as they are, rather than the other way around.
MediaWikiSite::getPageUrl() compared the $filePath to false instead of
null, so the comparison would always be true; but on closer inspection,
I think this code was supposed to check $path, not $filePath, in the
first place. The only reason this didn’t come up so far is that all
known callers pass in a custom path (specifically, all non-test callers
pass in 'api.php'), so the $path = false default was never used.
To avoid a deprecation warning in PHP 8.1 when passing a null $filePath
into str_replace(), throw in that case instead – the function isn’t
documented to return string|null, and none of the callers seem prepared
to handle a null return as far as I can tell, so throwing seems better
than returning null. Tests that produce a null $filePath need to be
fixed to complete the Site object (compare Wikibase change If20688411e).
Bug: T319219
Change-Id: I5ed7e169c9753486c765fd816d1b21016c5c1def
Depends-On: If20688411e3f0108b0c0ba3b91e5cc264b70a208
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Note that null triggers the following for php 8.1:
PHP Deprecated: strrev(): Passing null to parameter #1 ($string) of
type string is deprecated
Got a few of these in WikiMapTest::testMakeForeignLink(), caused by a
single call in DBSiteStore.
Bug: T289926
Change-Id: I0b29963ec0e2e8a38a66e250e81fbc16e42465ab
|
|
|
|
|
|
|
|
|
|
|
| |
This is mostly about adding return types to methods that implement PHP
interfaces, and not passing null to core functions that want a string.
After this patch, and an update to return types in RemexHtml,
tests/phpunit/integration/ has no more errors than in PHP 8.0.
Bug: T289879
Bug: T289926
Change-Id: Ia424f5cc897070f4188ae126b5bf6a1f552db0e1
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This edition brought to you by:
grep -ERIn $(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | tr
"\n" '|' | sed 's/|$/\n/') includes/
I only corrected a fraction of the results provided by that command. I'm
submitting the partial patch now so it doesn't bitrot.
Bug: T305805
Change-Id: If1918c0b3d88cdf90403921e4310740e206d6962
|
|
|
|
|
| |
Bug: T299312
Change-Id: I8a758ed52b18d52cf083b645fbd88725cca983e8
|
|
|
|
|
|
|
|
|
|
|
|
| |
Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI.
Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228
* This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it.
A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki
Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
|
|
|
|
|
|
|
| |
Some minor updates I collected in my local dev environment the
past months.
Change-Id: I30d5339bc262d54ba76e2860a3a3e9e5f002fdc3
|
|
|
|
|
|
|
|
| |
If you want to normalize a page title without following the redirect,
you basically have to re-invent the wheel. Let's DRY it this way.
Bug: T278962
Change-Id: I61080ff0f35199784f4629f61272fb27bac787aa
|
|
|
|
|
|
| |
Auto-generated with rector.
Change-Id: I4f27e10cf029bb067b7bc57d82f7a64e21ea8d42
|
|
|
|
|
|
|
|
|
|
|
| |
This patch touches all uncontroversial (I hope) places where a chain
of isset(), array_key_exist() and the ternary ?: operator can be
replaced with the much shorter ?? feature from PHP 7.
?? does the same. It checks if the element before the ?? is set and
not null. When this check fails, the element after the ?? is used.
Change-Id: Id612e2782ae928164b26b6f0de676c6c7d8302f3
|
|
|
|
| |
Change-Id: I0ccda3d1de29b1044f74ef0972949eb8fbcb707d
|
|
|
|
| |
Change-Id: Iad3375b141b1d87c890baec6ecd16ed92f93e699
|
|
|
|
|
|
|
|
| |
This was pointed out in Ia8443e575c22f47a6d8c63038f4e7ac36815fc27. The
method checks if $url is false, but that's never the case because
getLinkPath returns string|null.
Change-Id: I7850bff928f861d796879301ba0b4e575919407e
|
|
|
|
|
|
|
|
|
| |
These were discovered by setting `null_casts_as_any_type` to true in
phan, and filtering by `PhanTypeMismatchReturnNullable`. Of course there
are others, some of which are false positives, but we cannot suppress
them now (or the UnusedSuppressionPlugin will complain).
Change-Id: Ia8443e575c22f47a6d8c63038f4e7ac36815fc27
|
|
|
|
|
|
| |
Bug: T231636
Depends-On: I78354bf5f0c831108c8f606e50c87cf6bc00d8bd
Change-Id: I58e67c2b38389df874438deada4239510d21654f
|
|
|
|
|
|
|
|
|
|
|
| |
$site->setLanguageCode( null ) is already used in
DBSiteStore::loadSites and this worked because
Language::isValidCode( null ) === true.
This change explicit check for null and allow to set null without
depending on Language::isValidCode( null ) === true.
Change-Id: I0c9fe03cbf1434b0340e61e96360c0aaeb0fe89d
|
|
|
|
| |
Change-Id: I936c3f5fca1a0061f215e80469f5d882cb32ee29
|
|
|
|
|
|
|
|
|
| |
Even though it wasn’t documented in the interface,
MediaWikiPageNameNormalizer::normalizePageName returns false for pages
that do not exist on the remote site. Too many users already depend on
this feature to remove it, so at least document it properly.
Change-Id: Ic2ba86b81bba86b868a6697aa57fdd46432c0d7d
|
|
|
|
|
|
|
|
|
| |
I checked all callers of these methods and almost all of them expect the
method to return false. It looks like this return type was known at some
point, but got lost. Let's add it back.
Bug: T191634
Change-Id: I43484835b8f26e07ada6a2b1452a99ccc6d9b438
|
|
|
|
|
|
|
|
| |
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case passing by reference
Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
|
|
|
|
|
|
|
|
| |
Having such comments is worse than not having them. They add zero
information. But you must read the text to understand there is
nothing you don't already know from the class and the method name.
Change-Id: I994d11e05f202b880390723e148d79c72cca29f0
|
|
|
|
|
|
|
| |
Also: Add language code validation to Site::setLanguageCode().
Bug: T132937
Change-Id: I763ec65cb06d5250a3886a66eefdde8701b2299c
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
SiteObject and SiteArray were deprecated in 1.21 and
can't find any use of them anywhere else in gerrit.
Change-Id: Iff3ba8a60ac9566998cce828c4034066fdefe804
|
|
|
|
| |
Change-Id: I5e735089b3dacea94044fa96f821fc47940f7029
|
|
|
|
|
| |
Follow-Up: I08ffa6a97093abbe85169f664b97498c5f39bf8e
Change-Id: I6c3e607a4f095ca0dcd2f240c0c483b90c16c13d
|
|
|
|
| |
Change-Id: Ibc3f29e21dd5bcfd5ea641a58f8d3f641948741d
|
|
|
|
|
|
|
|
|
| |
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.
Change-Id: Iced714bca004756b461b66067a49a925a7e3b877
|
|
|
|
|
|
|
|
| |
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments
Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
|
|
|
|
| |
Change-Id: Ic0d890f5e27cec017c7f7910a67d53b2edf82079
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This makes sure that SiteSQLStore uses a cache key that includes
information about the serialization structure as well as where the
list of sites was loaded from.
This avoids problems with loading "old" serialized versions from the
cache after an upgrade. It also avoids cache conflicts with site lists
loaded from different places.
Change-Id: I7ad5b8ae63dc24598d41b2f150df7c14105d9f62
|
|/
|
|
| |
Change-Id: I1d8394e0aa65e6ba16f1a1c1021bcae93ebb3e41
|
|
|
|
| |
Change-Id: I08ffa6a97093abbe85169f664b97498c5f39bf8e
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* @licence -> @license
* Protects inline HTML by using double quotes, our inline comments uses
elements such as <h1> or <firstnameLastname@gmail.com>
* Commands in lowercase (@TODO -> @todo, @NOTE -> @note)
* removes @abstract and @static since doxygen detects them from PHP
code.
* various undocumented function parameters
* typos in parameters declarations
Change-Id: I62ad6fc124c355bf31acc780b9614a59cf79a421
|
|
|
|
| |
Change-Id: Iea7bad4367782ee8baa676921625b44dc2b7c45f
|
|
existing interwiki code
This code is meant to replace the current interwiki code, but does not do so just yet. It is however used by the Wikibase extension. This allows us to try out some more things and have the code stabilize more before we migrate over existing interwiki functionality.
Change-Id: I23c47c2c3909a1500350fb560a5f2ec654e2c37e
|