Commit graph

1650 commits

Author SHA1 Message Date
jenkins-bot
089e1abb9e Merge "resourceloader: Lower severity of targets violation back to DEBUG" 2019-10-16 21:30:24 +00:00
Krinkle
b8e51a65a9 resourceloader: Lower severity of targets violation back to DEBUG
This reverts commit cb6a24d3c4. We were looking to find
violations other than the Gadgets extension in preparation for
removal of this feature. And... we have. And they're sufficiently
high-volume that it doesn't make sense to keep enabled until we've
fixed those.

Lower the detection severity back down until we've fixed these
new ones.

Bug: T235711
Change-Id: Ia3c047f76430584dcc49741ba2d7b7f7b2b89063
2019-10-16 21:14:46 +00:00
jenkins-bot
7435150c00 Merge "resourceloader: Bump severity of targets violation to WARNING" 2019-10-11 21:25:23 +00:00
Timo Tijhof
cb6a24d3c4 resourceloader: Bump severity of targets violation to WARNING
Now that we've all known violations we can safely enable this
in production. It was mainly held back because the Gadgets
extension violated it "by default" due to not checking targets
and letting core handle it. This has been fixed by f59eaacb4f72d8
in MobileFrontend and 2008def8063 in Gadgets.

Bug: T127268
Change-Id: I43aed5011f96160565f2dfc3422034d0e8fa95c4
2019-10-11 21:10:56 +00:00
Umherirrender
fba5bbe5cd Use real varargs in OutputPage
Change-Id: I24821df0299d18a81e89d2e10671937f65c88bd8
2019-10-11 20:17:48 +02:00
jenkins-bot
ec440ce1bf Merge "Make max-age configurable for logged-out users" 2019-10-03 22:13:50 +00:00
Gilles Dubuc
ea9cb5ceaa Make max-age configurable for logged-out users
For small wikis. When a CDN is present, the value is
overwritten by the CDN.

Bug: T231184
Change-Id: I45a53571d0f5f6316eb97b396c18c0b224586526
2019-10-03 21:59:10 +00:00
Timo Tijhof
0e1e4ee5de
block: Allow cookie-block tracking from any uncached web request
This was previously hardcoded from three places: 1) Upon viewing EditPage,
2) Upon viewing SpecialCreateAccount, 3) For any url if the user is
logged-in (User::loadFromSession/isLoggedIn).

== User::loadFromSession

Performing cookie blocks from here created a circular dependency because
Block may need the user language for localisation, which is determined by
asking the User object. This was previously worked around by using a
DeferredUpdate (T180050, T226777). Moving this logic explicitly to the
end of the pre-send cycle in MediaWiki::preOutputCommit breaks the cycle.
This is also where other request-specific handling resides already.

== Limited effect on unregistered users

When an unregistered user performs an edit, and gets blocked,
the cookie block is not applied until they open built-in editor
or CreateAccount page. This makes it more likely for a user's
IP to change meanwhile. Either intentionally, or simply due to
IPs varying naturally (e.g. between mobile locations, or when
going on/off WiFi). By applying it throughout sessioned page
views for unregistered users, it is more likely to get set.
Similar to what was already done for logged-in users.

This commit also makes the intent of not caching EditPage and
SpecialCreateAccount explicit. This was previously implicit
through nothing having called setCdnMaxage() and/or due to
Session::persist being checked for by OutputPage::sendCacheControl.

Bug: T233594
Change-Id: Icf5a00f9b41d31bb6d4742c049feca0039d0c9d9
2019-10-01 13:52:58 -04:00
Daimona Eaytoy
e5444ea55a docs: Avoid some scalar juggling
Phan can treat scalar types as non-interchangeable with
`scalar_implicit_cast` set to false. This patch fixes some of those
issues (which are in total >1000), namely the ones with alphabetic order
< includes/actions.

