Commit graph

34 commits

Author SHA1 Message Date
jenkins-bot
8cbf108de7 Merge "immobile-source-namespace: use blanknamespace for main namespace" 2020-05-28 21:32:09 +00:00
Reedy
229b2c15e8 Fix a plethora of class and function call case mismatches
Bug: T231412
Change-Id: I597a25de3294a6673424f30475760280ef209a8a
2020-05-26 14:14:46 +01:00
DannyS712
29aa36c06e Add MergeHistoryFactory interface, implemented by PageCommandFactory
Bug: T249446
Change-Id: I94676e065a8aed5cad2fe2d5cf16ca586adce97d
2020-05-13 19:08:09 +00:00
DannyS712
b14965e75e Convert MovePageFactory to interface, implement in PageHandlerFactory
Bug: T249446
Change-Id: I1335d976b992f44c8609c298f0ec19d81afa7b84
2020-04-27 23:26:28 +00:00
DannyS712
77bcb3a1b1 immobile-source-namespace: use blanknamespace for main namespace
Also for target-namespace

Bug: T224350
Change-Id: I878b5f7ea1d2cebfc295bf08de372726a580cc28
2020-04-11 01:08:31 +00:00
Brad Jorsch
68e0ff3f64 MovePage: Don't fail to delete a nonexistent file
If there's no file to be moved (e.g. it's a redirect in the File
namespace), don't fail with an error about being unable to delete the
nonexistent file. Just let it work.

Bug: T249550
Change-Id: I605b0e4b39e7863bddbebf339994c819528e3a4c
2020-04-07 13:58:39 +00:00
daniel
495323c063 Remove compat code for pre-MCR schema.
NOTE: This was manually tested to ensure it does not
break updates, see T242764.

Bug: T198557
Change-Id: I1d9f5465018bae10124514bc38169e23e0e613e6
2020-03-24 19:45:47 +01:00
Petr Pchelko
f6f1c41992 Remove usages of deprecated Revision from MovePage
Still have to wrap into the Revision object for hooks.

Bug: T246284
Change-Id: I4a5fe41fe4ba42defab7ecefd942f13ec5711538
2020-03-18 16:46:05 -07:00
DannyS712
fdd814d3ee Remove Title move functions, deprecated in favor of MovePage class
Removes Title::isValidMoveOperation(), ::moveTo(), and
::isValidMoveTarget()

Bug: T241341
Change-Id: I56993a7f29923c467940318ee77f58dd64abcc30
2020-02-19 20:44:55 -08:00
ArtBaltai
30e54b3962 Introduce ContentHandlerFactory
Added:
- ContentHandlerFactory
Tests:
- PHPUnit
Changed
- Calls of changed and deprecated
- DI for some service/api
Deprecated:
- ContentHandler::* then similar to ContentHandlerFactory
- ContentHandler::getForTitle
- ContentHandler::$handlers

Bug: T235165
Change-Id: I59246938c7ad7b3e70e46c9e698708ef9bc672c6
2020-02-07 00:53:51 +03:00
jenkins-bot
da658f33f5 Merge "Add target page as a parameter to articleexists message" 2020-01-02 21:08:50 +00:00
DannyS712
4dd30a93c8 Add target page as a parameter to articleexists message
Bug: T184357
Change-Id: I350d9a8f1504ca878992340db3dd0d60f73594bd
2019-12-20 00:09:45 +00: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
Max Semenik
665b7758c5 tests: getMock() is deprecated
Bug: T192167
Change-Id: I94a4674103b0946d208ff0c28f260506048cb211
2019-10-22 14:20:25 -07:00
jenkins-bot
05ce3b7740 Merge "Title: make newFromText, isValid, and canExist behave consistently." 2019-10-08 13:54:57 +00:00
daniel
9171cbe4ca Title: make newFromText, isValid, and canExist behave consistently.
This patch fixes the documentation of newFromText and makeTitleSafe to
no longer state incorrectly that any Title they return is guaranteed to
be valid. That has never been true.

It also makes canExist() checks a lot stricter, to match the assumptions
of current callers, namely that the title can exist as a wiki page.

Finally, it replaces several existing calls to isValid() with calls to
canExist().

Bug: T229705
Change-Id: I2a483136ec6acca49afb5eb32cb94616672b8fb2
2019-10-08 11:16:11 +02:00
Max Semenik
0809a10b90 MovePageFactory: make $constructorOptions a constant
Change-Id: Ia24add9d2805f61aae65bb1a56e13221f57d4547
2019-10-05 12:55:01 -07:00
jenkins-bot
eba2737ab9 Merge "createNoOpMock() method for PHPUnit tests" 2019-08-29 18:15:43 +00:00
Aryeh Gregor
709773ab57 createNoOpMock() method for PHPUnit tests
This is just a shortcut for a commonly-used pattern, when you want to
create a mock that's never supposed to have methods called.

