Commit graph

841 commits

Author SHA1 Message Date
jdlrobson
d11cb401d6 Deprecate the use of Skin::setupSkinUserCss to alter the internal array of styles
Check the internal array of styles to determine whether
the method was inappropriately used to alter the array of styles and
if it was, call wfDeprecatedMsg().

Change-Id: I591b03c2e19d4b8cadfe220b498ae244d332f9fb
2020-11-24 10:49:09 +11:00
Tim Starling
e9608cc17d Revert "Deprecate Skin::setupSkinUserCss"
The commit did not really hard-deprecate overriding of setupSkinUserCss() as stated in the commit message, rather it removed core calls to setupSkinUserCss(), instantly breaking the many skins that still override it. It did not actually create a deprecation period for graceful migration.

As discussed in T267080, there is presently no way to hard-deprecate the override of a method.

This reverts commit 334cfeffd6.

Bug: T257990
Change-Id: I8f669ba30affc437800890c3a875994a9f2eb3c8
2020-11-24 10:03:11 +11:00
jenkins-bot
1976283835 Merge "Update a lot of unspecific "array" types in PHPDocs" 2020-11-13 21:48:24 +00:00
Thiemo Kreuz
6f901ef17c Make use of native array_column() function where possible
Change-Id: I78108e7dc5a10d892e97b0101c1b72cb8d363e97
2020-11-11 22:48:53 +00:00
jenkins-bot
b8c277c932 Merge "Add API validator for titles" 2020-11-07 00:22:42 +00:00
Gergő Tisza
84e9702349
Add API validator for titles
The ISMULTI logic is copied from UserDef.

Change-Id: I794e2277c462b86cb5c3888d1ba509b11fad62aa
2020-11-06 14:09:04 -08:00
jenkins-bot
8eb56c37f3 Merge "Move ApiQuery* tests under the /query subdirectory" 2020-11-04 06:07:39 +00:00
Umherirrender
27816323e5 Use SpecialPageFactory to create special pages in ApiFeedRecentChanges
This makes it easier to change the constructor of both special pages

Change-Id: Id485ffa9fc1c1a9818ab487aed6ef886a7eb35a5
2020-11-03 18:11:46 +00:00
jenkins-bot
3c262bffdf Merge "Make unit tests assertion about assertNotEquals more strict" 2020-11-02 00:37:36 +00:00
Umherirrender
bdf8cefaf8 Make unit tests assertion about assertNotEquals more strict
Originally an autofix of PHPUnitAssertEquals sniff, but manually
updated.

Change-Id: I78efc6f7997f0b7227b40d7eab1495cc7a1d7da5
2020-11-01 23:12:06 +00:00
jenkins-bot
1c67aa07c7 Merge "Fix tests assume badaccess-groups message in singular form" 2020-10-30 23:17:00 +00:00
jenkins-bot
a026fc870e Merge "ApiQueryContinueTestBase: use lower camel case function name" 2020-10-30 20:06:40 +00:00
jenkins-bot
484024b14f Merge "[ApiBaseTest] Set apihighlimits permission to false" 2020-10-30 19:54:08 +00:00
DannyS712
65153e6c4c ApiQueryContinueTestBase: use lower camel case function name
Change-Id: Ie7d3bd0fc6999e8c25881c3befbf565dc258c2aa
2020-10-30 19:03:36 +00:00
Umherirrender
749fb81542 [ApiBaseTest] Set apihighlimits permission to false
The limit tests would fail if there is apihighlimits for everyone
(group *)
mergeMwGlobalArrayValue does not do deep merge, it just overrides;
setting the '*' group to the minimum required to pass tests.

