Commit graph

698 commits

Author SHA1 Message Date
jenkins-bot
bd78869618 Merge "No yoda conditions" 2018-12-09 01:34:23 +00:00
jenkins-bot
643830035d Merge "Change rules when displaying block log extract" 2018-12-05 23:55:22 +00:00
Dayllan Maza
65bd5b5e65 Change rules when displaying block log extract
Show log extract if the user is sitewide blocked, or is partially
blocked and not allowed to edit their user page or user talk page.

Bug: T203171
Change-Id: I9bcc50cfc1fad23f6bbbe5374a9a866f77bebc11
2018-12-05 22:58:46 +00:00
jenkins-bot
023fec5d7b Merge "[MCR] Introduce SlotRoleHandler and SlotRoleRegistry" 2018-12-03 16:20:06 +00:00
Jakub Vrana
47583421cf Remove unused parameter
Found by PHPStan.

Change-Id: I0480146fd7fce1d39db904f1c4b6dfa8314a74fe
2018-12-01 17:33:21 +01:00
daniel
db987c700a [MCR] Introduce SlotRoleHandler and SlotRoleRegistry
These new classes provide a mechanism for defining the
behavior of slots, like the content models it supports.
This acts as an extension point for extensions that need
to define custom slots, like the MediaInfo extension
for the SDC project.

Bug: T194046
Change-Id: Ia20c98eee819293199e541be75b5521f6413bc2f
2018-11-30 12:29:05 -08:00
Fomafix
3ee1560232 No yoda conditions
Replace
  if ( 42 === $foo )
by
  if ( $foo === 42 )

Change-Id: Ice320ef1ae64a59ed035c20134326b35d454f943
2018-11-21 17:54:39 +01:00
Petr Pchelko
d81a350d48 Convert $archivedRevisionCount to integer.
Before I81a70ca03fd219d2e96b17714645d9cc4f99b3b9
the archivedRevisionCount argument of the ArticleDeleteComplete
hook used to be an integer, now it's an string. This is backwards
incompatible and needs to be changed back.

Bug: T210013
Change-Id: I297594803fe05cc00cdf209696933b2450d020b6
2018-11-20 15:56:31 -08:00
Agabi10
4985ce5134 Add a way to exclude categories from Special:UnusedCategories
Added __EXPECT_UNUSED_CATEGORY__ as a behavioral switch. Adding
this switch to category pages prevents them from appearing in
Special:UnusedCategories.

Bug: T96041
Change-Id: I055e59f5311347155e0f801dd5ec9a6d4a68c9cc
2018-11-16 13:32:27 +00:00
jenkins-bot
c6ad2554f4 Merge "Add isCurrentWikiId()/isCurrentWikiDomain()/getCurrentWikiDomain() to WikiMap" 2018-10-29 22:27:15 +00:00
Aaron Schulz
dcd0a3d534 Add isCurrentWikiId()/isCurrentWikiDomain()/getCurrentWikiDomain() to WikiMap
Use these in place of various wfWikiID() calls.

Also cleanup UserRightsProxy wiki ID variable names and removed unused
and poorly named getDBname() method.

Change-Id: Ib28889663989382d845511f8d34712b08317f60e
2018-10-29 14:53:37 -07:00
Roan Kattouw
13a1d8957b WikiPage: Truncate redirect fragments before inserting them into the DB
The rd_fragment field is 255 bytes wide, but there is no limit on how
long title fragments can be. We don't want to let the database silently
truncate the fragment for us, because that can result in invalid UTF-8.
Instead, truncate it before insertion in a UTF-8-aware way.

