When $wgWatchlistExpiry = true and a user adds a page to their
watchlist, they are currently presented with a combo box where they can
pick a duration of permanent, 1 week, 1 month, 3 months, and 6 months.
This patch adds 1 year to the combo box, and raises the maximum age to 1
year. `api.php?action=watch&expiry=1 year` will now also work.
Bug: T313255
Change-Id: Ia84d6f99584ae23feea3831499d5baee2dd1a024
The files in `tests/phpunit/includes/` directory are now all
covered. Will do sub-directories of `/includes/` next.
Change-Id: I8d5655ce267b6d32cf3c7ee40dc5d2992631b5a6
This ensures that assertions work in a uniform way,
and provides meaningful messages in cause of failure.
Change-Id: Ic01715b9a55444d3df6b5d4097e78cb8ac082b3e
Add a new helper to MediaWikiIntegrationTestCase, since deleting pages
seems to be pretty common in tests.
Some calls to WikiPage::factory were also updated to use WikiPageFactory.
Change-Id: I5b5100273a00ac292a1900022ca79708fa254347
ContentHandler::getContentText() is deprecated and should be
replaced with Content::getText() for TextContent instances.
Change-Id: I556d3d3f64fafd1d54c4a0c5021efaff2d9c3ce8
This ensures that a DerivedPageDataUpdater is initialized earlier during
the edit process, so it can be used by hooks to access the state of the
ongoing edit.
This patch also cleans up PageUpdater a bit to make the internal information
flow more consistent with the idea that PageUpdater is acting as a
builder for a new revision.
Change-Id: I99abb7bdffb2b5ff5979ba5b1e56d39dba4cd3dc
Results in passing a user where previously the fallback
to $wgUser was being used, mostly in tests.
Bug: T255507
Change-Id: Iabe24315b23c0ad1272353186425e71974528d23
Document the fact that EditPage::$edittime can be null, and guard
against a type mismatch error in getExpectedParentRevision() which is
hit if EditPage::$edittime is null and EditPage::$editRevId is a value
that is false when converted to boolean.
Bug: T277204
Change-Id: Ibc9500a314ddfd99452d6c03d8906f69cdebc0e4
All hooks were previously hard deprecated
in 1.35. Affected hooks:
* ArticleRevisionUndeleted - use RevisionUndeleted
* ArticleRollbackComplete - use RollbackComplete
* DiffRevisionTools - use DiffTools
* DiffViewHeader - use DifferenceEngineViewHeader
* HistoryRevisionTools - use HistoryTools
* NewRevisionFromEditComplete - use RevisionFromEditComplete
* PageContentInsertComplete - use PageSaveComplete
* PageContentSaveComplete - use PageSaveComplete
* ParserFetchTemplate - use BeforeParserFetchTemplateRevisionRecord
* RevisionInsertComplete - use RevisionRecordInserted
* TitleMoveComplete - use PageMoveComplete
* TitleMoveCompleting - use PageMoveCompleting
* UndeleteShowRevision - no replacement
Includes a fix for setting the associated rev id
of page protections, which previously was only done
using $nullRevision which was a Revision object created
if any hooks needed it; those hooks were hard deprecated
and so for WMF prod the rev id was not being set.
Bug: T247143
Depends-On: Idfa345193ae99fb2f1c9a8f8d28d8d540a6e3d62
Change-Id: I519167f76a5a3c1f5410415b2721462a3dcc3ec8
Make private the methods only needed
in the class (and tests), no need for deprecation
because they are not used in any extension per
codesearch. Remove EditPage::setPreloadedContent
entirely, since it is unused.
Bug: T252907
Change-Id: Id47421e01da51d57842390682ace2c33eec3b467
Add
- ContentModelChangeConstraint
- EditRightConstraint
- ImageRedirectConstraint
- ReadOnlyConstraint
- UserBlockConstraint
- UserRateLimitConstraint
Additionally:
- Split EditPageTest into a separate file for
all of the constraints being tested
- Add a helper EditConstraintTestTrait
- Add debug logging for EditConstraintRunner for
the result of each constraint
- Changed the order of some of the checks, which
may result in a different failure code if multiple
checks were going to fail, but shouldn't change the
overall result of whether an edit fails or not.
Bug: T157658
Change-Id: Ib8f8b62b9928544e5559c96d82bf850dd8cf9b05
Factory is a service in ServiceWiring, given the number
of dependencies that will eventually be needed, but is
internal and has no corresponding method in MediaWikiServices
Bug: T157658
Change-Id: I801a09f5133bed14da10c64a42ca0658024357d3
Rather than reading from $GLOBALS for
individual tests, set the user to a test user
Keep writing to $wgUser via setMwGlobals
for now.
Bug: T243708
Change-Id: I8935c18f4a0bda704eaf752683ab7f510f1ed3cb
When watching via action=watch, there's no need to
save if nothing has changed. This is already how
EditPage does it (by calling WatchAction::doWatchOrUnwatch())
so this change emulates that and also calls
doWatchOrUnwatch() when saving the watch item.
The format that's used in the expiry dropdown (in action=edit
and action=watch) is also changed to ISO8601 so that it
includes a timezone specifier and removes any ambiguity about
what timezone it is in.
The minor change to $changingWatchStatus is just to keep it as
a boolean and not turn it into an int.
Bug: T260009
Change-Id: If94ea7394588646abdac9a5025b0c8903366b521
Production error reported in T161199 was caused because of some bug on
how section edit support is checked in EditPage.
When we attemt to edit a section of any page; isSectionEditSupported()
method is called to check whether the content model allows that. If it
doesn't, an ErrorPageError is thrown and that's the end. However, the
method flaw is that it only checks the content model of the page's title
which is equivalent to the model of the latest revision.
But ealier page revisions now may contain different content models from
the latest revision.
If a page's current CM ALLOWS section edit and one of its older revisions
has a CM that does NOT ALLOW section edit, attempting to edit any section
of that old revision will lead to a call to the isSectionEditSupported(),
which will now return incorrect truthy result based on the current page's
content model that allows section edit.
This will lead to a call to getOriginalContent() which returns content of
the revision. Attempting to extract content of a section from that will
return null and the null is retained as the return value of getContentObject().
Since the old revision and current revision have different CMs edit will
not be llowed, to explain this, a call will be made to displayViewSourcePage()
method which is typehinted to require Content as the as its first argument.
So because of the bug null will be given to displayViewSourcePage() instead of
Content and that will lead to the TypeError that was reported in T161199.
The initial and simple solution to this bug is to just fix the method to ensure that
it checks both content models of the title and the relevant fetched revision
which will ensure correct result for section edit support is returned.
But later it was pointed out by Anomie that editing section of oldrevision
is not something that was intentinally designed to be so. In fact it was
disallowed from the UI because of its consequence, but it was not enforced
technically. Task T251680 was created to explain this in more depth.
This patch;
* Section edit support is changed to require, in addition to the content
model allowing so, that the revision to be edited be current revision.
* Section editing on non-current revision is already superficially
disallowed as there's UI button to reach that patch. Even the initial
reported bug couldn't have happened or be reproduced any UI means except
by directly playing with the URL
* This will automatically resolve the original bug that led to the error and
enforce what has been already disallowed.
Bug: T251680
Bug: T161199
Change-Id: I05ca6ac90509deec51bf38ec98e9aef169d87459
This adds new functionality to allow non-checkbox widgets to be
used in the checkboxes row of the edit form, and adds a dropdown
widget for the watchlist-expiry field.
Bug: T248494
Change-Id: Ice5113a97b1ef97253bfa6874ea71d910a5cd8fd
This adds a baserevid parameter for detecting edit conflicts, as an
alternative to the less precise basetimestamp parameter. This is
introduced for parity with and use by the new REST api.
Bug: T230843
Bug: T34037
Change-Id: Id7565018f66860b5c2ba688777508db1b88700ae