Commit graph

511 commits

Author SHA1 Message Date
addshore
0b852c5717 Move countVisitingWatchers to WatchedItemStore
Also adds tests

Bug: T129479
Change-Id: I2868c31fc09121de381d822e8f49194e3022bb42
2016-03-14 15:56:43 +00:00
addshore
6e2d6a0b44 Move counting of watchers to WatchedItemStore
Also adds tests

Bug: T129479
Bug: T129482
Change-Id: I5a465773599cce9f8c9e94847cede6d12282c827
2016-03-14 15:56:16 +00:00
jenkins-bot
de966d247c Merge "ChangesList: Add support for context source in ChangesList::flag()" 2016-03-08 20:23:02 +00:00
Timo Tijhof
ce64d57298 ChangesList: Add support for context source in ChangesList::flag()
This way the messages are generated in the correct language instead
of relying on the user language from global context.

This should ideally become a non-static method at some point,
but currently there currently many out-of-class callers.

Change-Id: Ifb1756c1a3bddc717387ed66a58dedd4c1a7dab9
2016-03-08 17:17:20 +00:00
addshore
fee0afdc8a Move WatchedItem logic to WatchedItemStore
This also removes assumptions that when a page
in one Namespace should be watched / removed
that the page in the talk / subject ns for the
page should have the same action applied

This should maintain all backward compatability
for the WatchedItem class

This also includes tests written by:
 - WMDE-leszek
 - Addshore

Bug: T127956
Change-Id: Iad9abafe4417bb479151a3bfbee6e1c78a3afe3c
2016-03-08 15:41:22 +00:00
Luke Faraone
460ea2524c Add toggle checkboxes to action=history
This breaks out the toggle checkbox code into a separate class in
includes/ListToggle.php

Bug: T92230
Change-Id: I8d1aefb83008053e63d59abf8b8915b93e15fcc2
2016-02-21 20:34:42 +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
Cindy Cicalese
86c08b2401 Converted ApiQueryPageProps to use PageProps; added multi-property query to PageProps.
Change-Id: Icd4540001e044052ae5759c87c8b83a70ab5c30f
2016-02-16 13:39:47 -05:00
jenkins-bot
592637225a Merge "Add IContextSource as parameter to ChangeTags::formatSummaryRow" 2016-02-12 22:39:02 +00:00
Ricordisamoa
3fdff2783c InfoAction: Remove array dereferencing workaround
Change-Id: I99d3773a52d4b99367eb3008009da0ffd8a4690a
2016-02-11 15:08:30 +00:00
Alex Monk
d4ca1fd7f2 Move EditPage robot policy out into EditAction
So that it's default even when CustomEditor is used

Bug: T126145
Change-Id: If49d1dc39fb6ad9a2a0fa507ea9a0ccdc1088c59
2016-02-07 01:22:00 +00:00
Aashaka Shah
124026a712 Add IContextSource as parameter to ChangeTags::formatSummaryRow
Using IContextSource avoids the use of $wgLang and wfMessage which make
use of global $wgTtle.

Add IContextSource as parameter to ChangeTags::formatSummaryRow to avoid
globals. Define an IContextSource instance in all functions which
reference ChangeTags::formatSummaryRow and pass it in ChangeTags::formatSummaryRow
function call.

Also make the default value of IContextSource $context as null in
parameter, to avoid breaking changes for old callers in extensions.

Document default null value of IContextSource and add a @note to prefer
IContextSource over null value.

Remove trailing whitespace, and make code order according to parameter
order.

Bug: T105648
Change-Id: Ib54a6a96b73f6cd8fcdf8e520db2448a1e811cfa
2016-02-04 23:32:24 +05:30
Brad Jorsch
2257fe4228 Revert "Remove SessionManager, temporarily"
This reverts commit 823db5d63dd5200d04c63da50ba6bf16f928e70b.

Change-Id: Ibb3e023e4eb6715295586dea87d0725c344a8271
2016-02-03 21:44:59 +00:00
Brad Jorsch
5083e810eb Remove SessionManager, temporarily
The plan here is to take it out of 1.27.0-wmf.12 and put it back in
1.27.0-wmf.13.

Since BotPasswords depends on SessionManager, that's getting temporarily
removed too.

This reverts the following commits:
* 6acd424e0d SessionManager: Notify AuthPlugin before calling hooks
* 4d1ad32d8a Close a loophole in CookieSessionProvider
* fcdd643a46 SessionManager: Don't save non-persisted sessions to backend storage
* 058aec4c76 MessageCache: Don't get a ParserOptions for $wgUser before the end of Setup.php
* b5c0c03bb7 SessionManager: Save user name to metadata even if the user doesn't exist locally
* 13f2f09a19 SECURITY: Fix User::setToken() call on User::newSystemUser
* 305bc75b27 SessionManager: Don't generate user tokens when checking the tokens
* 7c4bd85d21 RequestContext::exportSession() should only export persisted session IDs
* 296ccfd4a9 SessionManager: Save 'persisted' flag in session metadata
* 94ba53f677 Move CSRF token handling into MediaWiki\Session\Session
* 46a565d6b0 Avoid false "added in both Session and $_SESSION" when value is null
* c00d0b5d94 Log backtrace for "User::loadFromSession called before the end of Setup.php"
* 4eeff5b559 Use $wgSecureCookie to decide whether to actually mark secure cookies as 'secure'
* 7491b52f70 Call session_cache_limiter() before starting a session
* 2c34aeea72 SessionManager: Abstract forceHTTPS cookie setting
* 9aa53627a5 Ignore auth cookies with value 'deleted'
* 43f904b51a SessionManager: Kill getPersistedSessionId()
* 50c5256352 SessionManager: Add SessionBackend::setProviderMetadata()
* f640d40315 SessionManager: Notify AuthPlugin when auto-creating accounts
* 70b05d1ac1 Add checks of $wgEnableBotPasswords in more places
* bfed32eb78 Do not raise a PHP warning when session write fails
* 722a7331ad Only check LoggedOut timestamp on the user loaded from session
* 4f5057b84b SessionManager: Change behavior of getSessionById()
* 66e82e614e Fix typo in [[MediaWiki:Botpasswords-editexisting/en]]
* f9fd9516d9 Add "bot passwords"
* d7716f1df0 Add missing argument for wfDebugLog
* a73c5b7395 Add SessionManager