Bug: T207876
Change-Id: I12745f3f4c174eaced56d80f3661a71d0e5637e6
2018-10-24 17:33:56 -07:00
Tim Starling
f7fb00c8f8 Fix slow query counting by unindexed field ar_page_id
Bug: T207530
Change-Id: I81a70ca03fd219d2e96b17714645d9cc4f99b3b9
2018-10-23 17:48:21 -07:00
Umherirrender
577eeaea91 Remove fixed phpcs:ignore
Follow-Up: I418345870e25fa37df0195ddc74193b54fe6d2a5
Change-Id: I0b3a546455c2f35d3aeadbdd31a07bdb1958a74c
2018-10-23 20:35:00 +02:00
jenkins-bot
093feda2c9 Merge "Remove untidy wrapper from ImagePage::makeMetadataTable()" 2018-10-22 17:39:12 +00:00
C. Scott Ananian
a17746274f Remove untidy wrapper from ImagePage::makeMetadataTable()
Replace a fragile <div> wrapper with the robust
OutputPage::wrapWikiTextAsInterface() wrapper.

Bug: T205624
Change-Id: I0a1ba0da6af97f0233afdd8ba7202abed0998419
2018-10-22 16:45:50 +00:00
James D. Forrester
553e40ca63 Follow-up T174035: Wrap inline ternary in brackets to make phpcs happy
Bug: T203805
Change-Id: I418345870e25fa37df0195ddc74193b54fe6d2a5
2018-10-22 09:23:22 -07:00
jenkins-bot
98744107cd Merge "Use OutputPage::wrapWikiTextAsInterface() to add safe <div> wrappers" 2018-10-22 02:00:35 +00:00
jenkins-bot
72e5b5af65 Merge "Use OutputPage::addWikiTextAsInterface() instead of untidy addWikiText()" 2018-10-22 01:49:58 +00:00
Bartosz Dziewoński
5f2cb872b5 ImagePage: Inherit parent's handling for action=render
ImagePage::render() was calling parent::view() instead of
parent::render(), thus skipping Article::render() entirely.
Therefore the logic to disable section edit links (and also,
to add an 'X-Robots-Tag: noindex' header) was not being used.
This fixes T65891 and T21415 for pages in 'File:' namespace.

Bug: T206546
Change-Id: I36ae716c9a363ae29b7a785cc41430301250baba
2018-10-18 05:08:11 +02:00
C. Scott Ananian
ade27ecba3 Use OutputPage::wrapWikiTextAsInterface() to add safe <div> wrappers
This ensures that broken messages can't break the <div> wrapper and
that the output is tidy.

Bug: T205624
Change-Id: I2511adf593a13528e205a82d9fcdc8a524d0a95f
2018-10-17 11:08:16 -04:00
C. Scott Ananian
c0ed262053 Use OutputPage::addWikiTextAsInterface() instead of untidy addWikiText()
This change ensures that the output is tidy, and is necessary to support
future parsers which will not be able to produce untidy output.

Bug: T198214
Change-Id: I743f4185a03403f8d9b9db010ff1ee4e9342e062
2018-10-17 10:35:28 -04:00
jenkins-bot
079a0c4caa Merge "WikiPage: Fix viewing of wiki redirects to NS_MEDIA" 2018-10-11 01:54:19 +00:00
Alex Ezell
d4a45f9ea8 WikiPage: Fix viewing of wiki redirects to NS_MEDIA
If a user creates a redirect to a Media namespace title, a fatal
error is thrown on viewing such rediect because we protect against
redirecting to virtual namespaces. This fix catches this kind of
redirect and modifies the namespace to be File before the Title object
is created.

Follow-up from 613e2699.

Bug: T203942
Change-Id: Ib211d98498f635862fea6bf3e7395f4f8718b3d8
2018-10-11 01:29:47 +00:00
Brad Jorsch
993baa3493 ActorMigration: Remove possibility of read-both
When this was originally written, the plan was to read both the old and
new fields during the transition period, while stopping writes to them
midway through. It turns out that the WHERE conditions to do read-both
correctly are generally not handled well by the database and working
around that would require a lot of complicated code (see what's being
removed from ApiQueryUserContribs here, for example).

We can simplify things greatly by instead having it write both fields
during the transition period, reading from the old for the first part
and the new for the second part, as is being done for MCR.

