Commit graph

472 commits

Author SHA1 Message Date
Matěj Suchánek
a3cdd0a4fc Replace a Linker::link() call in InfoAction.php
Bug: T149346
Change-Id: I41906d4d24468467e1c0740d748fe96ea2dab484
2017-06-17 21:37:04 +02:00
Amir Sarabadani
d062560f24 Require $key in msg() functions
Note: calling msg() with no parameter was never supported,
doing this on a RequestContext for example would result in:
PHP Warning:  Missing argument 1 for wfMessage() ...followed
by a bunch of fallout.

So this patch only formally declares what was already a
requirement in reality.

Change-Id: I1864afb8bcc641698689828914949a06506d8f3a
2017-06-14 13:26:27 +04:30
Gergő Tisza
016452cd09 ChangesList: Expose basic properties of lines as data attributes
We have several types of change lists (old RC/watchlist/related
changes, enhanced RC/watchlist, history) with slightly different
HTML, each with their own idiosyncracies. JavaScript code trying
to identify lines by log ID / revision ID has to jump through all
kinds of hoops to work with that.

To simplify the lives of frontend / gadget maintainers and provide
something approaching an API for these pages, we now expose the basic
attributes of each change line (revision ID for edits, log type/action
and ID for log events) as data attributes.

The OldChangesListRecentChangesLine, EnhancedChangesListModifyLineData,
EnhancedChangesListModifyBlockLineData, PageHistoryLine,
ContributionsLineEnding and DeletedContributionsLineEnding hooks
are updated accordingly. New hooks (LogEventsListLineEnding and
NewPagesLineEnding) are added for the change list pages which did
not yet have them.

Change-Id: I6dd006d0b1b0fd35c0020f0f9eea9113eca30b35
2017-06-08 23:19:45 +00:00
Kunal Mehta
3e4f40851a InfoAction: Avoid deprecated wfMemcKey()
And the deprecated ObjectCache::getMainWANInstance() while we're at it.

Change-Id: Id7bb6a8c3e8269345e054d2c2bf202304b74c3cf
2017-05-23 21:01:08 -07:00
jenkins-bot
6fbafe5494 Merge "Convert various FormActions to OOUI" 2017-04-16 19:30:55 +00:00
Aaron Schulz
d735dc562d Move Database and subclasses to Rdbms namespace
Change-Id: I52bef87512f9ddd155d1f4cc0052f6b7a0db5b42
2017-04-12 10:43:57 -07:00
Brad Jorsch
f4a306fb18 Deprecate "Avoid page_touched update for HTTP GET action=purge requests"
This reverts most of commit c84ba4d864.
The changes made there are no longer needed, and nothing in Gerrit seems
to have started using them since they were added.

The added constants in WikiPage, WikiPage::getLastPurgeTimestamp(), and
Article::getLastPurgeTimestamp() are deprecated, useless, and unused,
but not removed yet since they snuck into 1.28 so we can't revert them
without a deprecation period. Sigh.

Bug: T145649
Change-Id: I526fd4e004bee84c831a4cee71e44e92ee73480b
2017-03-27 10:10:26 -04:00
This, that and the other
44141e3a72 Convert various FormActions to OOUI
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
2017-03-11 16:48:17 +11:00
Aaron Schulz
e01fd44388 Move ResultWrapper subclasses to Rdbms
Change-Id: I6f3f0e85e268b24c57c537aa6ad8016e0b4cdddb
2017-03-03 00:44:41 +00:00
jenkins-bot
bab4f5d64e Merge "Use Database::addQuotes instead of hard coded apostrophs" 2017-02-24 20:56:22 +00:00
jenkins-bot
4cb9c1a24b Merge "Add GENDER to rollback-success message" 2017-02-22 22:01:18 +00:00
Purodha
b121b6c1ba Add GENDER to rollback-success message
Bug: T141250
Change-Id: I99c2b5ad5594b25928ad5bfd3f3a36b19a2c041c
2017-02-22 21:11:29 +00:00
Umherirrender
4d16c2ad56 Use Database::addQuotes instead of hard coded apostrophs
Change-Id: I1404d68d7e2b7fde8f9a76c747bc2be0936f7bef
2017-02-22 18:55:56 +01:00
Aaron Schulz
58ecdd060c Fix assortment of IDEA warnings
Change-Id: I3fb482232483f37bf73ebbeb405056794109e618
2017-02-11 18:12:42 -08:00
Victor Barbu
8935fb4f66 Replace some usages of &$this in hook parameters
Affected classes:
- ApiBase
- ApiPageSet
- HistoryPager
- RawAction

