Commit graph

507 commits

Author SHA1 Message Date
Umherirrender
5544cef16b Add missing type to @param documentation
Change-Id: I6b2c9c7af9a281fe457099cc3a336a60a25e74aa
2017-08-11 20:37:35 +02:00
Umherirrender
a9007e8baf Add missing & to @param documentation to match functon call
Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
2017-08-11 18:47:46 +02:00
WMDE-Fisch
21aae8b8f3 Fix minor issues found with phan
- fixed PHPDoc
- replaced deprecated function

Bug: T153252
Change-Id: I072a1c1201bd19eafe7c50bbbf32a71fa4a92a46
2017-08-09 22:42:09 +02:00
jenkins-bot
956c2430c7 Merge "Show protection log on creation-protected pages" 2017-08-07 22:12:44 +00:00
Étienne Beaulé
d22eeb8441 Show protection log on creation-protected pages
This change would add the message 'titleprotectedwarning'
to pages that have been protected against creation, just
like how deleted pages have their log visible beforere-creation.
It is visible to everyone, whether or not they are allowed to
recreate the page.

Bug: T171338
Change-Id: I5acf1bee9cea056b20b77fd386bc9df65033cded
2017-08-07 21:32:16 +00:00
Max Semenik
fd6e9ef2d4 Human-readable section ID support
It adds the ability to replace the current section ID escaping
schema (.C0.DE) with a HTML5-compliant escaping schema that is
displayed as Unicode in many modern browsers.

See the linked bug for discussion of various options that were
considered before the implementation. A few remarks:
* Because Sanitizer::escapeId() is used in a bunch of places without
  escaping, I'm deprecating it without altering its behavior.
* The bug described in comments for Parser::guessLegacySectionNameFromWikiText()
  is still there in some Edge versions that display mojibake.

Bug: T152540
Change-Id: Id304010a0342efbb7ef2d56c5b8b244f2e4fb2c5
2017-08-01 20:32:20 -07:00
Louperivois
0872cfea94 Implement a getter/setter for mCategoryViewerClass
Cancel Change 17d5e809 and implement a getter/setter for mCategoryViewerClass

Bug: T172028
Change-Id: Idd8d836339ebf0f07b6782cfb06a3c9a65d93973
2017-08-01 11:17:11 -04:00
jenkins-bot
253c3f17b8 Merge "Avoid using deprecated PreparedEdit::$pst" 2017-07-25 02:58:07 +00:00
jenkins-bot
78c2be09cb Merge "WikiPage: Update comments related to new PreparedEdit object" 2017-07-25 02:58:04 +00:00
Bartosz Dziewoński
6348b10a50 Article: Remove unused variable
Follow-up to 97a8fb78fa.

Change-Id: I8822742f15c3972cec3ac2ec47a2f594453b8672
2017-07-24 11:18:54 +02:00
Kunal Mehta
50ea235528 [SECURITY] Restore ability to suppress pages while deleting
The OOUI refactor in 97a8fb78fa lost the ability to suppress pages while
deleting.

This converts the suppress checkbox into a OOUI one, and then modifies
the detection of whether the checkbox was used to use
WebRequest::getCheck().

Bug: T171405
Change-Id: I8c388808c08b8804689b41876fd2bcdeff7f0e70
2017-07-23 15:50:35 -07:00
Kunal Mehta
d1cf48a397 build: Update mediawiki/mediawiki-codesniffer to 0.10.1
And auto-fix all errors.

The `<exclude-pattern>` stanzas are now included in the default ruleset
and don't need to be repeated.

Change-Id: I928af549dc88ac2c6cb82058f64c7c7f3111598a
2017-07-22 18:24:09 -07:00
Kunal Mehta
5a7ea4f0a0 Avoid using deprecated PreparedEdit::$pst
Change-Id: I27655557d3a6a95920880b80a76b9e798546f79d
2017-07-21 16:03:02 -07:00
Kunal Mehta
4d25eb68a5 WikiPage: Update comments related to new PreparedEdit object
Follows up 85585c47ec.