Bug: T204669
Change-Id: I4764c1c7883dc1003cb12729455c8107319f70b1
Depends-On: I845f6ae462f2539ebd35cbb5f2ca8b5714e2c1fb
Depends-On: I88b31b977543fdbdf69f8c1158e77e448df94e11
2018-10-11 12:12:00 +11:00
jenkins-bot
cf6fb41666 Merge "Re-namespace RevisionStore and RevisionRecord classes" 2018-10-10 05:16:45 +00:00
jenkins-bot
95bb2a6f0b Merge "Use job queue for deletion of pages with many revisions" 2018-10-10 04:55:53 +00:00
Brad Jorsch
dff469a408 Re-namespace RevisionStore and RevisionRecord classes
During development a lot of classes were placed in MediaWiki\Storage\.
The precedent set would mean that every class relating to something
stored in a database table, plus all related value classes and such,
would go into that namespace.

Let's put them into MediaWiki\Revision\ instead. Then future classes
related to the 'page' table can go into MediaWiki\Page\, future classes
related to the 'user' table can go into MediaWiki\User\, and so on.

Note I didn't move DerivedPageDataUpdater, PageUpdateException,
PageUpdater, or RevisionSlotsUpdate in this patch. If these are kept
long-term, they probably belong in MediaWiki\Page\ or MediaWiki\Edit\
instead.

Bug: T204158
Change-Id: I16bea8927566a3c73c07e4f4afb3537e05aa04a5
2018-10-09 10:22:48 -04:00
Fomafix
1472f02b36 Phabricator: Use Tddddd instead of Bug ddddd in comments
Change-Id: Ic9fe03cab270bd6be738af346164ad5d31a0d780
2018-10-04 09:15:02 +02:00
Bill Pirkle
ca9f1dabf3 Use job queue for deletion of pages with many revisions
Pages with many revisions experience transaction size exceptions,
due to archiving revisions.  Use the job queue to split the work
into batches and avoid exceptions.

Bug: T198176
Change-Id: Ie800fb5a46be837ac91b24b9402ee90b0355d6cd
2018-10-03 19:16:14 -05:00
Gergő Tisza
5174fa8364
Add audience parameter to PoolWorkArticleView
The old behavior was that the audience was RAW if the revision object
parameter got passed in, otherwise PUBLIC. This was undocumented and
not used outside core; this patch gets rid of it in favor of an
explicit argument.

Bug: T205578
Change-Id: Ic7cdb38f658f6d85c48ff13c7f84c64a45c9b1ee
2018-10-02 03:53:28 -07:00
jenkins-bot
2d75c56c17 Merge "Add constant for the name of the 'main' slot for MCR" 2018-09-26 11:55:10 +00:00
James D. Forrester
485547cd80 ImageHistoryPseudoPager: Protect against TimestampException from bad user input
Bug: T204796
Change-Id: I17455fef0d899c56ce10f0df0db3457d944e353d
2018-09-26 00:32:07 +00:00
Gergő Tisza
6e8d39c6e7
Add constant for the name of the 'main' slot for MCR
Bug: T202142
Change-Id: I97a74e5a029b014f3c2195188936d5c8233c1b7f
2018-09-24 16:52:12 -07:00
jenkins-bot
8bc630cead Merge "Article: Fix reference to view() in documentation comment" 2018-09-18 02:26:10 +00:00
Roan Kattouw
a9198f06c1 Article: Fix reference to view() in documentation comment
WikiPage::view() doesn't exist; Article::view() does.

Change-Id: I3fbffa15be4cff6cb3f5c7dc5cc178102472f25b
2018-09-18 02:11:42 +00:00
jenkins-bot
b7625d63a6 Merge "Introduce ContentHandler::getSecondaryDataUpdates." 2018-09-17 14:06:19 +00:00
Umherirrender
a4caa4d0c6 build: Updating mediawiki/mediawiki-codesniffer to 22.0.0
Added spaces around .
Removed empty return statement which are not required
Removed return after phpunit markTestIncomplete,
which is throwing to exit the test, no need for a return

Change-Id: I2c80b965ee52ba09949e70ea9e7adfc58a1d89ce
2018-09-16 15:51:11 +00:00
daniel
7960d5385f Introduce ContentHandler::getSecondaryDataUpdates.
This adds getSecondaryDataUpdates and getDeletionUpdates
to ContentHandler, and updates WikiPage and DerivedPageDataUpdates
to handle DataUpdates from all slots.