Change-Id: I2389a8133e25ab929e9f27f41fa9a05df8147a50
2016-02-01 22:06:49 +00:00
matejsuchanek
5075cad455 Add help link to the top of history pages
It links to https://meta.wikimedia.org/wiki/Special:MyLanguage/Help:Page_history
but the target can be changed locally by creating
"MediaWiki:History-helppage".

Bug: T124885
Change-Id: Iffd396ea9dfb5216fa65ed9780f3c788fde4a3e5
2016-01-27 16:55:18 +00:00
Aaron Schulz
70f6c094e8 Define doesWrites() for SpecialPageAction
Bug: T123589
Change-Id: Iede48dea7e3f83f0eb6f21f5cc20b92ff54972a9
2016-01-15 12:34:56 -08:00
Cindy Cicalese
e48030a7ae Add page_props table access class
Bug:T115331
Change-Id: I022b9e3ca47dc63650b8a62260603b0893a80e69
2016-01-15 03:51:57 +00:00
Aaron Schulz
543b063773 Distinguish read vs write mode Action classes
Bug: T123589
Change-Id: I3c8fab646d3bb8cd468e5b60c27f3c5d43f9f97c
2016-01-15 01:13:38 +00:00
Fomafix
023106dd67 MarkpatrolledAction: Remove double space
Change-Id: I9d303a3cc5b7af1e1a7d61948aae64eb227b07af
2016-01-14 19:23:02 +00:00
cenarium
fe2a1b0d61 Better guess for patrol action
The "return to" guess of the patrol action for non-JS users now also
checks uploads, and in that case let users return to Special:NewFiles.

Change-Id: Ib8e472c16b7034524ef3b79a5eb426f7edda6ec2
2016-01-13 17:43:02 +01:00
Brad Jorsch
a73c5b7395 Add SessionManager
SessionManager is a general-purpose session management framework, rather
than the cookie-based sessions that PHP wants to provide us.

While fallback is provided for using $_SESSION and other PHP session
management functions, they should be avoided in favor of using
SessionManager directly.

For proof-of-concept extensions, see OAuth change Ib40b221 and
CentralAuth change I27ccabdb.

Bug: T111296
Change-Id: Ic1ffea74f3ccc8f93c8a23b795ecab6f06abca72
2016-01-12 21:57:01 +00:00
jenkins-bot
8b2139e1a7 Merge "Remove gen from RawAction." 2015-12-20 23:37:39 +00:00
cenarium
68692ebb69 Add user and previous rev to HistoryRevisionTools, and user to DiffRevisionTools
The next revision in the page history isn't necessarily the previous
revision (due to selective undeletions, history merges, etc). This
passes the next revision to HistoryRevisionTools so extensions can check
if needed. Also, it passes the user to this hook and DiffRevisionTools
to avoid use of wgUser or having to retrieve context.

Change-Id: Ibc68f19040eebe3614e07f753f26bbfd376ae28d
2015-12-14 00:35:59 +00:00
Reedy
697c423259 Remove gen from RawAction.
Deprecated in 1.17

Change-Id: I4e8e77c11d178725e1d969f869aef1dbf48af490
2015-12-13 22:52:36 +00:00
Albert221
ed69044f80 Localization: Gave each special page its own message
Bug: T45502
Change-Id: I847c8b294d7e4596b229ad6180764c43c42af1e2
2015-12-13 16:16:25 +01:00
Aaron Schulz
4302b0419d Rename getSquidURLs() => getCdnUrls()
Change-Id: I433acc7990a5fcefd0d2ff5b14ba33dec0424706
2015-12-11 16:40:35 -08:00
Aaron Schulz
6af3c39c07 Replace "squid" with "CDN" in various comments
Change-Id: Idcc528daf28e119349155d36e30a9bcf61b2e7d5
2015-12-09 17:35:37 -08:00
Aaron Schulz
91c7084b63 Update getWithSetCallback() callers to the newer signature
Change-Id: I1cda46178c16b7ffad97d09f8480fd57f766be57
2015-10-07 19:27:08 -07:00
Aaron Schulz
54758dd160 Change getCacheSetOptions() callers to use "Database"
* This is less verbose that DatabaseBase
* Also add a few WAN cache doc comments

Change-Id: I5b6de6d0ffa06753ea96c50b63db7dae796475dc
2015-10-05 22:06:46 -07:00
Aaron Schulz
4af8d99a91 Break numerous long lines in InfoAction
Change-Id: Ia873dce8aeab3c7ce93610a70fe78034addd39d7
2015-10-06 00:20:12 +00:00
Aaron Schulz
db0b9ef264 Make WANObjectCache sets account for slave lag
* This gets lag information that is useful when
  the calling code is about to run queries that
  will have their results cached.
* This is now used in place of trxTimestamp() for
  WANObjectCache set() and getWithSetCallback().
* The WAN cache will use a low TTL if the lag is
  too high to avoid caching stale data for weeks.
* Bumped MAX_COMMIT_DELAY as nothing enforces it.