Change-Id: I95fba69af1845f28132370e9ded3350acdfdb8c4
2020-10-30 18:50:00 +00:00
Umherirrender
4c8cbf14ca Fix tests assume badaccess-groups message in singular form
Change-Id: I63476388655ae317453b9ebca793329a23519a4c
2020-10-30 17:20:54 +01:00
Umherirrender
f1d409e095 [ApiUserrightsTest] Start with empty $wgAddGroups/$wgRemoveGroups
In some tests mergeMwGlobalArrayValue should merge the empty array,
but when have settings in LocalSettings.php the result is not the empty
array as needed for the tests.
Just start with empty array to work on top of that.

1) ApiUserrightsTest::testAddAndRemoveGroups with data set "Add with
only remove permission" (array(array(), array('sysop')),
array(array('sysop'), array()), array('bot'))
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
 Array &0 (
     0 => 'bot'
+    1 => 'sysop'
 )
with $wgAddGroups['bureaucrat'] = true; in LocalSettings.php

Change-Id: I092a3353aa65d53c84b765c04ec213ed8294b65d
2020-10-30 16:36:02 +01:00
Aaron Schulz
815912062f Move ApiQuery* tests under the /query subdirectory
Consistency aside, this is useful for grouping more tests
into separate threads when using directory based suites.

Bug: T50217
Change-Id: Ife9acd5990c4ae4a5fc18371559e93d7d86fb57d
2020-10-30 03:31:12 +00:00
Umherirrender
448d2f4d51 Avoid local variable with wg prefix
Change-Id: Ib32cc0db07636238aa0b4f8ea7f8c1ae37084889
2020-10-28 22:21:24 +01:00
Thiemo Kreuz
b0130ca649 Update a lot of unspecific "array" types in PHPDocs
This includes fixing some mistakes, as well as removing
redundant text that doesn't add new information, either because
it literally repeats what the code already says, or is actually
duplicated.

Change-Id: I3a8dd8ce57192deda8916cc444c87d7ab1a36515
2020-10-28 11:01:33 +01:00
Thiemo Kreuz
1fc8d79ac6 Remove documentation that literally repeats the code
For example, documenting the method getUser() with "get the User
object" does not add any information that's not already there.
But I have to read the text first to understand that it doesn't
document anything that's not already obvious from the code.

Some of this is from a time when we had a PHPCS sniff that was
complaining when a line like `@param User $user` doesn't end
with some descriptive text. Some users started adding text like
`@param User $user The User` back then. Let's please remove
this.

Change-Id: I0ea8d051bc732466c73940de9259f87ffb86ce7a
2020-10-27 19:20:26 +00:00
jenkins-bot
0fa9827ee4 Merge "ApiPageSet: Avoid infinite loop when merging redirects" 2020-10-08 17:48:01 +00:00
Erik Bernhardson
861293a36c ApiPageSet: Avoid infinite loop when merging redirects
Redirects can form a loop but it was unaccounted for in this process.
Track seen pages to detect when a loop has formed. In the case of a
redirect loop the ApiPageSet will include the source page and ignore
the found redirects.

Bug: T264534
Change-Id: Ia5f4eeb9a4d90f02aceec3ed83bd4fc4a8a23ca4
2020-10-08 10:00:45 -07:00
hmonroy
45bb027122 Normalize WatchedItem expiry field
Normalize watchlist expiry field so that it is set to
ConvertibleTimestamp and the expiry value validation is
handled by the WatchedItem class.

Bug: T260868
Bug: T260009
Change-Id: I3ef31900cfbe7bce23c5ebe1db777a5137ea6167
2020-10-06 13:00:50 -07:00
jenkins-bot
1d49ad1e5b Merge "ApiEditPage: Don't swap undo and undoafter parameters" 2020-09-30 01:45:14 +00:00
DannyS712
cebbfe47fd Reduce some direct references to $wgUser
Bug: T243708
Change-Id: Ief59ce77469de4185c031413e64d0dee3ea26e60
2020-09-25 17:46:56 +00:00
jdlrobson
7f0412e644 Expose portlet data in SkinMustache
This data structure is sufficient to generate menus in
all Wikimedia deployed skins.