Bug: T153505
Change-Id: I0862476a39a1c3206a84f79c1b8f7db41bc47959
2016-12-28 21:19:23 +00:00
Umherirrender
13c703e93d Change linking Special:PageLanguage on action=info
Change from linking of description to extra link behind the data. Also
reorder the code and language name to match the order on
Special:PageLanguage

Change-Id: I859df5d04c5d937fba55c309034a0350574b5af7
2016-12-16 20:57:06 +01:00
jenkins-bot
9aba586d3b Merge "Fix linking Special:ChangeContentModel from action=info" 2016-12-15 07:46:34 +00:00
Matěj Suchánek
87bfd03d13 Provide context to ChangeTags::buildTagFilterSelector
Bug: T105649
Change-Id: I5f44f4c054010c865ddb51e7d69107bdf2e88c00
2016-12-08 16:24:49 +00:00
rlot
f27203ebfb Removed deprecated class RevisiondeleteAction
RevisiondeleteAction was deprecated in release 1.25

Bug: T61113
Change-Id: I9238d0558b21fccde70e7e23a169e114362f793e
2016-12-04 16:46:49 +00:00
Haikal Izzuddin
2c657ec256 Replace Linker::link() usage with LinkRenderer
Bug: T149346
Change-Id: Ie384566617f18ad6c3bf836b39702365d59f714d
2016-12-01 12:04:38 -08:00
Timo Tijhof
9c5800f574 actions: Fix typo in ViewAction.php doc comment
Change-Id: I26a48db06ea18b1c04a0aadc7cfe86b40af8f4b3
2016-11-22 18:11:01 -08:00
umherirrender
92606ec14b Fix linking Special:ChangeContentModel from action=info
Just link the special page, when it is there, means checking
$wgContentHandlerUseDB

Change Title::quickUserCan to Title::userCan and pass a user object to
avoid a global..
Change some other places to use the local variable, instead of calling
the context source again.

Change-Id: I561899446235165fb77b626b55f35ce716d798c9
2016-11-11 17:46:11 +01:00
jenkins-bot
63ab00b60d Merge "Convert action=markpatrolled fallback interface to HTTP POST" 2016-11-08 17:43:25 +00:00
umherirrender
34fe90ac52 Remove empty lines at end of functions
It looks like there is something missing after the last statement
Also remove some other empty lines at begin of functions, ifs or loops
while at these files

Change-Id: Ib00b5cfd31ca4dcd0c32ce33754d3c80bae70641
2016-11-05 11:55:10 +01:00
Timo Tijhof
4ff510e4a7 Convert action=markpatrolled fallback interface to HTTP POST
The main interface already has javascript enhancement to use
the API and mw.notify. This patch affects permalinks without
tokens, and opening the link without javascript.

This will match the current behaviour of action=watch.

Bug: T130946
Change-Id: I6be2c07824c17b165e068fc4ac36ab192e12bc9d
2016-11-04 23:57:26 +00:00
Kunal Mehta
edde5b63a0 Show user ID on action=info
Change-Id: I43293e319e02dd388c4ee3e952962ad725ab2bab
2016-10-20 15:23:13 -07:00
Aaron Schulz
fdce245e9f objectcache: use a default "since" timestamp in getWithSetCallback()
* Renamed mDoneWrites to be clearer at what type it is.
* Also cleaned up a few callers of this method

Change-Id: I45856b210c289c2e2f193cc4328a208e20b4e0a8
2016-10-14 23:31:09 +00:00
saper
3aed5acec1 action=history should return 404 if there is no such page
Respects $wgSend404Code if configured.