Bug: T113204
Change-Id: I2a95b4088cff42d6e980351555f81a4b13519e24
2015-10-05 16:45:13 -07:00
Aaron Schulz
8706ed639e Converted InfoAction::pageInfo() to using getWithSetCallback()
Change-Id: I5b780d6e21d9fc7f38d365db1389153b07c6c461
2015-10-03 00:53:44 +00:00
Reedy
7fe05a9fb6 Add page purge limiter
Change-Id: I737dc77ce803432b0792f7e49323a29661bc056f
2015-10-02 20:27:44 +00:00
Timo Tijhof
27a8bad9b0 WatchAction: Clean up redundant getFormFields() and show()
* Make FormAction::getFormFields not abstract. In most cases this will just
  be an empty array. This is in prep for RollbackAction as well.

* Remove redundant show() in WatchAction. This used to do custom stuff,
  but after 77cdf1919 it does exactly the same as the parent FormAction::show.

* Don't add 'redirectparams' hidden field if there were no custom query parameters
  (e.g. plain index.php?title=..&action=..)

Change-Id: Ia7f9bb0367c49a23179e9fefa9f529fa8aef8f52
2015-09-28 18:46:45 -07:00
Timo Tijhof
77cdf1919a WatchAction: Require POST for index.php action=watch
The GET variant was already rarely used because our frontend enchances these links
with a click handler that uses AJAX to make a POST request to the API.
The index.php url, nor its token, were used for the majority of users.

Simplify this by stripping the 'token' query from these urls and requiring a POST
request for index.php?action=watch and unwatch.

* FormAction: Actually set a proper '<form action>' instead of letting HTMLForm
  default to a confusing title path (e.g. /wiki/Pagename). Article path should
  not be used for POST requests.

* WatchAction: Group all FormAction-related methods together.

* WatchAction: Make token consistent with other actions now that it is POST-only
  (no "stronger" salt containing the page title).

* Remove ununsed mediawiki.page.startup dependency from mediawiki.page.watch.ajax.

* WatchAction: If accessed over GET directly (e.g. for users without javascript)
  display a confirmation form that submits the token. Similar to PurgeAction.

Change-Id: I504f457e68a133bcfc418cff13b838080fec1008
2015-09-28 15:21:12 -07:00
Aaron Schulz
f18bf7963e Put InfoAction distinct user counts behind miser mode
* The random I/O due to secondary lookups causes timeouts on
  larges pages that keep showing up in the logs.

Change-Id: I9bddcd3ba9ad5ff2f26ccec4553906ecc4a8129b
2015-09-28 17:24:28 +00:00
Vivek Ghaisas
c54766586a Fix issues identified by SpaceBeforeSingleLineComment sniff
Change-Id: I048ccb1fa260e4b7152ca5f09b053defdd72d8f9
2015-09-26 23:06:52 +00:00
Ricordisamoa
4f72efe8d8 Remove excess newlines at the end of files
Many of them added with commit 776c865077

Change-Id: I481b15c45ead1f5f482e120cb40ea8f3297543cf
2015-09-27 00:02:05 +02:00
jeroendedauw
f7a6a0c8f5 RollbackAction: Remove dead argument
Change-Id: Icd1584460e68422e50d4391bfbdf0d938ab1c1cf
2015-09-24 17:16:24 +00:00
gladoscc
90e1b22166 Add MWTimestamp::getTimezoneString(), use it in file revert message
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
2015-09-23 13:38:16 -07:00
Aaron Schulz
9bba2d169e Added wfTransactionalTimeLimit() method and applied it
* 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
2015-08-12 22:09:40 +00:00
firebus
b6cc58b953 Match salt of WatchAction::show() and getWatchToken()
Use getPrefixedDbkey() when generating salt, for consistency.

Bug: T106910
Change-Id: I93e22a2aaee8bf888fa613929c1027f5f0c2642f
2015-08-08 16:43:52 +00:00
Kunal Mehta
70bf8fd729 Avoid revision lookup post-save in InfoAction::invalidateCache()
We just saved the page, so we know the revision id. Pass it on to
InfoAction::invalidateCache() so it doesn't have to be looked up again.

Follows-up 0452855044.

Change-Id: I990c0da09fae94f403f3550069036d3f208090a6
2015-07-29 00:42:56 -07:00
Alex Monk
a2e0bf2186 InfoAction: Use watchlist query group for watchlist queries
Bug: T105852
Change-Id: I8fd38caf04e60f34f76077cd66e447f09fa2f487
2015-07-16 15:42:53 -05:00
Timo Tijhof
2b2ce752d9 RawAction: Clean up max-age/s-maxage computation
No behavioural change, but makes the code easier to understand.
It was somewhat all scattered.

* Remove outdated comment about 24 hours.
  - ForcedRawSMaxage defaults to 5 minutes.
  - SquidMaxage defaults to 5 hours (wmf-config: 31 days).

Change-Id: I7f3b67780ba9e8c024dcbd68772495b91abb2d01
2015-07-03 02:27:05 +01:00
Federico Leva
6832094f6c Account for unset visiting watchers
Followup to 09a21c4af8
Now with `|| $user->isAllowed( 'unwatchedpages' )` we can enter
line 337 without having any count to show.

Change-Id: I6826e1c59899d2c8cbbc6d079874d0d583f8783a
2015-07-01 15:18:22 +02:00
Federico Leva
09a21c4af8 Attempt to count actual watchers in the info action
Proposed threshold to be considered an "active" watcher:
two times $wgRCMaxAge, configurable with the new
configuration setting $wgWatchersMaxAge.

The information is not displayed when the number given would
be 1 or 0, so that the number (or absence thereof) doesn't
"disclose" that the page is (potentially) unpatrolled or
completely unwatched and hence easier to vandalise.
Configurable with $wgUnwatchedPageSecret too.
Also, we don't display this row at all when the user doesn't
have the right to see the count of total watchers.