Change-Id: Ia7267e3d3108c1ff94485f7e44bf409808a762be
2019-08-29 18:00:37 +03:00
Aryeh Gregor
7fb4a95563 Remove unneeded overrideMwServices/resetServices
Change-Id: If6cbdec05b8f310ef3a0b4649aaa16d9fb80a047
2019-08-29 14:26:18 +03:00
Aryeh Gregor
4f912600c0 Return better errors from MovePage::isValidMove()
Previously the errors returned were incorrect or redundant in a number
of cases.

Change-Id: Ief96e69b0ae09afb9642f9ed93b2419a36351292
2019-08-19 20:26:02 +03:00
Aryeh Gregor
8a8f23ddc6 Add a bunch of MovePage tests
The expected values in many cases are silly, because our code is
currently silly and could use some refactoring. These are marked with
@todo. In one case the return value is even wrong (moving to an invalid
non-empty name is considered valid).

Change-Id: I9649a4de12bbcd6263c85de37d7b9365d9c0aeb4
2019-08-19 20:26:02 +03:00
Aryeh Gregor
b3e4a9c456 Use RepoGroup service in MovePage
Change-Id: I2b59de374d49652b61f074a9da5483c0d991e7a6
2019-08-19 20:26:01 +03:00
Aryeh Gregor
8ec24b607a Introduce MovePageFactory
This will help make MovePage more testable.

In the course of abstracting the logic out of ParserFactoryTest to
FactoryArgTestTrait so it could be used in MovePageFactoryTest, I made
them all unit tests instead of integration. This required some
modification to the Parser constructor so that it didn't access
MediaWikiServices unnecessarily.

Change-Id: Idaa1633f32dfedfa37516bb9180cfcfbe7ca31aa
2019-08-19 20:25:31 +03:00
Aryeh Gregor
a3e8e22f9d Don't use new MCR schema without using DB
If $wgContentHandlerUseDB is false and
$wgMultiContentRevisionSchemaMigrationStage is not SCHEMA_COMPAT_OLD,
RevisionStoreFactory::getRevisionStore() throws. This is coming up in
some seemingly unrelated code changes, perhaps due to access of stale
service objects, but I'm not sure because I can't reproduce locally. So
this is a shot in the dark to fix it.

Change-Id: Id29a62e1f537fa1b2016aac396773b728e238cda
2019-08-13 17:05:24 +03:00
Aryeh Gregor
ed625e11cd Hard-deprecate Title::moveTo and friends
moveSubpages wasn't officially deprecated at all before this release,
but there were no callers in codesearch outside core, so it should be
safe to hard-deprecate.

Bug: T208775
Change-Id: Icea9f1dc45d8bd8c96cc159d631f18c394aab4b7
2019-05-28 11:52:36 -05:00
Aryeh Gregor
9510dbc4ce Introduce MovePage::moveSubpages(IfAllowed)
Title::moveSubpages() is now deprecated, and the one caller in core and
extensions was ported.

Change-Id: Ic1dc5a6f1a1bef89a35c13f0a72f6740c6a01c50
2019-05-22 14:44:27 -05:00
Umherirrender
618a064c4c Add missing @covers to action related tests
Change-Id: I7653b5fa6f6a3c247f735ac22fda12e7c9549786
2019-02-01 22:13:32 +01:00
Daimona Eaytoy
495331ff07 Add a Status and a $reason parameter to TitleMove hook
So that using this hook it's possible to prevent the move, also
providing some more context.
Also, clean error message: instead of going with "you do not have
permission blah blah" for *every* kind of error, use it only when the
error is actually about permissions, and use a generic message
otherwise.

Bug: T208907
Change-Id: I4733724075b7514e9db59e7be772d9409aa9da87
2018-11-13 08:51:02 +00:00
Kunal Mehta
38129123f2 tests: Add some more @covers tags
Change-Id: I84b66879773d97593152b683ff69d034ed67aa3d
2018-05-07 17:49:01 +00: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
Vivek Ghaisas
9f5b6f5aeb Fix whitespace issues around parentheses
Fix issues found by MediaWiki.WhiteSpace.SpaceyParenthesis sniff.

Bug: T102617
Change-Id: Iec7f71e64081659fba373ec20d9d2006306a98f4
2015-06-16 22:14:02 +03:00
Kunal Mehta
978fc13da2 Check $auth parameter in Title::isValidMoveOperation()
This also includes the integration test from SemanticMediaWiki that
caught this issue.

Bug: T74870
Change-Id: I699e14958ee36ec5e86278e5dc0caed2a015d9af
2015-02-05 10:52:10 -08:00
Kunal Mehta
39fffcedb0 Move non-user specific things from Title::isValidMoveOperation() to MovePage
Change-Id: Ieffeb0c7a15b202dcbdaf2a9d0b9bcdc10e360d2
2014-09-19 20:11:59 +00:00