Change-Id: Iff677257553e20ae37d37142436507b9c8af23a1
2017-07-21 16:03:02 -07:00
Étienne Beaulé
7ecf21c873 Add link to Special:PrefixIndex in delete dialog
This change adds a warning to ?action=delete with a link to a
Special:PrefixIndex of the page being deleted if the page being deleted
has subpages.

If there are less than 50 subpages, the exact count will be mentioned in
the message.

Bug: T32666
Change-Id: Ibd705ed77452a55f782ed855c676d7ee23e9ad61
2017-07-19 14:41:30 -07:00
Kunal Mehta
85585c47ec Return a typed object from WikiPage::prepareContentForEdit
This makes it easier to figure out what values are available and
includes documentation about each field.

This will also allow us to add deprecation warnings for deprecated
properties via __get() in the future.

Change-Id: I4ecc900372546013253256749563aaa203ff8963
2017-07-19 06:24:39 +00:00
jenkins-bot
12601ff7d2 Merge "Convert article delete to use OOUI" 2017-07-12 16:14:38 +00:00
Matthias Mullie
6a8fcd3a7e Display categories on File redirects
This NS_FILE-specific redirect logic was introduced in 2008,
in 3c9536652a.

mTitle, as referenced to in the comments, no longer exists.
Article also no longer creates redirects in there, that’s now
in WikitextContent::fillParserOutput.
The original commit message describes that this was introduced
to be able to display redirects to foreign file repos. A lot
has changed in how that works since 2008, too :)

Back to the present: for redirects to foreign repos,
`$this->mPage->getFile()->getRedirected()` seems to always return
`null` (a placeholder object is created when the thing doesn’t
exist), so this this foreign repo-specific bit of code is bypassed
anyway. For local redirects, Article::view seems to be working just
fine.

By using Article::view, Categories used on file redirect pages
will now actually be displayed too.

And we can get rid of the otherwise no longer used Article::viewRedirect.

Bug: T29857
Change-Id: Icb02f3af32d10870f58d945cb06a84b3ba1305d3
2017-07-04 11:11:58 +02:00
Umherirrender
b5cddfb27b Remove empty lines at begin of function, if, foreach, switch
Organize phpcs.xml a bit

Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
2017-07-01 11:34:16 +00:00
Gilles Dubuc
b8292cef01 Make file purging also purge old versions
Also fixes purging for repos with sha1 thumb URLs.

Bug: T169198
Change-Id: Ibb98ecce83d690cc46769644038b54e37aea0b0d
2017-06-30 10:49:25 +02:00
Umherirrender
be42e09aa8 build: Prepare for mediawiki/mediawiki-codesniffer to 0.9.0
The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment.
Will be fixed in next version, see T167168