This new method will be used immediately in Example skin:
 Ifb30a2c1314692c2869bd99c523e19c821be1f08

and Vector skin:
I5f7adc1840441b508ffee40139b85b64021789e6

Bug: T262098
Bug: T255924
Change-Id: I1a163cac0bff7620dcac50350cb6b93445a0cfbc
2020-09-22 14:06:29 -07:00
Martin Urbanec
a656d03597 Introduce backend class for blocking users
Rather than having to do DatabaseBlock calls directly,
and then ManualLogEntry calls to facilitate logging,
let's create a BlockUser service, capable of blocking users
and logging, optionally with permission checking.

This should make blocking users easier for developers,
for instance, AbuseFilter or CheckUser can easily
benefit from this commit.

Bug: T189073
Change-Id: Ifdced735b694b85116cb0e43dadbfa8e4cdb8cab
2020-09-22 14:14:01 +01:00
Dov Alperin
a1cd498fdf ApiEditPage: Don't swap undo and undoafter parameters
This made it impossible to correctly undo changes if revision IDs are out of
order with respect to timestamps.

Removes block of code responsible for creating this bug, and updates tests to reflect the change

Bug: T190285
Change-Id: Id5837ed958023bdbf544ae0f79e2d5e05c94cc64
2020-09-21 19:08:20 +01:00
DannyS712
b2ba90191e Add tests for ApiBlock return values when blocking by userid
To ensure the functionality doesn't break as part of
Ifdced735b694b85116cb0e43dadbfa8e4cdb8cab,
which refactors the block handling

Bug: T189073
Change-Id: I7cb1be6532c5b32a4a77924c42483d43a290c464
2020-09-19 17:13:18 +00:00
DannyS712
3d18c1def9 Remove use of $wgUser in ApiUserrightsTest
Bug: T243708
Change-Id: I898561bef67dc2452e5e4a4af60d96b477b13dff
2020-09-13 23:33:21 +00:00
Thalia
addb098c39 Deprecate DatabaseBlock methods moved to DatabaseBlockStore
Following 23c3c70d7f, soft deprecate the static methods on
DatabaseBlock that have been moved to DatabaseBlockStore:
* ::insert
* ::delete
* ::update
* ::purgeExpired

Update calls to the deprecated methods from core.

Change-Id: I1272eb978594fd4f386bda12cbc24131ad7d882f
2020-09-13 22:17:27 +00:00
jenkins-bot
2ed425f39e Merge "PHPUnit integration tests: fix handling of null user in editPage()" 2020-09-13 09:24:18 +00:00
Ostrzyciel
81ac2fc852 PHPUnit integration tests: fix handling of null user in editPage()
The PHPDoc for the editPage method stated that if $user is null,
the test sysop user will be used instead. This is not the case in
practice, as the method simply passes null to the doEditContent
method.

As Ammarpad has pointed out in a comment, this confusion is due to
I5a10163 assuming the sysop would be used, which is incorrect.
It's also probably better for the default user to be a "regular"
user, not a sysop, so I changed it to getTestUser() and noted this
in the doc block.

Depends-On: I7a79e0eaa1617e4d87a8d615a5391723c0e30b6a
Change-Id: I9f77474f40e0f6901aa2c6f846e471b822636aa5
2020-09-13 09:42:52 +02:00
jenkins-bot
a425b0f94d Merge "ApiLogoutTest: Remove use of global $wgUser" 2020-09-10 00:30:53 +00:00
Ammar Abdulhamid
7af5678847 API: Handle ContentHandler exception for content model mismatch
Ensure the content we are trying to save and the base content have
identical content models before proceeding to save so as to forestall
Exception that may be thrown by ContentHandler if it founds they're not.

There are two cases where the models are allowed to differ: Edit that
undoes content model change or edit that's meant to explicitly change
the model. The logic for these is handled separately and may succeed
or fail, but exception will not be thrown.