Bug: T51506
Change-Id: I10d294a339b131eee94839ed7088ab20d746d881
2015-07-01 12:39:27 +02:00
Fomafix
bb3df25a37 Show {{DEFAULTSORT:0}} on info page
The info page of a page with {{DEFAULTSORT:0}} shows the page title
as default sort value.

Using empty() will consider the string '0' to be false, so use isset() instead.

Bug: T103745
Change-Id: I56ea5a38dcd33e822e0fc5b8685777fe1d212b22
2015-06-26 15:24:40 +00:00
Jackmcbarn
c4f69827bc Fix some PHPCS issues
Change-Id: I6289ce362f8dfde7baf2b665f082820898844973
2015-06-26 01:32:28 -04:00
umherirrender
70f3afd548 Remove unneeded empty lines at begin of if/else/foreach body
An if body must not begin with an empty line

Change-Id: I62b058be337fcc85a120fcd3dadce564db59a271
2015-06-19 20:05:45 +02:00
cenarium
f827d5a261 Avoid muliple cache calls to explicitly defined tags
This avoids muliple cache calls to explicitly defined tags by
calling the showTagEditUI of ChangeTags only once in logs and
histories.

Change-Id: I2e36dbd96d3fcca06de0bf418bc6dc294d8d18d3
2015-06-14 20:02:30 +02:00
Timo Tijhof
f57b6af45b WebResponse: Implement statusHeader() using the new HttpStatus::header()
* Convert existing use of WebResponse::header() for HTTP status headers
  to use this new statusHeader() method.

* Extend unit test forFauxResponse.

I'm not calling HttpStatus::header directly in code. We keep the abstraction
layer of WebResponse so that responses can continue to be mocked/fauxed without
affecting the outer HTTP response.

Change-Id: I8a536e16659fa88b54cffa1457efb889efa5fcd6
2015-06-04 02:27:30 +00:00
Federico Leva
b66622f343 Use getActionName() static
Change-Id: I3225ecd2b8e4294c28ea0aa664f0246d0d028b11
2015-05-18 20:27:48 +00:00
Nemo bis
1e81e7f8a0 Declare global in Action
Follows up e928d5bdd0.

Change-Id: I06e8490865554a0efa7678be6787deb8a22c5b82
2015-05-16 19:51:32 +00:00
jenkins-bot
a96465f40a Merge "Allow to customise addHelpLink() target via system message" 2015-05-15 10:42:51 +00:00
Federico Leva
e928d5bdd0 Allow to customise addHelpLink() target via system message
Method similar to SpecialPage::outputHeader() to avoid registering
tons of system messages and to have -summary and -helppage tidily
listed together in Special:AllMessages by default.

Bug: T45591
Change-Id: Ic849dde00be7379c1909a8486cf20f48c5aea5cf
2015-05-15 10:14:28 +02:00
jenkins-bot
86e80813d6 Merge "Converted InfoAction to using the WAN cache" 2015-05-05 11:41:42 +00:00
Brad Jorsch
a2415baa1a ChangeTags: Don't show UI when no editable tags exist
Bug: T97773
Change-Id: I001f15ca6f58bc9318eed84aa8ace2bddcb1b315
2015-05-01 11:12:31 -04:00
Aaron Schulz
19878798ef Converted InfoAction to using the WAN cache
Bug: T93141
Change-Id: I8988f77fa5a3504793d9b8e0eea6863888c9e226
2015-04-30 01:29:56 +00:00
jenkins-bot
dcfaa4e995 Merge "Show correct counts in category-info on action=info" 2015-04-17 01:24:05 +00:00
umherirrender
831d07a3a5 Show correct counts in category-info on action=info
The number of pages was always the total count of all members of that
category, not just pages. Correct that and also show the total count.

Change-Id: I246d92b35d508e10fd93f9c7209db11a6e0eeb7a
2015-04-16 20:26:27 +02:00
daniel
a7f26eb3b7 Introduce PageHistoryPager::doBatchLookups hook.
The intention of the new hook is to allow extensions to prefetch
any information that may be needed for displaying history rows.

In particular, this is needed by Wikibase to allow us to inject
localized entity labels into the edit summaries.

Bug: T95672
Change-Id: Ie10ef99154da35713a4f583e2de2162fba28eef2
2015-04-16 16:02:13 +00:00
Brad Jorsch
75cc98c324 ChangeTags was backported to 1.25
So change the relevant references to 1.26.

Change-Id: I351de6a77747e3152052a448b8b6d2f25699e1d0
2015-04-15 17:31:16 -04:00
This, that and the other
5c4681012e UI for adding and removing change tags on revisions and log entries
There is a new special page, Special:EditTags, which is very similar to
Special:RevisionDelete in a lot of ways. In fact, the SpecialEditTags class
started off as a copy-paste of SpecialRevisiondelete.

You invoke this special page by going to an article history page, checking
some revisions, and clicking "Edit tags of selected revisions". Then you
pick the modifications you want to make and click "Apply". Very much like
the revision deletion workflow.

I had to restructure some of the Action routing code, which was only
designed to handle revision deletion. Also removing some code from
SpecialRevisiondelete which didn't work as advertised in the first place,
and definitely doesn't work now.