Change-Id: Ib1c6573ab899088bc319b9da9ceaffc850da3dbe
2019-09-19 17:21:24 +00:00
jenkins-bot
5d16571ffb Merge "OutputPage: Add visibility to various methods & do some micro-optimizations" 2019-09-15 16:41:21 +00:00
Derick Alangi
f7eede1191 OutputPage: Add visibility to various methods & do some micro-optimizations
Methods that visibility was added to are; `addMeta()`, `addLink()`,
`setCanonicalUrl()`, `addScript()`, `getHeadItemsArray()`, `addParserOutput()`,
`getCacheVaryCookies()` and `haveCacheVaryCookies()`. Last but not lease, did
a few micro-optimizations to `addMeta()` and `addLink()`.

Change-Id: I94d037a5edc7131627724fd1d864000128077b0c
2019-09-15 16:18:12 +00:00
Daimona Eaytoy
3439c00073 Suppress PhanUndeclaredProperty for custom properties and phan bugs
And remove the issue from the exclusions list.

Bug: T231636
Change-Id: Iee73ddb554e354abe52d13dcfc453f9a15bb8877
2019-09-14 13:22:54 +00:00
Thiemo Kreuz
1fa42d25ec output: Narrow Title type hint to LinkTarget
The code never needs a full Title object, but only what the (more
narrow) interface provides.

Change-Id: I3a7aa35c7e90fffaf37f4cb444549237c20e0bd9
2019-09-13 11:34:33 +02:00
Timo Tijhof
cd6707ca18 Remove support for wgUseESI
Experimental feature deprecated since 1.33 (d63684a064).

Change-Id: I9bab4ad1cd1f2c80a3dfcccdf99ed011c9c8a440
2019-09-08 05:11:57 +01:00
jenkins-bot
543c5c1a1f Merge "resourceloader: Compile documentElement.className server-side" 2019-09-03 21:04:23 +00:00
Daimona Eaytoy
c659bc6308 Unsuppress another phan issue (part 7)
Bug: T231636
Depends-On: I2cd24e73726394e3200a570c45d5e86b6849bfa9
Depends-On: I4fa3e6aad872434ca397325ed7a83f94973661d0
Change-Id: Ie6233561de78457cae5e4e44e220feec2d1272d8
2019-09-03 17:19:21 +00:00
Daimona Eaytoy
e70b5b3309 Unsuppress other phan issues (part 4)
Bug: T231636
Depends-On: I58e67c2b38389df874438deada4239510d21654f
Change-Id: I6e5fba7bd273219b1206559420b5bdb78734aa84
2019-08-31 17:13:39 +00:00
Daimona Eaytoy
5eac6d131c Unsuppress more phan issues (part 3)
Bug: T231636
Depends-On: I78354bf5f0c831108c8f606e50c87cf6bc00d8bd
Change-Id: I58e67c2b38389df874438deada4239510d21654f
2019-08-31 16:38:55 +00:00
Petr Pchelko
f1914810a7 Remove usages of Title::quickUserCan
Change-Id: Ifa53e0ec800e23dc4184d133a100fb9378dfee9e
2019-08-29 11:48:30 -07:00
Timo Tijhof
e04d6c3186 resourceloader: Compile documentElement.className server-side
Reduces output by not needlessly performing a change client-side
for which we already know the result server-side.

Bug: T231168
Change-Id: I4b8749f976d04d24f85236ddd641c7a4c7f6c23a
2019-08-29 02:27:25 +00:00
Fomafix
bb94f4964d Use local variabe $services instead of MediaWikiServices::getInstance()
Change-Id: Ieb6230231d9b916fd1366e7b473db00c87ac4428
2019-08-26 16:12:05 +02:00
Piotr Miazga
b7204566d2 Deprecate skin functions that are not skin responsibilities
Skin shouldn't be responsible for providing requested revisionId
nor if that revision is the current revision.
The OutputPage object has all required information (both the
currentRevisionID and the current Title object).

