aboutsummaryrefslogtreecommitdiffstats
path: root/includes/actions/RevertAction.php
Commit message (Collapse)AuthorAgeFilesLines
* Apply proper restrictions on file revert actionFunc2025-03-241-0/+11
| | | | | | | | Users should have 'reupload' or 'reupload-own' rights to do file revert. Bug: T304474 Change-Id: I2d0eaeeea237286741708c2b5920fe7cca3acf50 (cherry picked from commit 7b4aee237e257954195c4d695b2cfe2a9a3b4116)
* Use namespaced classesUmherirrender2024-10-211-0/+1
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: I73fb416573f5af600e529d224b5beb5d2e3d27d3
* Use namespaced classes (3)Umherirrender2024-06-161-0/+1
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: Ia35b2d3105880631dd26ec974068b000ac7f4b6b
* Namespace includes/contextJames D. Forrester2024-02-081-0/+1
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* Deprecate returning a string from Action::getPageTitle()C. Scott Ananian2023-09-211-1/+1
| | | | | | | | | | | | | | | | | In almost all cases we're already returning a Message object from Action::getPageTitle(). Tighten this up by deprecating the string return value and requiring the returned value be a Message; this also encourages proper localization. We pass the returned message to OutputPage::setPageTitleMsg(), which uses FORMAT_ESCAPED. This is a change from before this patch, where messages are formatted using FORMAT_TEXT. If you need to include HTML in the page title, use Message::rawParams(). Bug: T343994 Bug: T343849 Depends-On: I2fe88d95737e673a381d039909e854e4410c8ce3 Change-Id: Ia7da1b7063a77bf94f4c71e9d77c9408c3f4aa46
* Namespace User under \MediaWiki\UserJames D. Forrester2023-09-191-0/+1
| | | | | Bug: T166010 Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
* Reorg: Move three output related classes to includes/Output/Amir Sarabadani2023-09-051-0/+1
| | | | | | | | | | And namesapce them: - StreamFile - OutputHandler - OutputPage Bug: T321882 Change-Id: Iedf8d88c595e580f2d8f0734c92aa5c45618ba33
* Use real type hints for services etc. in actions/Bartosz Dziewoński2023-08-291-5/+2
| | | | | | | | | | | | | | | 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: Ia8d8ce383525951a8ed09570d3eff08e3d3b7ed5
* Reorg: Move Status to MediaWiki\Status\Amir Sarabadani2023-08-251-0/+1
| | | | | | | | | | This class is used heavily basically everywhere, moving it to Utils wouldn't make much sense. Also with this change, we can move StatusValue to MediaWiki\Status as well. Bug: T321882 Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3 Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
* Reorg: Move MWTimestamp to MediaWiki\UtilsAmir Sarabadani2023-08-191-0/+1
| | | | | Bug: T321882 Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
* Replace some deprecated wfExpandUrl calls with UrlUtils::expandJames D. Forrester2023-05-301-2/+4
| | | | | Bug: T319340 Change-Id: I2d81c2d7fd31bb07a2d2057361f1670cdeb8b8d0
* Action: Remove deprecated constructor parametersBartosz Dziewoński2022-11-031-3/+3
| | | | Change-Id: I8188172aeb7ec775eeb2060a1e163112e9e5ed66
* actions: Add Action::getAuthority and use itUmherirrender2022-07-081-1/+1
| | | | | | Shortcut function like SpecialPage::getAuthority Change-Id: I6e83fa270a4c57bbbc8e7343325bfe438f4ff459
* actions: Add missing ->text() in RevertAction::getPageTitle()Timo Tijhof2022-04-131-2/+2
| | | | | | | | | | | | | | | | It currently becomes a string implicitly much later on based on the default format. All other implementations return a string and for messages that typically is formatted as text(). This should be done explicitly as it is the responsibility of RevertAction to know this message and how it is meant to be formatted to get the string that the "getPageTitle" contract calls for. This bug has been here since 2012 with change I2c6fad30e2c4eaebf122, where the code changed from wfMsg (string, unlike wfMessage) to `$this->msg` without calling a format. Bug: T252946 Change-Id: Ibfa335952eb752515a31be6feb6749534bb2a7c4
* Inject services into a bunch more actionsDannyS7122021-07-291-4/+26
| | | | | | | | | | - CreditsAction - MarkpatrolledAction - RawAction - RevertAction Bug: T253078 Change-Id: Ie83e4e9b6220b88bd273656f21704f9c72a7b4ac
* build: Updating dependencieslibraryupgrader2021-07-221-1/+1
| | | | | | | | | | | | | | composer: * mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0 The following sniffs now pass and were enabled: * Generic.ControlStructures.InlineControlStructure * MediaWiki.PHPUnit.AssertCount.NotUsed npm: * svgo: 2.3.0 → 2.3.1 * https://npmjs.com/advisories/1754 (CVE-2021-33587) Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
* Remove unused `'vertical-label' => true` from various formsBartosz Dziewoński2021-06-011-1/+0
| | | | | | | This option only has an effect when using a HTMLForm with display format set to 'table'. All of these forms use the 'ooui' format. Change-Id: I415fd47c13e74ad5ac346538858895a01008f95d
* Complete WikiPage/Article split and deprecate Page interfaceArtBaltai2020-03-281-4/+24
| | | | | | | | Use Action::getWikiPage(), Action::getArticle() instead Action::$page add private RevertAction::getFile wrapper Bug: T239975 Change-Id: I249ac2786f3a89de12bda6082a5166e8984912d0
* Use MediaWikiServices::getRepoGroup in file related classesUmherirrender2020-03-141-4/+2
| | | | Change-Id: Iceec961de4f0cc689f7d3b981afac923b46c98f6
* Unsuppress another phan issue (part 7)Daimona Eaytoy2019-09-031-0/+2
| | | | | | | Bug: T231636 Depends-On: I2cd24e73726394e3200a570c45d5e86b6849bfa9 Depends-On: I4fa3e6aad872434ca397325ed7a83f94973661d0 Change-Id: Ie6233561de78457cae5e4e44e220feec2d1272d8
* Add separate log action for file revertsMGChecker2019-03-021-1/+4
| | | | | | | | | | | | | | | | | | | | This change s adds 'revert' as a separate log action for file reverts, as it allows special formatting of log entries and revisions in UI and filtering for file reverts specifically. Even though there are no log entries with this log action right now, it does seem that this was intended as some point, as there are corresponding test cases in UploadLogFormatterTest, and is listed in $wgLogActionsHandlers and https://www.mediawiki.org/wiki/API:Logevents as well. Furthermore, the i18n message 'logentry-upload-revert' already existed before this change. Because this functionality can not be provided by tags, the 'mw-undo' tag is not suited for this use case. However, it could be added additionally to all log entries with this log action.. Bug: T60209 Change-Id: Ie1ccd8053dc5de58b2297a8460219f0233aab968
* Mass conversion of $wgContLang to serviceAryeh Gregor2018-08-111-4/+5
| | | | | | | Brought to you by vim macros. Bug: T200246 Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
* Convert various FormActions to OOUIThis, that and the other2017-03-111-0/+4
| | | | | | | | | | | Support for OOUI is added to FormAction, and subclasses can enable it as required. PurgeAction, RevertAction, WatchAction and UnwatchAction are converted to OOUI, with minor changes to the forms to give them a neater appearance. Bug: T160236 Change-Id: I5294e5d886e8641e9b63eabc9d7fa8ea93e0df96
* RevertAction: Prevent file revert if current version is identicalBartosz Dziewoński2016-09-021-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | There are several reasons for this: * The file thumbnail shown on the main file page is cached by the browser, as images tend to be. This often confuses users into thinking their revert did not work, and into attempting it again. Recent examples: * https://commons.wikimedia.org/wiki/Commons:Village_pump/Archive/2016/07#Wrong_SVG_rendering_on_File:DuckDuckGo_logo_and_wordmark.svg * https://commons.wikimedia.org/w/index.php?title=Commons:Upload_help&oldid=205348523#Reversion_is_not_working_for_me. Ideally we'd prevent the caching, but preventing repeated reverts should also work. * Refreshing the success page causes the revert to be attempted again (T53383). The usual solution to this is the Post/Redirect/Get pattern, but we want to show a success message so that would require some more changes (something similar to the post-edit notification). * It can serve as a "revert conflict" detection mechanism, crude but better than none. In the unlikely case that uploading an identical older version of the file is necessary, it can still be done using Special:Upload. Bug: T53383 Change-Id: I37e04a536c5c2fc6cdbe59f6f598bb0c7f25d7a7
* Convert all array() syntax to []Kunal Mehta2016-02-171-8/+8
| | | | | | | | | | 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
* Distinguish read vs write mode Action classesAaron Schulz2016-01-151-0/+4
| | | | | Bug: T123589 Change-Id: I3c8fab646d3bb8cd468e5b60c27f3c5d43f9f97c
* Add MWTimestamp::getTimezoneString(), use it in file revert messagegladoscc2015-09-231-4/+7
| | | | | | | | | | | | | | | MWTimestamp::getTimezoneString() returns the timezone name as a message, that supports wiki localization. The code is moved from Parser::pstPass2. The default file revert message is currently always in UTC. This patch sets the default timestamp to be in the wiki timezone (similar to ~~~~). The timezone is passed as a new parameter to the message, with the date / time parameters being merged and handled by $wgContentLang->timeanddate Bug: T36948 Change-Id: I48772f5f3b1635d33b6185776cedfc4ee1882494
* Added wfTransactionalTimeLimit() method and applied itAaron Schulz2015-08-121-0/+2
| | | | | | | | | | | | * Potentially long running POST requests often use multiple transactions, talk to multiple services, or defer updates. Try to make sure they have a chance to complete all of the work. WMF already sets ignore_user_abort() across the board in config, but this applies it to key spots for all installs, in addition to bumping the time limit. * Eventually this can lower the need for high overall time limits. Bug: T102890 Change-Id: I893ddd773064dcd63b5b24c84c6391974f4b5aee
* Fix backlink for RevertActionumherirrender2014-12-051-3/+1
| | | | | | | | | | | RevertAction::getDescription cannot set subtitle on OutputPage, because the subtitle on OutputPage gets cleared before the result of getDescription is added and than the subtitle is gone. Refactored the code for building the backlink into a static function and use it. Change-Id: Iedad0b8e040035a9a10a0b140d2322357e6b539a
* Fold RevertFileAction class into RevertActionwithoutaname2014-07-131-21/+5
| | | | | | | | | RevertAction was simply a dummy class for outputting an error message if the action was not done in the file namespace. I've instead moved RevertFileAction to RevertAction and threw an exception from within checkCanExecute(). Change-Id: I7b87de60680009bf4e74d33342cbe81cc0d211b5
* Allow to set a salt for the edit token in HTMLFormAlexandre Emsenhuber2014-07-081-0/+1
| | | | | | And set one in RevertAction. Change-Id: I9f72c6203e8d9d0770009083263ddca98845f530
* Update docs for files in includes/actions/Siebrand Mazeland2013-11-141-0/+3
| | | | Change-Id: I99655ad3df4bc252e3c176e4f465f5ecd615c55f
* Break long lines in Action classesSiebrand Mazeland2013-11-141-5/+21
| | | | | | Fixes CodeSniffer errors and warnigs. Change-Id: Ic9cf4b9c677b3168d7c9820e2694080907997ee3
* Update formattingSiebrand Mazeland2013-11-141-3/+6
| | | | Change-Id: I3cbe1f5e48730fbbe57e4b20a0c202edddc93c95
* Remove a bunch of trailing spaces and unneeded newlinesumherirrender2012-10-101-2/+2
| | | | Change-Id: I00f369641320acd7f087427ef031f3ee7efa0997
* pass user object for delete/undelete/filerevert in api/guiumherirrender2012-10-061-1/+1
| | | | Change-Id: Idd214fa1ad9d05ebb2a79225256fb344a1085e9d
* Use local context to get messagesAlexandre Emsenhuber2012-03-271-13/+23
| | | | Change-Id: I2c6fad30e2c4eaebf1223d94820dae917231e882
* fix doc grouping for actionsAntoine Musso2012-02-081-3/+3
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/110942
* Reduce some duplication in Action::getRestriction(), all but 2 (plus one ↵Chad Horohoe2011-12-061-4/+0
| | | | | | | extension) return null anyway Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/105320
* Bug 29524 - Rename RequestContext::getLang to getLanguageJohn Du Hart2011-11-211-3/+3
| | | | | | | I'll be amazed if this doens't break any tests. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/103817
* * Changed OutputPage's handling of subtitles to use an array and implode it ↵Alexandre Emsenhuber2011-11-081-4/+2
| | | | | | | | | | | | | | | with "<br />" so that callers don't have to bother whether there's already a subtitle when adding new ones * Make OutputPage::setSubtitle(), OutputPage::addSubtitle() and OutputPage::appendSubtitle() accept a Message object in addition to a string * Added new method OutputPage::addSubtitle() to replace appendSubtitle() and marked it as deprecated * Clear the subtitles when showing an error page * Always show the subtitle from Article::viewRedirect() when showing a page; left the parameter for use in EditPage * Make Article::setOldSubtitle() add two subtitles and has to set "display:inline;" for the three possible divs to avoid too many spacing * Removed the six different backlink subtitles and added one new message 'backlinksubtitle' to replace them and added OutputPage::addBacklinkSubtitle() to factorise common code * Changed EditPage's view source to show "View source for <Page>" with the same backlink in subtitle for consistency with other back links and page titles Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/102417
* * Made PermissionsError exception accept an optional second parameter for ↵Alexandre Emsenhuber2011-11-021-1/+1
| | | | | | | | | | | | | | | the description of the errors (as returned by Title::getUserPermissionsErrors()) * PermissionsError now calls OutputPage::showPermissionsErrorPage() to display the error (this is needed to make the item above work correctly) * Removed the override of the HTML title in OutputPage::showPermissionsErrorPage() so that it shows "Permission errors - Sitename" instead of simply "Permission errors" for consistency with the other things * Pass the error array returned by Title::getUserPermissionsErrors() to PermissionsError where available * Converted direct calls to OutputPage::showPermissionsErrorPage() to throw an PermissionsError error instead * Added 'action-rollback' message that will be displayed when accessing action=rollback without sufficient rights * Changed getRestriction() in subclasses of Action to return null when they previously returned 'read' so that user rights can be check with Title::getUserPermissionsErrors() * Reordered checks to do first user rights, then block (if needed) and finally read only (also if needed) so that users don't think the error is temporary when they both don't have right and the database is locked Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/101630
* Make the PROTO_ parameter to wfExpandUrl() explicit in all calls. There are ↵Roan Kattouw2011-08-191-2/+6
| | | | | | | now no calls to wfExpandUrl() in core that rely on PROTO_CURRENT being the default. Also switch to using getCanonicalUrl() for.... rel="canonical" :D (I picked the right name, I KNEW IT) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/95010
* * Changed action=revert to use a subclass of ActionAlexandre Emsenhuber2011-07-011-0/+136
* Added WikiPage::getActionOverrides() to be able to execute different actions depending on the namespace (obviously needed for action=revert). This is only used when the value of $wgActions for the corresponding action is true; so extension can still override this. * Added Action::getDescription() to ease the change of the page header and the <title> element Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/91284