Change-Id: I7d3ef927b5686f6211bc5817776286ead19d916b
2015-04-15 18:31:12 +00:00
Aaron Schulz
14979be39d Moved $wgShowUpdatedMarker checks to the right place
Change-Id: Icee2ec24aac5fe78f7204aabf434640251791cae
2015-04-14 18:56:39 -07:00
ayush_garg
0e4c158b79 Displaying protection expiry date and time in action=info
Bug: T94129
Change-Id: I2df726e04c0555eb550036c31e538ec2594b517c
2015-04-04 01:26:02 +05:30
Aaron Schulz
e2db8e69ee Made InfoAction::invalidateCache() use READ_LATEST
Change-Id: I794c443b9d65d924366eff9baaf4460ce196a967
2015-03-31 23:49:10 +00:00
jenkins-bot
5907e840cc Merge "Add top help link to MediaWiki.org in several pages via indicator" 2015-03-04 16:15:53 +00:00
Nemo bis
376c0a13df Add top help link to MediaWiki.org in several pages via indicator
All the chosen targets are translatable public domain help pages
on MediaWiki.org. Mostly special pages and actions for privileged
users for now.

Adapted from the Translate extension, credit to Niklas Laxström
(TranslateUtils::addSpecialHelpLink).

Depends on 6f5b29ff4e, whose commit
message has a typo addIndicator() instead of setIndicator().

Bug: T45591
Change-Id: I2934b1708a0d207dcf3d940264f140613646f203
2015-03-04 10:59:03 +01:00
umherirrender
a30c4f4980 Escape messages 'word-separator' and 'parentheses' in InfoAction
This change will not break the usage of the messages, because there are
usually used escaped in mediawiki/core.

Change-Id: I049134e2fbfadab04ac228090d17fd18c5baca3d
2015-02-26 20:11:15 +00:00
jenkins-bot
ff05579d1c Merge "Fix type hint in HistoryAction::getArticle" 2015-02-06 21:58:02 +00:00
Thiemo Mättig
986f3df85b Fix type hint in HistoryAction::getArticle
See the type hint of the accessed Action::$page variable.

Change-Id: I10e4e27773bcca507c10cf526d193bf0a1cc97ac
2015-02-06 16:54:25 +01:00
Niklas Laxström
acc2bcaf37 Escape unescaped messages shown in action=info
Change-Id: Id16d8c8dff73fdacad6c9a4ff7f2919945b7e893
2015-01-30 16:56:11 +00:00
umherirrender
6a84f22b05 Pass user to Title::userCan in InfoAction
Change-Id: Id4dac8ca3b36839abdb184d0ad538b2400aa80ff
2015-01-28 19:16:44 +01:00
Ricordisamoa
2ae155da52 Fix phpcs errors in includes/
Mostly Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines

Change-Id: I678b2f0902f11cd1dfa1611b9da24e7237df9122
2015-01-08 20:15:07 +01:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
jenkins-bot
13d083b206 Merge "Hide file links in action=info's 'Number of redirects to this page'" 2014-12-20 01:27:18 +00:00
Ricordisamoa
6f6c7c14c4 Hide file links in action=info's 'Number of redirects to this page'
Special:WhatLinksHere gets now passed hideimages=1
if the concerned page is in the File namespace.

A bit of history:
the 'hideimages' parameter has been added to Special:WhatLinksHere
with commit 06ad0d25 (r34267), then removed with commit cdc7e22d
(r34277), and finally added back with 725cb284 (r34320).

Change-Id: I0f358e52c38bb525cee8085ca206118ee276889d
2014-12-20 01:18:18 +00:00
Ricordisamoa
fc5fd5c37a Typo fixes and non-code tweaks
Skipped replacements:
* prefered → preferred
* prolly → probably

Skipped files:
* resources/lib/jquery.ui/jquery.ui.mouse.js
* resources/lib/jquery/jquery.form.js

Change-Id: Ib7923f362ddfca1b892bf5d601785d6b5aa5d44c
2014-12-12 18:31:15 +00:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
umherirrender
7da1cbc78c Fix backlink for RevertAction
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
2014-12-05 14:28:18 +00:00
umherirrender
8410b26b37 Avoid implicit Message::toString in InfoAction
Call explicit escape to show which message format is used.

Change-Id: I725f7ab394c275ad68a0b816b841c9b6b8bc325c
2014-10-23 16:32:33 +00:00
Chad Horohoe
90d90dad6e Remove hitcounters and associated code
The hitcounter implementation in MediaWiki is flawed
and needs removal. For proper metrics, it is suggested to use
something like Piwik or Google Analytics.

RFC: https://www.mediawiki.org/wiki/Requests_for_comment/Removing_hit_counters_from_MediaWiki_core
Change-Id: I0e5006a7e8a09c800f8fa4effa9399e8afdd7a57
2014-10-20 13:01:55 -07:00
umherirrender
2682eb00aa Undefined variable: attrs in HistoryAction.php on line 202
Replaced by an array() and removed an unused variable near by.

Follow-Up: I61bb3c358f755ed9f2153d94b744c1a9da02c456
Change-Id: I5c4dc22e1e9346bfc410a9dda4353d5297a5825e
2014-10-05 19:08:15 +02:00
jdlrobson
a155ac55ea Hygiene: Make construction of buttons easier
Stop littering MediaWiki with globals, provide a common
api for generating them similar to how we do text input
attributes before things get out of control.

Adds
* submitButton
* linkButton

Change-Id: I61bb3c358f755ed9f2153d94b744c1a9da02c456
2014-09-30 14:54:56 -07:00
Prateek Saxena
a54893704e HistoryAction: Use correct classes for buttons
Bug: 71141
Change-Id: I95ac411e7c06d3b7aec966527f196ef347f1c710
2014-09-29 13:45:09 -07:00
Max Semenik
0fddd42ca4 Deprecate HTMLFileCache::newFromTitle() in favor of constructor
Change-Id: I903e68fc1f486501d790ca69146ecb835d90c9cc
2014-09-19 00:07:51 +00:00
umherirrender
cb33db78be Use local var in Action::setHeaders
Change-Id: I543d45835016fd6f4f2ec0e84f4e5453237bbf25
2014-09-13 07:21:32 +00:00
Chad Horohoe
f7ada91b09 RawAction: private variable removing m prefix + doc better
Change-Id: I526ebcbb1429af42fa9e33cdf59d12c4854247f7
2014-09-12 11:39:36 -07:00
addshore
0a6b7e0f56 Add @since tags for initial Action.php methods
These were introduced in r86001
Hash: 8779f4b55f