Bug: T194038
Bug: T194037
Change-Id: I75c96318f58a5cdda48484f7040ae41e6f42392a
2018-09-14 16:18:18 +02:00
jenkins-bot
0dafdebb2b Merge "Improve page display title handling for category pages" 2018-09-12 07:25:46 +00:00
daniel
4835a75ec5 Use RevisionRenderer for rendering ParserOutput
Bug: T174035
Bug: T174036
Change-Id: I1085b05d635dd954c143c8a398fae909632ba0a9
2018-09-11 15:25:39 +00:00
Niklas Laxström
d89704bc4c Improve page display title handling for category pages
One use case of display title is to localise page names with Translate
extension or without. While the page title changes, the subheadings still
say something like "Pages in category Foo/de".

Also converted one raw HTML message to be a parsed message.

First version of this patch caused an issue when previewing
because page title in h1 is not the same as page display title.

This issue is fixed by promoting page display title as it's own member
in OutputPage. Also added getUnprefixedDisplayTitle that attempts to
strip away the namespace prefix to mimic Title::getText() but which
works with display title instead.

Bug: T43720
Bug: T46197
Change-Id: I6097a873297eb57759252fc56ad6d02c44e4c366
2018-09-10 08:29:48 +02:00
Gergő Tisza
51602a436c
[MCR] Move getSecondaryDataUpdates to the page level
Replaces Content::getSecondaryDataUpdates with
WikiPage::getSecondaryDataUpdates so that aggregation of
data updates from multiple page slots can be handled without
the caller having to care about it.
Also adds a WikiPage::updateParserCache method for convenience.

This is a temporary measure until DerivedPageDataUpdater
(or its replacement) can be exposed directly, at which point
the WikiPage methods will be deprecated.

Also fixes a parameter handling bug in DerivedPageDataUpdater.

Bug: T194043
Change-Id: Idbe7d582b49fcb7c90aea813773b7610ad44b1a8
2018-09-04 21:50:58 +02:00
daniel
e9f71517f7 [MCR] Introduce RevisionRenderer
RevisionRenderer is the MCR replacement for Content::getParserOutput,
as outlined in <https://www.mediawiki.org/wiki/User:Daniel_Kinzler_(WMDE)/MCR-PageUpdater>.

Note: This change also introduces quite a bit of code for
merging ParserOutput objects.

Bug: T194048
Change-Id: I871978bf79f67c9e7954fb3fc8528d6e365f2cc1
2018-08-30 19:15:12 +02:00
jenkins-bot
6abd0c0c3b Merge "Add tests for article viewing" 2018-08-29 15:29:21 +00:00
daniel
9b6a3dcb1d Add tests for article viewing
Bug: T174035
Change-Id: I06dc78853169812b17e0bde733d9306ccd687564
2018-08-28 19:22:26 +02:00
jenkins-bot
e548e0f35c Merge "Make interwiki transclusion use the WAN cache" 2018-08-27 21:17:04 +00:00
Aaron Schulz
6504e23074 Make interwiki transclusion use the WAN cache
This means that now:
* Entries actually get deleted when expired
* The transclusion cache is shared across wikis
* Large blobs that do not fit in cache no longer cause DB errors
* DB writes are not triggered on GET requests
* Keys are hashed and no longer need to be so restrictive

Also, add a "check key" based purge system and process cache the
text/html values similar to how regular revision text is cached.

Bug: T189702
Change-Id: I8ac12b53c02bb26857175dd5a4af29d49e03dc33
2018-08-27 19:32:04 +00:00
Gergő Tisza
a072e254a5
Restore passing of triggering user in edit updates
Bug: T200119
Change-Id: I14102a15aa93d1f909c5b347f5dd589f87c2e500
2018-08-26 20:27:29 +02:00
Umherirrender
40d3ce8d17 Reduce calls to MediaWikiServices::getInstance()
In some functions MediaWikiServices::getInstance() was called twices or
in loops. Extract the variable to reduce calls.

Change-Id: I2705db11d7a9ea73efb9b5a5c40747ab0b3ea36f
2018-08-18 06:02:39 +02:00