Bug: T146496
Change-Id: I158aae3633db56d432f772ee0aa22c39fd6dc7e5
2016-09-23 20:26:48 +00:00
Aaron Schulz
108ccb0352 Make rebuildFileCache cover ?action=history
Also simplified the logic slightly

Change-Id: I6145d52b6b701735fa4bd8e41e07fb2bf6fdcee3
2016-09-20 00:53:26 -07:00
jenkins-bot
efe855145d Merge "Move Linker::formatTemplates() to separate class, remove global usage" 2016-09-15 16:52:10 +00:00
Aaron Schulz
c84ba4d864 Avoid page_touched update for HTTP GET action=purge requests
This will still clear the local DC parser cache and the CDN cache
in all DCs. Therefore, the next page views served by the local
DC will reflect the refreshed content, as will further GET/HEAD
requests by the client that issued the purge using GET/HEAD.

If the problem was imply a stale CDN cache entry, then all
DCs will be up-to-date. If the problem is stale parser cache,
then a proper POST purge request is required to refresh all DCs.

Bug: T92357
Change-Id: I9af12ca8cfff73298f404fd3e2dd4f546621c546
2016-09-13 05:24:46 +00:00
Kunal Mehta
b16f897a05 Move Linker::formatTemplates() to separate class, remove global usage
Linker::formatTemplates() was a static function that depended upon
global state like $wgLang (explicitly), $wgUser & $wgTitle (implicitly).
Moving it to a separate class allows us to clean it up a little bit and
use modern things like RequestContext and LinkRenderer.

Bug: T145177
Change-Id: Icdea8a2b299b4876feb3df3d66df3e4c104dd928
2016-09-08 22:56:57 -07:00
Kunal Mehta
326a00fa8b InfoAction: Add a link to Special:ChangeContentModel if allowed
If the user is allowed to change the content model of the page,
then add a link to it on ?action=info, next to the localized content
model name.

Change-Id: I084e8f390f90d29ed2e2d0f8ab43bcdfe8538ad1
2016-09-08 17:15:57 -07:00
Timo Tijhof
f188c23ca8 RollbackAction: Allow 'from' to be an empty string
Fix regression from 9af38c046c, which made 'from' a required
non-empty parameter where previously an empty value was allowed.

The rollback links always include a 'from' parameter, but it is
set to an empty string by Revision::getUserText if the current
revision has its username hidden.

Test plan:
* Go to action=history, tick latest revision and "Change visibility".
* Tick "Editor's username" and apply the change.
* Hit "rollback" on the history page.
* Before: "missing parameter" error.
  After: Success.

Bug: T141985
Change-Id: I20d23e2aeec858f82231910c030c14ffa3af656f
2016-09-07 21:09:22 +00:00
Aaron Schulz
950cf6016c Rename DB_SLAVE constant to DB_REPLICA
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.

The old constant is an alias now.

Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
2016-09-05 22:55:53 -07:00
Bartosz Dziewoński
f911bbdb7c RevertAction: Prevent file revert if current version is identical
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
2016-09-02 11:21:55 +00:00
Aaron Schulz
20400cb21f Move HTTP 304 check from performRequest to ViewAction
* Follow-up to 8b141886ed
* The method is now called after the setCdnMaxage() call
  in performAction.
* Allow any CDN urls for the title now, check $wgDebugToolbar,
  and allows caching redirects. The multi-step redirect case does
  not cache however, for simplicity.
* Removed now-unused code in Article that calculated $timestamp.

Change-Id: Ic4f4e3a79d7d386c2f15ca5b11dddf5c57ff9e9f
2016-08-29 14:23:16 -07:00
Chad Horohoe
639a083d84 Rollback: Catch error when unable to load latest revision data
Ideally this never happens, but it can, so fail gracefully instead
of just throwing a 'call to a member function on non-object' message

