| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following functions were removed:
- ApiPageSet::getTitles
- ApiPageSet::getGoodTitles
- ApiPageSet::getMissingTitles
- ApiPageSet::getGoodAndMissingTitles
- ApiPageSet::getRedirectTitles
- ApiPageSet::getSpecialTitles
Bug: T339384
Change-Id: Iba8499c2d1b4a10b918f563069534b90fed7f6f9
|
|
|
|
|
|
|
|
| |
Use modern php syntax to call a callable.
Reduce the stack trace to improve performance
and better IDE and static analyzer support
Change-Id: I9ef131032a662a3b8db69aa7079dbd51f88f575a
|
|
|
|
|
|
|
|
|
| |
isset() should only be used to suppress errors, not for null check.
When the property is always defined, there is no need to use isset.
Found by a new phan plugin (2efea9f989)
https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#isset
Change-Id: Ia53b71dff3299837856ae3c004cd0227bd45e05b
|
|
|
|
|
| |
Bug: T353458
Change-Id: I3ea6b08c5018ba03ba45c5766e1f46e12f6b8597
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follow-up to 12a4c08ad83ef55e440b88e5f9d511fd224afa6f.
I didn't review it carefully enough to notice that when these
functions return arrays, they contain a message key and parameters,
not a key and fallback keys (while other API documentation message
code uses fallback keys).
Instead of `$this->msg( $msg )`, this code must be written as
`is_array( $msg ) ? $this->msg( ...$msg ) : $this->msg( $msg )`
or `$this->msg( Message::newFromSpecifier( $msg ) )`, both of which
are ugly, but the latter looks a bit better to me.
Bonus changes:
* Add documentation to prevent a repeat of this mistake in the future
* Remove some unreachable dieDebug() calls (the Message class already
throws for bad inputs)
It seems that we don't have any definitions using such arrays
in the core API classes. There are only a few uses in extensions,
e.g. AbuseFilter's 'apihelp-query+abuselog-param-filter' message,
which is passed the wrong parameter without this change.
Bug: T372988
Change-Id: I44c1c3c7d0c069e500c85a58c27e9b675b0b68ee
|
|
|
|
|
| |
Bug: T353458
Change-Id: Id3202c0c4f4a2043bf97b7caee081acab684155c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following functions are now hard-deprected:
- ApiPageSet::getTitles
- ApiPageSet::getGoodTitles
- ApiPageSet::getMissingTitles
- ApiPageSet::getGoodAndMissingTitles
- ApiPageSet::getRedirectTitles
- ApiPageSet::getSpecialTitles
Bug: T339384
Depends-On: Ie117ac8417e7f62ef3f199312a7f57df205900b2
Change-Id: I9533f89bbd370bcec43ca37200b2fedd0610183f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unfortunately Phan gets super confused here, which is why I had to
split this off from I454baef. While it might be possible to silence
Phan I think the better solution is to get rid of the problematic
null initialization. The null is never used for anything, anywhere.
The contrary. In ApiPageSet::processDbRow() the null values are
accessed with an array operator as if they are arrays, which
(currently) forces PHP to silently initialize it to actually be
an empty array. Instead I suggest to make this magic behavior
explicitely visible.
Change-Id: If7c4f49e46cc6050942611a7b2bca46ea550b31c
|
|
|
|
|
|
|
|
|
|
|
| |
A lot of arrays cleverly used as maps and sets in here. I believe
it's very much worth documenting them all as precise as possible.
This does have potential ripple effects on all code that uses these.
Naturally this can't have an effect in production as it's
exclusively about PHPDoc documentation.
Change-Id: I454baef2d871cbbaf0bb85886774cf74728b692a
|
|
|
|
|
| |
Bug: T339384
Change-Id: Ib2872498338c01ad63bbcee859f89f94311ee325
|
|
|
|
|
|
| |
Changes to the use statements done automatically via script
Change-Id: Icc5b59f9ef6319d1fb785fcda17f43c94f94cc38
|
|
|
|
|
|
|
|
|
|
|
| |
The parameter is unused anyway. If we are ever going to reuse this
parameter for anything it clearly needs to be a IReadableDatabase,
IMHO.
It probably makes sense to deprecate and remove the method entirely.
But I want to start simple. Just to unblock I270a8e8.
Change-Id: I9ce8740dc5452d2502442e5fe733ff7ded56d804
|
|
|
|
|
| |
Bug: T353458
Change-Id: Ic3f3168ef17113f5fb3ec11e0a47f52d65eefba9
|
|
|
|
|
|
|
|
| |
While this is technically the same as before, the array<int,…> syntax
makes it more obvious that the array index is a meaningful value
(e.g. a page id) and not just a meaningless sequence.
Change-Id: Idc49d6f7cf43b158632115dc1b76c0cab548bc56
|
|
|
|
|
|
|
|
|
| |
After the other changes in T346290 these fields can never be null.
The only place that needs to handle null values is the migration
script fixInconsistentRedirects.php.
Bug: T346290
Change-Id: I0235c4be93b203f369b29522b54c0110ee8d61e9
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
This migration has been completed to the extent possible (except for
corrupted pages), and we can remove this to simplify the code.
Bug: T346290
Change-Id: I3627b3d364c4faf836bbe176cb8709f469113bac
|
| |
| |
| |
| |
| | |
Bug: T166010
Change-Id: Ia2e5a7367cc8cdbd8a7b845ae2fd5d776ff22891
|
| |
| |
| |
| |
| |
| |
| | |
One of the big ones, so doing this alone.
Bug: T166010
Change-Id: Ibe103cd362535d3cb94cb8931e95fc74099d1497
|
|/
|
|
|
|
|
| |
SpecialPageFactory is already here, but none of the others were yet.
Bug: T166010
Change-Id: I9689bf0a1ab329625e23669b99f019b96295fffd
|
|
|
|
| |
Change-Id: I57c25d953700ca1cd97cc71ec2a28cbeb9ee875f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mostly used find-and-replace:
Find:
/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?)[\s\*]+/\s*(private|protected|public) (\$[a-z]\w+;\n)((?=\s*/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?))\n|)
Replace with:
\3 \1 \4
Followed by some manual review to make sure I'm not changing too much,
omitting some changes that looked too complicated and anything that
caused test failures, and some whitespace fixes.
Change-Id: I6ec7587607df4f1a4f448a096c3e44c4e5270b70
|
|
|
|
|
|
|
|
| |
When the value of the associated array is not used, there is no need to
use array_keys and create internal a copy of the array, just omit the
value with $_ to tell static analyzer that the var is unused.
Change-Id: I5c6d667e98c0167c0573c683f0d617bc1d4ca619
|
|
|
|
|
|
|
| |
As much as possible
Bug: T330641
Change-Id: Icb943d6d65b210760ba8966419327c9603e768e0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no way to express that Title::castFromPageIdentity(),
Title::castFromPageReference() and Title::castFromLinkTarget()
can only return null when the parameter is null. We need to add
Phan suppressions or explicit types almost everywhere that these
methods are used with parameters that are known to not be null.
Instead, introduce new methods Title::newFromPageIdentity() and
Title::newFromPageReference() (Title::newFromLinkTarget() already
exists), without the null-coalescing behavior, and use them when
the parameter is not null. This lets static analysis tools, and
humans, easily understand where nulls can't appear.
Do the same with the corresponding TitleFactory methods.
Change the obvious uses of castFrom*() to newFrom*() (if there is
a Phan suppression, a type check, or a method call on the result).
Change-Id: Ida4da75953cf3bca372a40dc88022443109ca0cb
|
|
|
|
|
|
|
|
|
|
| |
The redirect targets another variant, but the target does not exist.
It causes infinite loop when querying the page with the redirect
and converttitles flags are both set.
Check the mConvertTitles to stop re-resolving the same title.
Bug: T333050
Change-Id: I64c5886dbd0a9148eeff033ba56306bcb7f2eb8c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is moderately messy.
Process was principally:
* xargs rg --files-with-matches '^use Title;' | grep 'php$' | \
xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1'
* rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \
xargs rg --files-with-matches 'Title\b' | \
xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1'
* composer fix
Then manual fix-ups for a few files that don't have any use statements.
Bug: T166010
Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a
Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These three classes:
- TitleArray
- TitleArrayFromResult
- TitleFactory
We need to move these and the rest of files under title/ to Title/ (and
namespace them) but the patch will become way too big given that Title class is
also one of them.
Bug: T321882
Change-Id: Iac1688172ee457348a08a470c86e047571feb8e0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Redoing I5ea70120d74 but without moving WebRequest that caused issues
with phan-taint-plugin.
Moving:
- DerivativeRequest
- FauxRequest
- FauxRequestUpload
- PathRouter
- WebRequestUpload
Bug: T321882
Change-Id: I832b133aaf61ee9f6190b0227d2f3de99bd1717b
|
|
|
|
|
|
|
|
|
| |
This reverts commit 2bdc0b2b7209441a42a784157633a8a01b321922.
Reason for revert: T166010#8349431
Bug: T166010
Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Moving:
- DerivativeRequest
- FauxRequest
- FauxRequestUpload
- PathRouter
- WebRequest
- WebRequestUpload
Bug: T166010
Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
|
|
|
|
|
|
|
|
| |
Introduced in PHP 7.1. Because it's shorter and looks nice.
I used regex replacement.
Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
|
|
|
|
| |
Change-Id: I1f20597093448d00435158a9ac861873000bb057
|
|
|
|
|
| |
Bug: T311866
Change-Id: I5d79fce9d48b0d366ee2a918d3133186a5b65eb7
|
|
|
|
| |
Change-Id: I498a315b8b4b56d5e2f939e797adbe0487cd7d07
|
|
|
|
| |
Change-Id: I34ffcb70efbfa257da8dab6e0790aa0d697caf5b
|
|
|
|
|
|
|
| |
This covers all occurrences of /onfig->.*get( '/ in includes/.
Undoubtedly there are still plenty more to go.
Change-Id: I33196c4153437778496f40436bcde399638ac361
|
|
|
|
|
|
|
|
|
|
|
| |
Make phan stricter about null types by setting null_casts_as_any_type to
false (the default in mediawiki-phan-config)
Remaining false positive issues are suppressed.
The suppression and the setting change can only be done together
Bug: T242536
Bug: T301991
Change-Id: I0f295382b96fb3be8037a01c10487d9d591e7e01
|
|
|
|
|
|
|
| |
build: Removes phan suppresses due to changed parse order of phan-taint
Bug: T283314
Change-Id: I616d1f8f62225210566d0ea5b9cc295fdc3e54fb
|
|
|
|
|
|
| |
Found by phan strict checks
Change-Id: I2b2ae12ca39d67140f0f3c1cc5066c8ef72716de
|
|
|
|
|
|
|
|
| |
This makes them consistent with missing titles and page IDs in
ApiQuery::outputGeneralPageInfo().
Bug: T301041
Change-Id: Ic2be91dce592521682dc7933161cd23fb00e628e
|
|
|
|
|
|
|
|
| |
Nothing to learn from these.
You can find a longer explanation in the comments in I93751e6.
Change-Id: I195aae70fc282b58be5b18160783f27d38605d15
|
|
|
|
|
|
|
|
| |
These columns are nullable, but the method doesn't accept null.
Found in Logstash.
Change-Id: I3eaafe31005c9319fdd03f8f4b54e7b51ef430f9
|
|
|
|
|
|
| |
local vars always defined, no need to use isset
Change-Id: Id033d2eb9a878e9f5bb00ee90687e36511cd2ef8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
developer's intention
array_fill_keys() was introduced in PHP 5.2.0 and works like
array_flip() except that it does only one thing (copying keys) instead
of two things (copying keys and values). That makes it faster and more
obvious.
When array_flip() calls were paired, I left them as is, because that
pattern is too cute. I couldn't kill something so cute.
Sometimes it was hard to figure out whether the values in array_flip()
result were used. That's the point of this change. If you use
array_fill_keys(), the intention is obvious.
Change-Id: If8d340a8bc816a15afec37e64f00106ae45e10ed
|
|
|
|
|
|
| |
Method was removed, uses ILanguageConverter::findVariantLink()
Change-Id: Ib2d3bc67b731582e4f83c69d95cca2ed97773662
|
|
|
|
|
|
|
| |
Starting a larger patch to cleanup and refactor the
class, and it helps to have everything documented.
Change-Id: I089a8f6bb89742d594388abe49bc47cd132113f6
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
In all these cases the property is unconditionally set in
the constructor. The extra initialisation is effectively
dead code and an extra source of errors and confusion.
Change-Id: Icae13390d5ca5c14e2754f3be4eb956dd7f54ac4
|
|/
|
|
|
| |
Bug: T278459
Change-Id: Ie817fd476d6236791431b5ba5ce557800ef5222d
|