Change-Id: I2dbae4c6968a2b3b3cea3e09977e9579609b4cc5
2019-08-23 13:21:11 +00:00
Petr Pchelko
acaa3e3136 Remove deprecated User groups/permission static calls.
Bug: T220191
Change-Id: Ifa8afa90c432723b0bba0033a46b6a499c77e6fc
2019-08-21 19:42:01 -07:00
jenkins-bot
c698fe313e Merge "Clean up spacing of doc comments" 2019-08-05 22:51:10 +00:00
Umherirrender
2664eeb632 Clean up spacing of doc comments
Align the doc stars and normalize start and end tokens

Change-Id: Ib0d92e128e7b882bb5b838bd00c74fc16ef14303
2019-08-05 22:29:50 +00:00
Timo Tijhof
39ec2dd84b OutputPage: Remove 'html5shiv' module from RL registration
Follows-up 66a011797d, which changed the reference to this
JS file to be without the indirection of ResourceLoader.
It's been deployed well over the needed 7 days, so this can be
removed now.

Change-Id: I823c0b31c4478e5e34f4191d851b6a9c83a6019b
2019-08-03 22:45:48 +01:00
jenkins-bot
a0307e8fa0 Merge "OutputPage: Load html5shiv without indirection of load.php" 2019-07-06 01:00:54 +00:00
Timo Tijhof
66a011797d OutputPage: Load html5shiv without indirection of load.php
This library was introduced in 3a30e03645, to make sure Grade C
stylesheets that apply to HTML5 elements that older browsers might
not know yet, work as expected in old IE.

It originally committed a minified version and loaded it directly
as an HTML script tag in a conditional comment. This had minimal
impact on anything else, and was easy to maintain.

In 68237fb1a7, this was changed to commit the unminified version
instead because Debian maintainers don't like packaging software
that contain minified files, despite being a simple file,
unmodified from the original (upstream publishes it in minified
form, with license header), published under a compatible free
license, and embedded in a license-compliant manner. We then
registered it as an unused ResourceLoader module, to be minified
on-the-fly at run-time.

Support for "server-registered client-unregistered" modules was
removed last week in c554ee8e64 because nothing needed it
anymore (except html5shiv apparently), which resulted in this
module being registered client-side on all page views for all
users (in latest master). This doesn't break anything, but it
is a regression performance-wise.

Restore this by (mostly) going to how it was before: A simple static
file, committed to Git, served as-is. Not related to, served by,
pulled through, nor registered with, ResourceLoader in any way.

Only difference with the original approach is that it is no longer
minified, which means a few more bytes transferred on old IE page
views, which is considered an acceptable compromise.

Bug: T201483
Change-Id: Ib0020b6bd015679b61f63eaa8109ed9b83d8ad15
2019-07-06 00:35:25 +00:00
Timo Tijhof
a69880e05c resourceloader: Only output ResourceLoaderDynamicStyles when needed
In mediawiki.js, this marker has always been optional, falling back to
appending to <head>. When no stylesheets need to be after the marker
(e.g. no site styles on the wiki, and user is not logged-in), then
there is no need for the marker to exist.

In a previous refactor, I was going to do this and created an
"$append" variable in the function to do what this commit does,
but I forgot to actually use it for anything.

Test Plan:
* Local wiki, with no MediaWiki:Common/{Skinname}.css pages existing.
* When logged-out, before this change, there is a marker, now there is not.
* When creating "MediaWiki:Group-user.css" and logging in, there is still
  a marker, and it is still above the <link> for that user styles request
  in the <head>.

Bug: T219342
Change-Id: I2e9657f318088860916823efeb96ae4f1532974c
2019-07-04 19:14:39 +00:00
mvolz
a3362815dd OutputPage: Change outdated comment to point to mediawiki.org page.
Comment had outdated TODO for documentation
which has since been created.