Bug: T255700
Change-Id: I8782732bb0fc3059693cd7035b7ebb43fd71d333
2020-09-04 03:41:58 +01:00
MusikAnimal
d3c13fc2ce WatchAction: avoid unnecessary UPDATEs when expiry is unchanged
Bug: T258649
Change-Id: I0a5a84480bbd630c7dd1744b4316ea31d7bedd5b
2020-08-11 16:17:01 -04:00
Ammar Abdulhamid
334cfeffd6 Deprecate Skin::setupSkinUserCss
Bug: T257990
Depends-On: I132513a897e40162acd973b9817b3103f4a33333
Depends-On: I363f8c9e39298ab9f74274d288681f2ef88a1894
Change-Id: I13bedd8c14de419ff1a88d5087f5669652cd3123
2020-08-09 02:09:08 +01:00
jenkins-bot
cf29d50e0d Merge "ApiQueryWatchlist: set anon flag as false when relevant instead of omitting" 2020-08-07 19:56:49 +00:00
jenkins-bot
54fcd1c72f Merge "Default to using watchlist expiry of old page when moving pages" 2020-08-06 04:32:24 +00:00
MusikAnimal
884fa47d09 Default to using watchlist expiry of old page when moving pages
Expiries are copied post-send so as to not slow anything down.

Note the expiry feature has been disabled in some unit tests that mock
database queries, simply because these tests are so hard to maintain and
are very fragile. The logic introduced with this patch is covered by the
integration tests.

Bug: T257259
Change-Id: I4223eaa6782a319fb684acf656f54b88a92e5288
2020-08-05 23:32:00 -04:00
jenkins-bot
59aeebc22a Merge "Remove usages of Skin::getAllowedSkins." 2020-08-05 20:43:49 +00:00
Ammar Abdulhamid
5dafaf9028 Remove usages of Skin::getAllowedSkins.
* Move the method to SkinFactory and replaces usages.
* Inject $wgSkipSkins into the SkinFactory

Bug: T257993
Change-Id: I9869cf34c5e87cbad963f48db0649b3b7a252a4a
2020-08-05 02:48:29 +01:00
DannyS712
ac66469a6d Remove hard deprecated ApiTestCase::doLogin
No known uses in any repo on codesearch:
https://codesearch.wmcloud.org/search/?q=doLogin%5C(&i=nope&files=&repos=

Bug: T245355
Change-Id: I606d4f922a3034af786cf64e6d8b211cd12a09af
2020-07-27 14:35:14 +00:00
MusikAnimal
6a898faed2 Add watchlist expiry support to applicable APIs
This introduces an ApiWatchlistTrait that refactors out common code
across APIs that allow you to watch pages. Some methods have been
migrated from ApiBase and changed completely, but codesearch suggests
they aren't being used outside the API modules in this patch.

Bug: T248512
Bug: T248514
Change-Id: Ia18627b9824dca81f44f0571e8420d89b7626cf6
2020-07-13 18:18:15 -04:00
jenkins-bot
8ada06dca1 Merge "Hard deprecate the rest of the Revision class" 2020-07-06 13:57:55 +00:00
DannyS712
2f4b71fc6c Replace uses of Revision constants
Bug: T257010
Change-Id: Id63123e8b8becd31756d5b68ca11edb238ec8a59
2020-07-03 01:23:44 +00:00
DannyS712
0637d80572 Hard deprecate the rest of the Revision class
Bug: T246284
Change-Id: I126d7892c90aa2200c668b5717820e729613bed8
2020-07-02 09:02:02 +00:00
jenkins-bot
a18a39f413 Merge "MediaWikiTestCase to MediaWikiIntegrationTestCase" 2020-07-01 18:39:57 +00:00
addshore
959bc315f2 MediaWikiTestCase to MediaWikiIntegrationTestCase
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)

My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.

Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
2020-06-30 17:02:22 +01:00