Changed:
- Remove duplicate newline at end of file
- Add space between function and ( for closures
- and -> &&, or -> ||

Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
2017-06-26 17:14:31 +00:00
Ed Sanders
97a8fb78fa Convert article delete to use OOUI
Bug: T113758
Change-Id: Ia40919aa750ab91ad16f727273f8bad1f1c9965d
2017-06-22 22:32:18 -07:00
Louperivois
17d5e809d9 Allow CategoryPageView to set $mCategoryViewerClass
Bug: T166483
Change-Id: I9937148dd8114e7167d6a581e64bfed5fdcc568e
2017-06-08 21:09:24 +00:00
Brad Jorsch
0facbe3e3d Try harder to avoid parser cache pollution
* ParserOptions is reorganized so it knows all the options and their
  defaults, and can report whether the non-key options are at their
  defaults.
* Definition of the "canonical" ParserOptions (which is unfortunately
  different from the "default" ParserOptions) is moved from
  ContentHandler to ParserOptions.
* WikiPage uses this to throw an exception if it's asked to cache
  with options that aren't used in the cache key.
* ParserCache gets some temporary code to try to avoid a massive cache
  stampede on upgrade.

Bug: T110269
Change-Id: I7fb9ffca96e6bd04db44d2d5f2509ec96ad9371f
Depends-On: I4070a8f51927121f690469716625db4a1064dea5
2017-06-05 14:17:28 +00:00
Aaron Schulz
dbaec78dbb Avoid scoped lock errors in Category::refreshCounts() due to nesting
Bug: T166757
Change-Id: Ie59523a8b3315f063c914cd25d7b53c11e03fbcd
2017-05-31 22:18:12 -07:00
jenkins-bot
eb04b990fe Merge "ImagePage: Do not parse message 'imgmultipageprev'" 2017-05-29 15:23:11 +00:00
Bartosz Dziewoński
ab05b12366 ImagePage: Do not parse message 'imgmultipageprev'
This message is used as alt text for an image thumbnail, and so it
can't contain HTML tags anyway. This matches the 'imgmultipagenext'
message now. (This inconsistency has been present ever since the
feature was introduced in 2006: 7f7e79022bfd421e49084b089e74c7a16b77bc03.)

Due to using OutputPage::parse() instead of Message::parse(), an
incorrect `<div class="mw-parser-output">` wrapper was also being added.

Bug: T166508
Change-Id: I092887cc91e2c800685d4e55177aed814bb3fce9
2017-05-29 15:22:03 +02:00
jenkins-bot
b3fb666bd2 Merge "page: Avoid deprecated wfMemcKey()" 2017-05-26 23:06:19 +00:00
Aaron Schulz
6fb5844fec Fix TextPassDumperDatabaseTest::testPrefetchPlain postgres failures
The insertId() method was returning a string, which caused the
returnValueMap not to trigger due to int/string mismatches.

Also add sanity integer cast to WikiPage::insertOn().

Added a few more type docs.

Bug: T75174
Change-Id: Id1090f3e3d0481272a3d13c3af8f2588f06dc912
2017-05-26 21:43:17 +00:00
Kunal Mehta
cefab8bcbe page: Avoid deprecated wfMemcKey()
And the deprecated ObjectCache::getMainWANInstance(),
getMainStashInstance() while we're at it.

Change-Id: I951c356f1c394a9658216dea54c92824dca83cbc
2017-05-25 11:20:23 -07:00
Fomafix
0927a5045d Clear postEdit cookie on server-side
* Load module 'mediawiki.action.view.postEdit' only when needed.
* Transfer message key via JavaScript config variable wgPostEdit.
* The response is maked as not-cachable to prevent that other users get the
  post edit message.

This change redefines the global JavaScript variable wgPostEdit from true
to a string and set it on server-side.

Bug: T164148
Change-Id: Id780bc280ce4a2fa4606141419932b7dcd45157b
2017-05-05 23:58:19 +00:00
Bartosz Dziewoński
87a0d64d11 Add a space between "Go to page" dropdown and button for multipage images
Change-Id: I174da5597563be36cc6e67a485f8556b9bcd84f6
2017-04-25 16:41:51 +02:00
Brad Jorsch
aaa1c2ab96 Do an HTMLCacheUpdate of templatelinks on page creation
When a page is created, anything that's trying to transclude that page
needs to have an HTMLCacheUpdate run on it. But that's not currently
happening.

Normal template transclusion happens to get updates only because
transclusion of a nonexistent template is rendered as a link to that
template, which registers a pagelink, and pagelinks *are* being updated
on page creation to cause redlinks to turn blue.

Change-Id: I18b8cfdeedc53f8fdb1e758a6fca1cd23d9574f8
2017-04-18 12:42:55 -04:00
Aaron Schulz
dd359741cc Move DB errors to Rdbms namespace
Change-Id: I463bd86123501abc68fdb78b4cda6110f7af2549
2017-04-15 10:47:41 -07:00
umherirrender
6971569512 Move count of revisions/files out of undelete log comment
The log comment on undelete contains a hint about the count of restored
files and/or revisions.
Move this text out of the comment to allow longer comments. Also makes
this information readable inside the api.

This is only for new log entries. Old entries will still show the hint
from the comment and no data in the api.

Change-Id: I9e30eb1271656bb81259a408210e9a282e949c57
2017-04-08 05:46:45 +00:00
Stanislav Malyshev
1e412aabdf Add deleted archive titles search
Allows search engine to suggest deleted titles for undelete search.
Note that the titles are still verified against the archive table,
to ensure search engine is not out-of-date.

Bug: T109561
Change-Id: Id6099fe9fbf18481068a6f0a329bbde0d218135f
2017-04-05 12:02:35 -07:00
Fomafix
7a3418ae33 Use consistent spaces at start and end of comments
Change-Id: Idbb09b69aa1ef4e46433319aaea62f34f0dbc038
2017-03-30 22:06:40 +02:00
jenkins-bot
d1380bfdd1 Merge "Implement WikiPage::getOldestRevision() in terms of Title::getFirstRevision()" 2017-03-30 18:36:34 +00:00
jenkins-bot
142e89424e Merge "Make Title::getFirstRevision() ignore the rev_timestamp index" 2017-03-29 16:23:38 +00:00
Roan Kattouw
09f14cba52 Implement WikiPage::getOldestRevision() in terms of Title::getFirstRevision()
They were both doing the same thing, except that getOldestRevision()
checks the master if the revision is missing on the replica.

Change-Id: I21a118c6cd5c98fb846a0a2765574c0dbdbf7220
2017-03-29 11:53:08 -04:00
Roan Kattouw
dee457713b Make Title::getFirstRevision() ignore the rev_timestamp index
We want the page_timestamp index to be used in this case, but sometimes
the rev_timestamp is chosen which leads to bad performance.

Also update WikiPage::getOldestRevision() which uses the exact same query.
I'll implement one in terms of the other in a follow-up commit.

Bug: T159319
Change-Id: I7c5c0a9b1af99ce2b5f4bdcc99710d8400ca8bcf
2017-03-29 11:40:12 -04:00
jenkins-bot
ea747bb2d4 Merge "Move IDatabase/IMaintainableDatabase to Rdbms namespace" 2017-03-29 00:46:59 +00:00
Aaron Schulz
488a647831 Move IDatabase/IMaintainableDatabase to Rdbms namespace
Change-Id: If7e8a8ff574661fd827de8bcec11d2c39a687300
2017-03-28 15:32:38 -07:00
Brad Jorsch
f4a306fb18 Deprecate "Avoid page_touched update for HTTP GET action=purge requests"
This reverts most of commit c84ba4d864.
The changes made there are no longer needed, and nothing in Gerrit seems
to have started using them since they were added.

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

Bug: T145649
Change-Id: I526fd4e004bee84c831a4cee71e44e92ee73480b
2017-03-27 10:10:26 -04:00
addshore
58e9ef16ac Stop declaring ImageHistoryPseudoPager props dynamically
The 3 properties declared here were introduced in:
0ca92d0bf5

Change-Id: Ibbd0a86f02ab010720446db1aa2dc9ea0eb05aef
2017-03-22 15:19:42 +00:00
addshore
bc94578b93 Mark public methods as public in ImageHistoryPseudoPager
Change-Id: Iad4442d87df683daca978fa95068f9ca5221d8a5
2017-03-22 12:16:00 +00:00
WMDE-Fisch
7b5f08e703 Replace deprecated Context::getStats() with MWServices::getStatsdDataFactory()
Change-Id: I1756f69ca2ebd301a5049bf758d1a87c37771fe6
2017-03-17 12:07:03 +01:00
Florian Schmidt
2d82f0881a PageArchive: Fix typo in class file
Follow up: I02b7e4785f369c7b6574c4bce093b6de58d1c651

Change-Id: Iec60fb023ef3c57e61ee29c829f750ca1b34467e
2017-03-06 22:46:55 +01:00
Florian Schmidt
03927b2ec1 Move PageArchive class to it's own file
Change-Id: I02b7e4785f369c7b6574c4bce093b6de58d1c651
2017-03-05 22:15:09 +00:00
Aaron Schulz
e01fd44388 Move ResultWrapper subclasses to Rdbms
Change-Id: I6f3f0e85e268b24c57c537aa6ad8016e0b4cdddb
2017-03-03 00:44:41 +00:00