Change-Id: Id0df26c979a6d1bad84e456a923721688d51617f
2019-06-28 16:38:58 +00:00
jenkins-bot
be9c792ecd Merge "Update OOUI to v0.33.0" 2019-06-27 21:03:45 +00:00
James D. Forrester
5cbb90cf67 OutputPage::addScriptFile: Drop silencing invalid paths, deprecated in 1.24
Change-Id: Ia65c70366ab67324ef2a02f9b0e81a6fb7a081cb
2019-06-27 17:22:52 +00:00
James D. Forrester
167f7844bd Update OOUI to v0.33.0
Release notes:
 https://phabricator.wikimedia.org/diffusion/GOJU/browse/master/History.md;v0.33.0

Bug: T218753
Bug: T218977
Bug: T224657
Bug: T224702
Bug: T224881
Bug: T225021
Bug: T225571
Bug: T225882
Bug: T226031
Bug: T226045
Bug: T226618
Depends-On: I396faea52625a294991f7a473043cb39ed98ca28
Depends-On: I38aa1ce529bed43175d2ecdcecd1c6a2a0ed603f
Change-Id: I396faea52625a294991f7a473043cb39ed98ca20
2019-06-27 05:56:23 +00:00
jenkins-bot
b76b9e9745 Merge "Follow up to 'Remove support for the deprecated Key header'" 2019-06-26 22:39:11 +00:00
Reedy
65b8992f7c Remove support for calling OutputPage::wrapWikiMsg() with an options parameter
Bug: T220656
Change-Id: If9103eb702f3879172d6e860d974603b7b32d6f5
2019-06-21 13:45:11 -07:00
C. Scott Ananian
73ec2a1836 Follow up to 'Remove support for the deprecated Key header'
Clean up a few more code paths and documentation bits left behind by
Ia53d07cd8ce8ab1497294ea244c13c7499f632c7.

Change-Id: I2bb1749c45bb79b27c5a3b2e1b8ed3395e8c11e0
2019-06-20 15:01:51 -04:00
C. Scott Ananian
2a806d0429 Remove OutputPage::enableSectionEditLinks(), ParserOptions::get/setEditSection()
These methods were deprecated in 1.31, and most of the related code
was removed in b4e557f8f8 but these three
methods appear to have been overlooked.

Change-Id: Iea6c8b1b628a7b6acf9b65497966af9fc4ab662e
2019-06-19 15:14:54 -04:00
C. Scott Ananian
ce1bd86a4b Remove $wgUseKeyHeader and OutputPage::getKeyHeader(), deprecated in 1.32
These implemented a since-abandoned draft IETF spec, and the code was
broken due to (1) case-(in)sensitivity issues with the Accept-Language
header and (2) the BCP47 language code compatibility workaround we use.

Change-Id: Ia53d07cd8ce8ab1497294ea244c13c7499f632c7
2019-06-19 15:14:54 -04:00
C. Scott Ananian
8a80f58cef Remove OutputPage::addWikitext()* functions, hard-deprecated in 1.32
This starts cleaning up the programmer-visible API for OutputPage
and removed some deprecated untidy parser modes.

Change-Id: Ib464b57248f114b68424ec1175d36ad86d1319ad
2019-06-19 15:14:54 -04:00
jenkins-bot
13d95407dc Merge "resourceloader: Migrate use of 'raw' modules to 'raw' requests" 2019-06-19 12:40:12 +00:00
Fomafix
110a5877e9 Use [...] instead of array(...) in PHP comments and documentation
Change-Id: I0c83783051bf35fe785bc01644eeb2946902b6b2
2019-06-17 21:15:09 +02:00
Timo Tijhof
24e54d6999 resourceloader: Migrate use of 'raw' modules to 'raw' requests
The ResourceLoaderModule::isRaw() feature and the ability to magically
switch a regular load.php request into raw mode is being removed soon.

Instead, specify raw=1 in the request url where that behaviour is needed.