Change-Id: I1ae1d4f220d20961f77d2c913fd4f17233893c45
2014-08-29 14:53:54 +01:00
umherirrender
4922c1b57f Use getConfig in HistoryAction for global
Change-Id: I4a3bb4149c3c1da75215e0e6336c89e4a00fc8e4
2014-08-22 21:52:27 +02:00
Alexandre Emsenhuber
2263cb185b Use getConfig on local context to get configuration settings in Action
Follow-up I47db5eab45 (aa15d528)

Change-Id: I76409f5fc61e5d35235f964e094dd8881bcc8311
2014-08-19 03:42:49 +00:00
jenkins-bot
a8b5e408bf Merge "Fix the (un)watch token to include the namespace name." 2014-08-16 13:20:31 +00:00
jdlrobson
aa15d5287d Add blanket support for mediawiki ui via globals
This provides better mobile experiences on various pages
and a more consistent UI across both mobile and desktop.

It does this in two ways.

1) Forces HTMLForms to not use table based layouts so as
not to interfere with responsive nature of mediawiki ui elements

2) Applies MediaWiki.UI classes to most pages
If a page is created via Xml or Html classes it will use mediawiki ui
Where possible I've added classes unconditionally, but for cases of buttons
this is behind the $wgUseMediaWikiUIEverywhere global since button styling is
enabled on pages by default and for checkboxes since it is changes HTML markup.

3) Adds all MediaWiki.UI styles to pages which can use it
When enabled:
* Apply these styles to all pages which use HTMLForms
* Apply to EditPage
* Apply to anything that uses certain elements outputted by the
Xml or HTML helper classes
* Apply to History page
* Apply to protection page
* Apply to move page
* Apply to deletion page

Currently kept behind a global to allow us time to finetune
existing elements. After further testing we will look to kill the
globals and make mediawiki.ui the default

See: I430c0fbb79d2a33bb828b2427bda0ee01115d73f
Change-Id: I47db5eab4569514d039261d11b6dedb0eeae17b5
2014-08-15 14:48:00 -07:00
umherirrender
3b2b6a2773 Add missing @param to function docs
Change-Id: I47fa96a976f55a1a93cb75397285edb8c7f4cd8a
2014-08-14 20:22:52 +02:00
Kunal Mehta
f6b5b8c899 includes/actions/: Use Config instead of globals
Changed InfoAction::pageCounts to be non-static, so
it's able to access $this to get the Config object.

Also replaced instances of $wgScript with wfScript().

Change-Id: I4a6a3224e762f13640af04a73e2934b887dffedd
2014-08-13 20:34:32 +00:00
jenkins-bot
f0845d71a2 Merge "Remove return from Action::checkCanExecute" 2014-08-13 01:31:07 +00:00
addshore
6b40bbe016 Fix phpcs issues in actions and revisiondelete dirs
Change-Id: I54c1e336b8c44ff8720ac38c8b2d68ede42af305
2014-08-12 22:53:14 +00:00
withoutaname
e53c6dbd8d actions: Move SubmitAction class out of EditAction.php
Straight move, except for the slight change in the comparison operator
for session_id().

Change-Id: I9404f48ee75ff3d3655f2f5b75a05d66f334b80d
2014-08-12 22:26:54 +00:00
umherirrender
226760304e Remove return from Action::checkCanExecute
No need to return true on success, because failure gives Exception,
so the return value needs no checking.

Change-Id: Id59bfaebc14bd1c638a721c303f585c1de627508
2014-08-12 18:17:27 +02:00
Tyler Romeo
d0439af89f Make UserNotLoggedIn redirect to login page
For pages like Special:Watchlist that throw
a UserNotLoggedIn exception when the user is
anonymous, this patch makes the page redirect
to the login page automatically.

This is instead
of the current behavior of showing a link to
the login page that the user must click.

(Also, Special:Userlogin has existing functionality
that will redirect the user back once they are
logged in.)

Bug: 15484
Change-Id: Idd9325374cb5dc13c4c057f45f88a33bdff523a9
2014-08-07 13:38:16 -04:00
addshore
3263900481 Split UnwatchAction into own class
Change-Id: Ief650c115237214345bef7733d33967f0e042521
2014-08-07 01:40:35 +01:00
addshore
f902738503 Split UnprotectAction into own file
Change-Id: Ibde9dca89631522a25e2f0eef2790c2654a2bbd9
2014-08-07 01:33:12 +01:00
withoutaname
b8654eb75a Documentation: put FormAction and FormlessAction into "Actions" group
Change-Id: Iac8a203426897446b8c9f3fbaaa9d608c419bce6
2014-08-02 08:11:26 +00:00
jenkins-bot
4169b4f425 Merge "Shorten ternary expressions in RawAction.php" 2014-07-31 17:44:29 +00:00
Étienne Beaulé
b230bdce16 Create preference to watchlist pages after rollbacking
This change adds a  preference in the 'watchlist' section to
automatically watchlist a page after rollbacking.

The setting is only visible, if the user has the 'rollback'-right.
I have removed the watch reverts function per advice by Vogone.