Change-Id: Iac8be9c7994aa3e74ed3c0eecff211524037165e
2016-08-26 17:21:41 -07:00
Aaron Schulz
a11b0167c4 Use cache TTL constant in InfoAction
Change-Id: If9924863500af612eaaab1c8cd5c655466efdc97
2016-08-12 12:36:37 -07:00
Aaron Schulz
c2ce6a1b60 Require POST for action=purge in PurgeAction
For the index.php end point, POSTs do not need a token.

This avoids cross-DC writes in active/active DC setups and
avoids DB writes that can be caused by just accidentally
following a link.

There are no links to action=purge by default in MediaWiki.
User scripts that create purge links will continue to work.
However these links will now point to a confirmation form.
To preserve the immediate-purge-redirect effect, these
scripts should be updated to use the API instead.

Bug: T135170
Change-Id: I5749ff470d99c5e3f22e05ff6856394cc05a0f48
2016-08-10 18:33:55 -07:00
Glaisher
c08f8566b4 Use different message when (un)watching a page in talk namespace
addedwatchtext and removedwatchtext uses the phrase "$1 and its discussion page".
As this is inaccurate on talk namespace pages, two new messages, addedwatchtext-talk
and removedwatchtext-talk, have been introduced for use in talk namespace pages.

Bug: T87856
Change-Id: Iafd86402d3a2a65ce2be007c87c981ac08f44e67
2016-08-07 13:32:52 +00:00
jenkins-bot
acdb6554d1 Merge "Add missing …|null $context documentation to Action class" 2016-07-07 16:44:09 +00:00
Prateek Saxena
8f9643d8f9 Pass addModuleStyles an array instead of calling it multiple times
Change-Id: Ia359c441714c039c505acd4bd37dd1b52c60b8ea
2016-07-07 10:54:43 +05:30
Thiemo Mättig
16c26f8eb8 Add missing …|null $context documentation to Action class
Change-Id: If365123ffafe8c3eb7566432276131f815a68280
2016-07-05 16:49:17 +02:00
Prateek Saxena
9e458504c7 Move changeslist CSS classes from mediawiki.legacy.shared
Bug: T89981
Change-Id: Ifd90292fc54875403d871429ce6e5020036d4797
2016-06-20 14:49:54 +05:30
Bartosz Dziewoński
fdaecaf25f Split off basic styles from the JavaScript module 'mediawiki.action.history'
Since d629541076 the .updatedmarker element was styled via a JavaScript
module - which caused a flash of unstyled content on the history page
for most users, and was left unstyled for noscript users.

Bug: T137383
Change-Id: I362abacf51160a8305b2b0013f65e89deb2ffc93
2016-06-17 00:02:19 +00:00
Kunal Mehta
f0c02543f5 InfoAction: Don't pass non-dbkeys to LinkBatch
Usernames are stored with spaces instead of underscores, so this was
causing exceptions later on when dbkeys were expected to be provided to
TitleValue.

Let Title take care of normalization from spaces format to underscores
in Title::makeTitle(), and pass that object onto LinkBatch instead.

Bug: T137147
Change-Id: Ia3606d30de61173e4d5526a9d7a77bd4b1710a05
2016-06-06 14:59:23 -07:00
Kunal Mehta
08179800cd RollbackAction: Don't return true, causes '1' to be output
Bug: T136375
Change-Id: Id994b7ee7044ce18cf245a219ba290970511ea0f
2016-05-27 16:12:58 -07:00
Krinkle
5391e328c2 Revert "RollbackAction: Implement AJAX interface and require POST"
This partially reverts commit 9af38c046c.

* The new JS modules continue to exist. While not used by default,
  the mediawiki.api.rollback may be used elsewhere by now.
  The mediawiki.page.rollback module may still be used on cached
  pages and should continue to work.

* The new API behaviour remains.

* To avoid breaking mid-air rollbacks again, the token remains
  the same (plain "rollback" salt). We're not re-introducing the
  web-specific salt again.

Bug: T136375
Change-Id: Iba17ce55ff9506e838bfc6e70ca280e5a20b77b6
2016-05-27 16:16:40 +00:00
jenkins-bot
4bd688c442 Merge "RollbackAction: Implement AJAX interface and require POST" 2016-05-23 21:02:50 +00:00