Bug: T201483
Change-Id: Ie4564ec8e26ad53f2de1a43330d18a35b0498a63
2019-06-14 17:57:22 +01:00
jenkins-bot
61544d6eb2 Merge "Migrate remaining usages of Title::userCan() to PermissionManager" 2019-06-14 11:19:47 +00:00
Bartosz Dziewoński
a8dae2212c Allow loading styles for arbitrary OOUI icon packs
You can now create ResourceLoader modules for arbitrary sets of OOUI
icons. This is an alternative to I8af783666a2b23a938af93c1b56fee619219eaf5.

Update dependencies of OOUI's modules to use custom icon packs instead
of default icon packs.

Bug: T160690
Change-Id: Icf9560da79c91e56c7a3f4c0de01dd057f5aa00d
2019-06-11 17:52:23 +00:00
Máté Szabó
6420c79320 Migrate remaining usages of Title::userCan() to PermissionManager
T208768 introduced the PermissionManager service that can now be used
for page specific permission checks. This change replaces remaining calls
to Title::userCan() with the new service in MediaWiki core.

Bug: T220191
Change-Id: Ie45e0cb6aa49a8c66147b470946161fc18160fc1
2019-06-03 13:03:46 +02:00
James D. Forrester
f9f8dff40f Rename CDN config variables to be generic, deprecating the old names
Hook, methods, classes still to rename where appropriate.

Bug: T104148
Depends-On: Id34339dff88bc6d1863378ac94b96b2d590b891d
Depends-On: I4e2938395bcbf7956b83fff00978f09c61dcfa36
Change-Id: I7a725dae551c867a4fa7c213838d52c7fb862756
2019-05-24 21:09:22 +00:00
Fomafix
79de0a4e5a Use HTTPS instead of protocol relative for WMF links
The WMF websites redirect from HTTP to HTTPS.

Change-Id: I916c97697b4ffa9774eec9c8e6ab650a08bb6edd
2019-05-17 08:12:10 +02:00
Derick Alangi
820d33ac96 Remove deprecated unused method getModuleScripts()
Deprecated in 1.33 and no longer used. Removed from OutputPage and
from ParserOutput.

Usage
=====

https://codesearch.wmflabs.org/search/?q=%5CbgetModuleScripts%5Cb&i=nope&files=&repos=

Bug: T220656
Change-Id: Ifddea94504d0c749d3a77daf967d5fec95b50339
2019-05-09 23:33:53 +01:00
Derick Alangi
1981823755 Remove several methods, deprecated in 1.32
I've checked and doubled checked that these methods are no longer used
anywhere in core or extensions, hence removed them. They were hard deprecated
in MediaWiki 1.32.

* OutputPage:
  ** `::showFileCopyError()`
  ** `::showFileRenameError()`
  ** `::showFileDeleteError()`
  ** `::showFileNotFoundError()`

* ApiBase:
  ** `::truncateArray()`

* IcuCollation:
  ** `::getICUVersion()`

* HTMLForm:
  ** `::setSubmitProgressive()`

* ResourceLoaderStartUpModules:
  ** `::getStartupModules()`
  ** `::getLegacyModules()`

* BaseTemplate:
  ** `::msgHtml()`

* QuickTemplate:
  ** `::msgHtml()`

* WatchAction:
  ** `::getUnwatchToken()`

Bug: T220656
Change-Id: Ic1a723a991f4ff63fcb5f045ddcda18d1f8c3c68
2019-05-09 11:36:44 -07:00
Derick Alangi
b4e557f8f8 Remove several deprecated unused methods from OutputPage & ParserOutput
Output::sectionEditLinksEnabled(), ParserOutput::getEditSectionTokens() and
::getTOCEnabled(), ::setEditSectionTokens(), ::setTOCEnabled have been removed.

Change-Id: I7fe927776e2451bafb96ef5c4ee500497ec3734c
2019-05-09 16:39:28 +01:00