Bug: 4488
Change-Id: I3aa831c9c04d627684641af0ca5a332795c87062
2014-07-30 21:51:41 +00:00
umherirrender
02dc9da399 Cleanup some docs (includes/[a-d])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I7b65fe04db431342cc58b469dc48f41a50c4e891
2014-07-24 19:42:45 +02:00
jenkins-bot
e219e90fda Merge "Fix documentation of HistoryPager::lastLink() and make code more readable" 2014-07-23 20:38:32 +00:00
withoutaname
db635855f2 Shorten ternary expressions in RawAction.php
Change-Id: Idc9e74344989bf1394e05ebaf23cfd9a8fb38e1a
2014-07-23 12:02:37 -07:00
umherirrender
cabbc6eaa4 Docs: {function} -> callable
Change-Id: Iab0760ce5c518854a127330d3e0c0ee7ed0c526c
2014-07-21 21:38:56 +02:00
withoutaname
3702d19788 Remove deprecated RawPage class
Change-Id: I7a75a09de934250604317983a4446ecaa9fa6550
2014-07-20 22:58:44 -07:00
withoutaname
071353c89a Remove deprecated HistoryPage class
Change-Id: I3db4d5a1a2c574a73e2fcfe1fd1da49f3570e4b6
2014-07-21 04:54:40 +00:00
withoutaname
a4aaac4f80 Remove execute() from Action and subclasses
Since show() is always the preferred entry point, this is never used
nor implemented properly.

Change-Id: I5fde4bbd420a6695b01fb9220542fd3b49060675
2014-07-16 14:03:43 -07:00
withoutaname
033ce4471d Remove getFormFields(), onSubmit() and onSuccess() from FormlessAction
Leftovers from the FormAction class which has since split off

Change-Id: I519566205bd39f4c511b0418a0564e9ef1eec6d0
2014-07-15 23:28:18 +00:00
withoutaname
0367d94952 Fold RevertFileAction class into RevertAction
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
2014-07-13 02:16:58 +00:00
Alexandre Emsenhuber
3de2f5a64d Allow to set a salt for the edit token in HTMLForm
And set one in RevertAction.

Change-Id: I9f72c6203e8d9d0770009083263ddca98845f530
2014-07-08 22:45:14 +02:00
Alexandre Emsenhuber
11471501ec Fix the (un)watch token to include the namespace name.
Title::getDBkey() only returns the page name without the namespace
which means that "Test" and "User:Test" (for example) pages would
have the same token; use Title::getPrefixedDBkey() instead to
avoid this.

Change-Id: I80333b23cec0cfe6546f6e7776b0a77b56ee20c8
2014-07-08 22:00:43 +02:00
Alexandre Emsenhuber
28c16e384b Fix documentation of HistoryPager::lastLink() and make code more readable
- Describe the possible types of $next parameter in the documentation
  rather than inline along with the possible values
- Split the big if ... elseif block into separate blocks. The elseif
  are not needed since each path returns
- Only create the revision object when really necessary

Change-Id: Ic92a6f6bd405d3f820d562a7322d34e3d9d33d17
2014-07-01 19:10:07 +02:00
Kartik Mistry
3e50955269 Fixed typo
unkown -> unknown

Change-Id: Ibbe73853258fd476d4e6f1b28dce27a20233f58f
2014-07-01 17:00:04 +00:00
umherirrender
87609efbe5 Remove comment about externaledit from EditAction
The ExternalEdit class was removed in
Ic3791d188688f556753ab5556a4d9733bbf2e85e

Change-Id: I3cec96c0fe2a597ba5360c08d6bde55397fc9204
2014-06-29 14:22:55 +00:00
Kunal Grover
50144cd02a First version of Page Language selector
Special page PageLanguage to set the page language of a page.
To enable the feature, set $wgPageLanguageUseDB to true
and assign the 'pagelang' user right to a user group.

Bug: 35489
Change-Id: I0f82b146fbe948f917c1c5d29f7469644d797e80
2014-06-27 23:27:07 +00:00
withoutaname
e45e0b1a66 Removed getLang() from IContextSource and subclasses
Change-Id: I94c3df814c06c54c071f371101882dcc71c99417
2014-06-20 11:36:59 -07:00
JuneHyeon Bae
4ea2e06d45 Add 'X-Robots-Tag: noindex' header in action=render pages
Bug: 63891
Change-Id: I297a6269fcab999610bc01755462938c70eb64a1
2014-06-02 16:04:51 -04:00
csteipp
0b695ae09a SECURITY: escape sortKey in pageInfo
DEFAULTSORT isn't escaped before being added to the action=info table.

Bug: 63251
Change-Id: I087bfde8cbc69c3507f68ee3cb6e22aba0ffa7db
2014-04-24 21:52:22 +02:00
Bartosz Dziewoński
59002d8935 Consistently use '@deprecated since <version>'
Variants included 'in <version>', 'as of <version>' and just the
version number.

Some @deprecated annotations do not have the version number at all,
I want to hunt them down separately.

Change-Id: I8208c6097098f4735d4f51bc42254675f1f27f6d
2014-04-15 22:18:19 +02:00
umherirrender
829886b10a Fixed some @params documentation
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: I64e8cfe478cb0ba438f40b0631d6e9049cdab567
2014-04-14 12:59:19 +00:00
jenkins-bot
9fc959d109 Merge "WatchAction: Add 'returnto' and 'returntoquery' to the login link" 2014-04-06 01:12:18 +00:00
konarak
5053348474 WatchAction: Add 'returnto' and 'returntoquery' to the login link
Bug: 60594
Change-Id: Ic8c0ea5b203c63f9273992cb70bfb06c0d461311
2014-04-06 01:07:46 +00:00
umherirrender
23fab68274 Fix spacing after @param and friends in comments
Searched for:
\@(param|return|throws|since|deprecated|access|todo|var)[ \t]{2,}

Change-Id: Icce22ba9fe0635455691ca58d9872d618151f346
2014-04-05 20:02:29 +00:00
Alexandre Emsenhuber
449ee32451 Add missing line breaks to wfDebug() calls
Also removed true as second parameter to it from CloneDatabase.php
since it is the default value of that parameter.

