Commit graph

713 commits

Author SHA1 Message Date
Aaron Schulz
cb15755e92 Normalize use of "INNER JOIN" to "JOIN" in database queries
The ANSI SQL default join type is INNER and this might save
some line breaks here and there.

Change-Id: Ibd39976f46ca3f9b71190d3b60b76ca085787a00
2019-03-06 09:17:30 -08:00
Lucas Werkmeister
3290e7b3cc Remove outdated reference to design.txt
docs/design.txt was removed half a year ago in change I85be15a68f
(commit 6760216e10), and was long outdated even then, so let’s stop
pointing people at it.

Change-Id: I165ff1e12fb79c480930289d25833992be61b891
2019-03-04 17:49:42 +01:00
Brian Wolff
3c4be2f2a8 Various fixes for phan-taint-check
Bug: T216348
Change-Id: Id9e7a4704d62457cac9bd1ca6044dec76472e371
2019-03-04 03:12:07 +00:00
Aaron Schulz
a26eee40e0 Avoid use of deprecated ObjectCache::getMainWANInstance method
Change-Id: I429e68c8642a00afa812f5ae900c1fb4f8308528
2019-03-01 02:38:55 +00:00
jenkins-bot
3110946330 Merge "Fix documentation for Revision::getComment and WikiPage::getComment" 2019-02-16 10:59:48 +00:00
James D. Forrester
17c84a62c2 Drop Linker::formatSize, deprecated in 1.28 and unused
Change-Id: Id119e9f3ff0d27b59654876bad9212cc0f3c5a2d
2019-02-08 17:43:33 -08:00
Brad Jorsch
0abb9338f8 Mostly drop old comment schemas
This removes most of the pre-CommentStore text columns, and the
$wgCommentTableSchemaMigrationStage setting that used to determine
whether the columns were used.

rev_comment remains in the code, as on Wikimedia wikis the revision
table is too large to alter at this time. A future change will combine
that with the removal of rev_user_text, rev_content_model, and
rev_content_format (and the addition of rev_comment_id and rev_actor).

CommentStore's constructor continues to take a $stage parameter, and
continues to have the logic for handling it, for the benefit of
extensions that might need their own migration process.

Bug: T166733
Change-Id: I1479c73774e01ead1490adf6128f820c09bce9d4
2019-02-07 16:59:27 +11:00
Aaron Schulz
633be72f6f Make invalidateModuleCache() take a database domain ID
Change-Id: I5d9880a5aee4b055365549671258eb9f242a37d6
2019-02-06 12:40:11 -08:00
Aaron Schulz
5196ac32c6 Rename WikiMap DB domain ID methods to reduce confusion with web domains
Those added in this same release do not need alias methods.

Change-Id: I05feeb9b0b13afe43aea1f95551965489cdbe094
2019-02-06 12:28:45 -08:00
Roan Kattouw
52fbe64ef3 Use PRC_AUTOPATROLLED for rollbacks and revdel
These are automatic, and happen regardless of whether the user
performing the action has patrol-related rights.

Bug: T190408
Bug: T184791
Change-Id: Icd1f3826c378ae759f501d87ffb9988766775b27
2019-02-06 17:25:28 +00:00
Max Semenik
ce071ded51 Display translatable images in wiki language on image pages
We currently show SVGs in default languages unless overridden with
lang=... URL parameter (and we have UI for setting it). This change
makes it display thumbnails in wiki language, if translation is available.

Bug: T210814
Change-Id: Ieb0b5e9e27f45b71ef119bb3c1d3f2cd4d7100e5
2019-02-04 15:57:37 -08:00
Thiemo Kreuz
631be0b64d Fix documentation for Revision::getComment and WikiPage::getComment
This mismatch between the documentation and how the code behaves was
introduced via Ia4c20a9 in December 2017. The getComment() methods have
never been documented to return null, but now do.

I tried to fix this both ways (see I32202df for the other approach), but
decided it's easier and cleaner to keep the null. Reasoning:

* The code behaves like this for more than a year already. Removing the
  null would possibly be as desruptive as when it was introduced.

* Removing the null breaks Wikibase.

* I think returning null is the right thing to do.

I did a brief check of all callers of these two methods. I found a few
that might misbehave a little bit when they are confronted with null, e.g.
in MobileFrontend or Echo. In the vast majority of cases the null will be
silently casted to an empty string and be fine. In a few cases a "the
comment is empty" message might disappear, and the null be shown in the UI
instead, possibly resulting in an empty, confusing HTML element. I would
argue this is an issue with the frontend code then. It should not expect
to have access to all comments. Some might be supressed.

Bug: T174025
Change-Id: I0e1ff9686d1d875812460631c29330c398e74bcf
2019-01-15 14:42:17 +01:00
Fomafix
12f103f392 Fix @param values on private functions
Change-Id: Id7442d5fc557227b3973f5008a3bc1390c528737
2019-01-14 17:53:34 +01:00
Elliott Eggleston
fa83f0d133 WikiPage::doUpdateRestrictions checks DB_MASTER
This would prevent double entries in logs when the same protection
is applied twice within a few minutes. Trying out usage of the
parent patch's new functionality.

Bug: T210983
Change-Id: Ibd6e481db2faa5955f52f36d5d7368adc8747c9c
2019-01-07 20:13:56 +00:00
Umherirrender
ca06a63f3b Use ContextSource::getConfig instead of globals
Change-Id: I26dd9b1efc0292bbe0044d823f639a2ac5e339dd
2019-01-01 11:20:57 +00:00
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