Commit graph

511 commits

Author SHA1 Message Date
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
Timo Tijhof
9af38c046c RollbackAction: Implement AJAX interface and require POST
Similar to WatchAction (converted in commit 77cdf1919).

* Make FormAction::getFormFields not abstract.
  In most cases this will just be an empty array.

* Convert RollbackAction from FormlessAction to FormAction and implement the
  required error handling scenarios (mostly moved out of from the old method, or
  duplicated from the WikiPage method where necessary).

* In most cases the in-between form is never used since a JavaScript handler
  takes over the link and uses the API over AJAX instead. In the no-js fallback
  (as well as for any existing tokenless rollback links) copy the GET parameters
  into the form for re-submission as POST (plus token, added by HTMLForm).

* Remove the distinction between WebUI and API tokens. This stronger token salt made it
  unnecessarily complex and was only there because it used GET until now. This streamlining of
  tokens matches what we already do for 'watch', 'edit', 'patrol' and other actions.

* Fix form submission bugs when 'from' query parameter is missing.

  - Ensure the required 'from' query parameter is present before showing a form.
    No need for the user to submit a form we know will fail.

  - Plain GET request to action=rollback (with no parameters) is now a 400 Bad Request
    instead of a form that would fail when submitted.

  - Submitting the form without 'form' field now correctly says why it failed.
    Previously it emitted a session error, which was a lie.

Bug: T88044
Change-Id: Ia457802fec2e90573c8e7d552bc1f3cee258f10b
2016-05-23 20:00:48 +01:00
Brad Jorsch
af3b10287e SECURITY: RawAction: Vary on the usual headers
This avoids edge cases where the user isn't logged in but we still need
varying for proper cache behavior.

Bug: T125283
Change-Id: I43cde3a48371e62a16bda1291b1b51986e60fe4c

Signed-off-by: Chad Horohoe <chadh@wikimedia.org>
2016-05-20 09:48:26 -07:00
jenkins-bot
f829125b49 Merge "Revert "Make an empty "?action=" parameter default to "view""" 2016-05-18 19:06:24 +00:00
Krinkle
caf87b4893 Revert "Make an empty "?action=" parameter default to "view""
This reverts commit b287ec2cc6.

Change-Id: I59e996dfe627e8a978ed849a8e82ad4e0b165d7f
2016-05-18 18:54:50 +00:00
jenkins-bot
92e3d2f1a3 Merge "Add actual documentation for ContentHandler::getActionOverrides" 2016-05-18 17:41:05 +00:00
Thiemo Mättig
c415767e0e Add actual documentation for ContentHandler::getActionOverrides
Change-Id: I7fd803204ad137dd3510ea321ff7e6fa11d910c0
2016-05-18 15:49:26 +02:00
Thiemo Mättig
b287ec2cc6 Make an empty "?action=" parameter default to "view"
When no action is given, e.g. in
https://en.wikipedia.org/wiki/URL
the action defaults to "view". Just like you called
https://en.wikipedia.org/wiki/URL?action=view

But when the action is empty, e.g.
https://en.wikipedia.org/wiki/URL?action=
you get an error message telling you that "the action specified"
can not be "recognized". Wait, I did not "specified" an action.
That's why I left the parameter empty. From the users point of
view I expect the empty string to behave like null/undefined.

This is a resubmit of I331924d without the problematic bits.

Change-Id: I07847600bb24ae078276acf98e6eb244039414d7
2016-05-17 18:36:39 +02:00
addshore
818984e5cb Remove WatchedItemStore::getDefaultInstance
Change-Id: I0c7d706fabee8d1f6fcfbc4c568f375953de8058
2016-05-06 08:47:37 +00:00
Aaron Schulz
ac50bd61c8 Ignore DBPerformance warnings for ?action=purge for users with "purge"
Change-Id: Ib6d1c9a6885008a7e2233adb26b6234787e32670
2016-03-24 14:30:12 -07:00
Reedy
b5656b6953 Many more function case mismatches
Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
2016-03-19 00:20:58 +00:00
Roan Kattouw
9680bf8c82 Action:🏭 Don't crash on missing Action classes
Show the "no such action" error message instead.

Normally I wouldn't favor putting this in here, but it's way
too easy to register a missing class by accident, see my rant
on T107921#2128080.

Bug: T107921
Change-Id: I56da8a5810cae3547a0c8f2d3f435dfd790fbeaf
2016-03-16 17:39:54 -07:00
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