Change-Id: I727ebae2bd4df0e26019985ce8c7ce73381c5642
2014-03-29 11:52:07 +01:00
addshore
58884580eb Split the rest of Action.php into /actions/
Change-Id: I071ac5778af63a5cffffd59d804c99b2c799d4e5
2014-03-03 12:31:57 +00:00
umherirrender
d7acfe079f Show 'Indexing by robots' status correct on action=info
When $wgNamespaceRobotPolicies contains a noindex for a namespace and
the page contains __INDEX__, the index status on action=info was
"Disallowed", but that is wrong, because the page is indexed.

Pass the 'index' to the robot policy logic.

Change-Id: Ib77c3e73968cdc72f657e50371a2372564a1c618
2014-02-14 19:43:55 +00:00
Siebrand Mazeland
f077c4b1d6 Update formatting
Change-Id: I18aff576262479c9bb1c56eb8e1d1aaae200e4b1
2014-02-06 09:27:05 +01:00
Aaron Schulz
34a9db1d67 Put expensive info action count behind $wgMiserMode
Change-Id: Ie0507b9ed62556f8caaaaf9499a4a40b3342b5af
2014-01-27 11:38:21 -08:00
Aaron Schulz
ba8c6db5ea Avoid expensive backlink counts for info action in miser mode
Change-Id: I13b64db1b23afd995cd0a2f5872fcedadd86c8ea
2014-01-16 12:39:33 -08:00
Brian Wolff
6e2be46e82 Send cache purges for action=raw after editing user css/js
These types of requests can be cached for a short time (~5 min) in
Squid/Varnish.

Change importScript to be consistent with importStylesheet in the query
parameter order (title, action, ctype).

We only send purges for the exact urls as used by importScript and
importStylesheet.

Note: ResourceLoader things have their cache handled separately and
aren't affected by this change.

Users like instant updating of scripts after having changed them.

Bug: 56874
Change-Id: Idaa8552cf371dbafeb8b730f35b3b5c4fc339fb0
2014-01-03 18:43:23 +00:00
Siebrand Mazeland
8a096e3444 Random documentation tweaks
Change-Id: I57c3bde6551c14324cf34e4db003a319d6cebc47
2014-01-02 23:45:14 +01:00
Reedy
d0554cd521 Revert "Update type hint for CreditsAction::getAuthor()"
This reverts commit 8a9a1eff3e.

Change-Id: I689645c812b1a28821a3d6854bc7737fc677e29e
2013-12-30 18:11:20 +00:00
Siebrand Mazeland
8a9a1eff3e Update type hint for CreditsAction::getAuthor()
This function calls $page->getUserText() and $page->getTimestamp(). These
functions are not specified in the interface Page (which actually specifies
nothing at all). Page is only implemented by WikiPage and Article. Article
does not implement getUserText() and getTimestamp(). WikiPage does.
CreditsAction::getAuthor() cannot ever be given an Article, because that
would cause a fatal error "call to undefined method".

Change-Id: I0ba29622b7307845345ce645cb63b53614aaf2ab
2013-12-30 18:03:09 +00:00
Kunal Mehta
bc798535fd Deprecate SpecialPage::getTitle
Callers should use SpecialPage::getPageTitle, which is
exactly identical.

This is so that in the future we can turn SpecialPage
into a ContextSource, which requires getTitle to return
getContext()->getTitle.

Change-Id: Icdcf5d5295ef5e7f08b1d403e0c123f78738fd40
2013-12-24 12:53:11 -08:00
Siebrand Mazeland
96ce563c1f Fix comment
Change-Id: Icb52c2d236827d78eb420be9a1bcee9664d3bc4e
2013-12-03 13:40:03 +00:00
Alex Monk
f809241c46 Set title to Special:Revisiondelete on action=revisiondelete
Bug: 48616
Change-Id: Idb85c797dbe349e956d21b5cde6a59d89dab4fd2
2013-11-16 21:24:41 +00:00
jenkins-bot
8f806d211f Merge "Exclude override to make method public from checks" 2013-11-15 17:59:15 +00:00
jenkins-bot
9c345a4326 Merge "Update docs for files in includes/actions/" 2013-11-15 17:57:21 +00:00
csteipp
636c64482d SECURITY: Don't cache when a call could autocreate
Fixes for action=raw (used when sites include other site's javascript),
and stashed images.

Bug: 53032
Change-Id: I8f915f6a4756f750c74d9ee9bec58f7ba6c0c827
2013-11-14 14:36:24 -08:00
Siebrand Mazeland
29e0009785 Exclude override to make method public from checks
Change-Id: I66df2efa5900c5a192ae88217e736b7fc7335dcd
2013-11-14 19:16:41 +00:00
Siebrand Mazeland
6b237ebf55 Update docs for files in includes/actions/
Change-Id: I99655ad3df4bc252e3c176e4f465f5ecd615c55f
2013-11-14 20:09:19 +01:00
Siebrand Mazeland
cb8a9bb78a Break long lines in Action classes
Fixes CodeSniffer errors and warnigs.

Change-Id: Ic9cf4b9c677b3168d7c9820e2694080907997ee3
2013-11-14 18:18:49 +00:00
Siebrand Mazeland
6ea188fee5 Update formatting
Change-Id: I3cbe1f5e48730fbbe57e4b20a0c202edddc93c95
2013-11-14 12:20:43 +01:00
umherirrender
11fb421c7c Add content model to the page information
This patch adds a new table row with the content model of the page, this
is usally wikitext, can also be javascript or CSS.

Bug: 56033
Change-Id: If91f6c20d79cd7b3b8924ab6c3df5f90acd8c7a1
2013-11-10 07:39:27 +01:00