Instead of putting logID/false in the status' value, add getters that
can be used to retrieve this information. Also, make it return an array
of log IDs, which is easier to expand later on to account for deletion
of related pages (e.g. associated talk page).
Note: this change will be backported to 1.37.
Bug: T288758
Change-Id: I7ef64242ae0cb7018a4b1e8eb004a5563925b9a4
Only the PageSelectQueryBuilder subclass has the methods that are
interesting for users of this method.
Bug: T291288
Change-Id: If73748cc24d2ab2ee7999db14201d7fc19b2cd34
Dependency injection and cleanup. Rename ::isDeleted
to more clear ::hasArchivedRevisions.
Bug: T290022
Change-Id: Ifff6076f79ee2ad08e4635fba8fd141e4de93b01
Copy and paste methods. Subsequent patches will tidy this up.
Also improve test coverage.
Bug: T290022
Change-Id: I549ecc3ec89f0303a3cc342916f06da4bf77595e
WikiPage::doEditUpdates() has been deprecated. Using the PageUpdaterFactory's
newDerivedPageDataUpdater() is the new way forward. Also, I made sure to have
the `$options` array with the `causeAction` and `causeAgent` key/value pairs.
Change-Id: I9f2c212d7c83a46799f9f947dc372dc364289680
Move all output-related code from Article to DeleteAction.
Article::doDelete is now deprecated, because there are some callers in
the wild, although I don't think any caller should need it.
Kill some ancient-PHP-style pass-by-refs that are useless and only make
the code more error-prone for both the caller and the callee.
Bug: T288282
Change-Id: Ic1de0ed8ebba15da5ed9f5cd11625017360a7672
Add entry in MediaWikiServices, add wiring code, inject all dependencies.
Also add an alternative entry point with permission checks, like for
DeletePage.
The new service is no longer @unstable, and the relevant methods in
PageArchive were deprecated.
Bug: T290021
Change-Id: I452a98679f5bfea3f7367aacd5c930acffd32102
This name is consist with the rest of the setter and getter methods
in ParserOutput. Renamed the methods in OutputPage, ImageHistoryList,
ImageHistoryPseudoPager, and ContribsPager as well for consistency;
it also makes chasing down lingering references in codesearch easier.
Soft-deprecated the old name for 1.38. Hard-deprecation will follow,
but there are a number of users in production that should be chased
down first.
Code search:
https://codesearch.https://codesearch.wmcloud.org/deployed/?q=(allow%7Cprevent)Clickjacking&i=nope&files=&excludeFiles=&repos=
Bug: T287216
Change-Id: I9822c60c180d204bd30cb4447a1120155d456da4
CommentParser:
* Move comment formatting backend from Linker to a CommentParser service.
Allow link existence and file existence to be batched.
* Rename $local to $samePage since I think that is clearer.
* Rename $title to $selfLinkTarget since it was unclear what the title
was used for.
* Rename the "autocomment" concept to "section link" in public
interfaces, although the old term remains in CSS classes.
* Keep unsafe HTML pass-through in separate "unsafe" methods, for easier
static analysis and code review.
CommentFormatter:
* Add CommentFormatter and RowCommentFormatter services as a usable
frontend for comment batches, and to replace the Linker static methods.
* Provide fluent and parametric interfaces.
Linker:
* Remove Linker::makeCommentLink() without deprecation -- nothing calls
it and it is obviously an internal helper.
* Soft-deprecate Linker methods formatComment(), formatLinksInComment(),
commentBlock() and revComment().
Caller migration:
* CommentFormatter single: Linker, RollbackAction, ApiComparePages,
ApiParse
* CommentFormatter parametric batch: ImageHistoryPseudoPager
* CommentFormatter fluent batch: ApiQueryFilearchive
* RowCommentFormatter sequential: History feed, BlocklistPager,
ProtectedPagesPager, ApiQueryProtectedTitles
* RowCommentFormatter with index: ChangesFeed, ChangesList,
ApiQueryDeletedrevs, ApiQueryLogEvents, ApiQueryRecentChanges
* RevisionCommentBatch: HistoryPager, ContribsPager
Bug: T285917
Change-Id: Ia3fd50a4a13138ba5003d884962da24746d562d0
It allowed replacement of the PageArchive object, which is so horrific
that I'm going to have nightmares for a while after seeing that code.
A new hook, PageUndelete, was added to give users something to migrate
to that is also used by API requests etc, and for symmetry with
DeletePage.
This change needs to be in 1.37, since the capability of replacing
PageArchive will be removed in 1.38 by the addition of the UndeletePage
service. Note that in 1.37, errors from the status will not be used
since PageArchive::undeleteAsUser returns false in case of errors.
The only usage of this hook in WMF production (ext:Newsletter) is fixed
in a dependent patch. A non-WMF usage in ext:Video is not fixed since
that one does replace PageArchive and I'd rather not mess with that.
SpecialUndelete has two other similar hooks that pass a PageArchive by
reference, but in those places PageArchive is used as a lookup (not an
undeletion command), so they're not affected by the ongoing undeletion
work, and we cannot deprecate them since we'd have to provide
replacements first. I've left some comments anyway.
Bug: T290021
Change-Id: If434c7ff9de92482f84d535baae5139c18081174
- Make it consistently return a StatusValue, as is expected by this
kind of methods.
- Omit the comment in the returned status, as it matches the one
that was passed as method parameter to undelete().
- Return a good status if there was nothing to undelete. Callers can
check the status value to determine if something was deleted.
The new format will make getRevisionStatus and getFileStatus
unnecessary, and will also make it impossible to distinguish between
file-related and revision-related errors. I don't think this is really
important (only SpecialUndelete uses the respective methods).
PageArchive is responsible for maintaining backwards compatibility with
the old format.
Bug: T290021
Change-Id: I51179fa7707b5fc44d2257cc927edc0bd798a4d9
Checking whether the given tags can be added is permissions-related, so
it should be checked in authorizeDeletion(). Not doing so means that the
caller has to do the check, but this wouldn't work well if the user is
not allowed to add the specified tags AND to delete the page: if tags
are checked before calling deleteIfAllowed(), the caller would
presumably die with a message like "cannot add tags", but it would
make more sense to die with a message like "cannot delete pages".
Also fix broken logic in DeletePage that, when the hook error was the
empty string, caused it to be converted to an array with a single
element (the empty string), and causing the deletion to fail without
errors if mergeLegacyHookErrors is true. This shouldn't be affecting
anything, since the deprecated WikiPage::doDeleteArticleReal sets
mergeLegacyHookErrors to false.
Bug: T288758
Change-Id: Iba51fcf38efbf3acd4f89de10e4221e00043c6ca
New option 'absoluteURLs' was added to getText method
of the ParserOutput object that replaces all links
in the page HTML with absolute URLs.
Removing the action=render special case from Title
seems safe cause we will end up replacing the result
with absolute URL if we're in a render action no matter
where Title::getLocalUrl was called from.
This change is safely revertable from the perspective
of ParserCache.
Bug: T263581
Change-Id: Id660e1026192f40181587199d3418568f0fdb6d3
This is just moving code verbatim, removing now-unneeded stuff, and
duplicating tests as well.
Bug: T290021
Change-Id: I540ddaaa11dfabcf0b87b608b151b5e34d199fd8
This is where the UI logic is supposed to live. The remaining methods in
FileDeleteForm will later be deprecated in favour of a dedicated command
object.
This patch tries to move the code to the new class with minimal changes,
with cleanup left to do for later.
Also change return typehints and docs for getFile(): WikiFilePage::loadFile()
is guaranteed to load a file. The "|bool" would confuse PHPStorm and
phan.
Note that FileDeleteForm is unused everywhere, except for some static
methods not touched by this patch.
Bug: T288282
Change-Id: I4fa1dfa096cd2ae7a58067764b12a275b1cce1d5
Also remove the "@unstable" annotation from DeletePage.
Methods without known usages were hard-deprecated, the others
soft-deprecated.
Bug: T288758
Bug: T288759
Change-Id: I30c62572fd533526779a8ade3ab178f35bebb522
WikiPage is not the right spot to compute all the revert
related stuff - we already figure out manual reverts when
building the EditResult, lets figure out rollbacks and undos
in there as well.
Change-Id: I9fdc5f24c1db1eb0452b90bf4af1ef5ffbce6cb8
In both cases the typehints were changed to the new interfaces. For the
ArticleDelete hook, the replacement has no $error param and requires the
caller to set a fatal status if it wants to abort.
Bug: T288758
Change-Id: I9540f6ab2075bcf56bd4fdc79c611c883246cdce
With this patch deprecation warnings will be emitted
if $wgUser is accessed or written into. The only pattern
of usage still allowed is
$oldUser = $wgUser;
$wgUser = $newUser;
// Do something
$wgUser = $oldUser;
Once there is no deprecation warnings, we know that nothing
legitimately depends on $wgUser being set, so we can safely
remove the code that's still allowed as well.
Bug: T267861
Change-Id: Ia1c42b3a32acd0e2bb9b0e93f1dc3c82640dcb22
Add 'rev_suppressed_text' failure message to avoid reusing
'rev-deleted-text-permission' for both deleted and suppressed edits.
Additionaly fix qqq documentation of 'rev-deleted-text-permission':
It's used in both privileged and unpriviliged context. The log link
it has links to public log.
Also fix qqq doc of 'rev-suppressed-text-permission': It's only
shown in privileged context. The log link it has links to private
log
Bug: T282203
Change-Id: Iffcbe9d62c2b2947ebb086579f87d977d8a5eb3d
Currently, ImagePage::openShowImage compares the actual size of the main
thumbnail to the bounding boxes of the additional thumbnail links to
exclude duplicate links. However, rounding on portrait images can mean
that neither the height nor width of the thumbnail exactly match the
bounding box size.
This patch adds an additional comparison between the main thumbnail
bounding box and the additional size bounding boxes. The comparison
between the main thumbnail actual size and the additional size bounding
boxes remains to prevent any edge cases on that end. It may be
redundant.
Bug: T272201
Change-Id: Ib947f4a3ee26a1f885c0f38014fa23aa218e6ebe
addGoodLinkObj() has many optional arguments, but omitting them actually
means corrupting the cache.
Nearly all existing callers are in tests.
So LinkCacheTestTrait::addGoodLinkObject() was created only
for testing. It is better to have this method in the
trait, because building the row directly in each test
would make these tests brittle against schema changes.
The only usage in WMF production code was in WikiPage and has been
fixed.
Bug: T284955
Change-Id: I03a2bd9ed64fcc0281ee29a286c8db395a9e03d9