Commit graph

1561 commits

Author SHA1 Message Date
Reedy
39f0f919c5 Update suppressWarning()/restoreWarning() calls
Bug: T182273
Change-Id: I9e1b628fe5949ca54258424c2e45b2fb6d491d0f
2018-02-10 08:50:12 +00:00
James D. Forrester
b0689e7929 Follow-up ed76b6736: Also remove the now-unused $mExtStyles
Change-Id: I7622ba15b03df97213acd82e4a3fa78267a30d55
2018-02-05 17:38:52 +00:00
James D. Forrester
ed76b67365 OutputPage: Remove methods deprecated in 1.27 or before
Eighteen uses of readOnlyPage and three of addExtensionStyle; all
have fixes awaiting merge. Marking as dependent on the only one
in a Wikimedia-deployed extension.

Depends-On: Ib3ea649bc68dd0edc025133721b46996d1e8901f
Change-Id: I636ebc7dead55f1ae654a13d3b6ebb023ecfe8e1
2018-02-02 12:45:08 -08:00
Reedy
9f8a886867 Update WrappedString use statements
Bug: T182273
Change-Id: Ia9515863491fa9c8684698fa33612eec5eb6d937
2018-01-21 04:39:17 +00:00
Reedy
75f250ec55 Update RelPath calls
Bug: T182273
Change-Id: Ifd04e3b3ab72cc56bef48a1fc18fccb34b0af618
2018-01-21 04:34:18 +00:00
jenkins-bot
a18476eab3 Merge "Remove @param comments that literally repeat what the code says" 2018-01-11 23:48:03 +00:00
Thiemo Mättig
ef470ebf7f Remove @param comments that literally repeat what the code says
These comments do not add anything. I argue they are worse than having
no comments, because I have to read them first to understand they
actually don't explain anything. Removing them makes room for actual
improvements in the future (if needed).

Change-Id: Iee70aad681b3385e9af282d5581c10addbb91ac4
2018-01-10 14:14:26 +01:00
Thiemo Mättig
fa15c98787 Improve (weak and strict) type hints invarious places
Change-Id: I3a42ec1547fae971d7b495c99dd144739d8521ab
2017-12-28 16:31:56 +01:00
Umherirrender
3351894705 Add grep comment for js vars wgRestriction*
Change-Id: I974841acf97e9426ed2338f210821e91d7f94286
2017-12-27 10:43:36 +00:00
Gergő Tisza
fbe17a7386 Allow fallbacks for $wgReferrerPolicy
For browsers that support older versions of the Referrer Policy
specification (Edge and Safari), using a value from a newer version of
the specification will result in those browsers falling back to a
default of "default".

So allow $wgReferrerPolicy to have fallbacks if the browser does not
recognize the currently set value. It will emit <meta> tags for each
value in the array, but in reverse order, as browsers will use the last
one that they recognize.

Bug: T180921
Change-Id: Ie0f523fc6937c9ecffc8a6fc791c6b54d5a1cb06
2017-12-24 15:14:10 -08:00
Brad Jorsch
e74ba29aa6 Use ParserOutput stateless transforms
We still set the state in many cases for benefit of extensions, but all
calls within core should no longer be using non-default state.

Change-Id: I78b62ec33fcb8273acb9b3b4e9012215442be94c
Depends-On: I140ff32373430b61b92226689ef9b58cca317450
2017-11-30 14:27:49 -05:00
Brad Jorsch
cfc57f374c Deprecate OutputPage::parserOptions() as a setter
The only known callers were using it to call ->setEditSections( false ),
which has been the default since MediaWiki 1.19.

Change-Id: Ib021d7e80e44782ba6ebe66cf8366bae9147ce00
Depends-On: I7de0102e6cac6b5aa0147b825fa2cb6ebd37b434
Depends-On: I7b0604773a8692c7cb37fffa3fcb8aaac83d81ba
2017-11-22 15:17:00 -05:00
James D. Forrester
88ba64343b OutputPage: Hard-deprecate setSquidMaxage, renamed since 1.27
Renamed and deprecated in MediaWiki in f606fd8d since 1.27.

Only six uses in Wikimedia-hosted git repositories, marked as
dependencies. Also one use snuck back into MediaWiki itself,
fixed in this patch.

Depends-On: Ie8c13a6b1dc1b7861f6c27bbba996099375f066b
Depends-On: Ic2ea90343efda6533c06ca1325bc85d9aa776078
Depends-On: Ibba2f486f0ecb684ded7efb09f9942f5e0f5fd7a
Depends-On: Id27a48e10fd127e00f68e1020e8f40e30ba9a251
Depends-On: Ifd6db7910a71bb700484d6b588327424f11c00e0
Depends-On: I6523059941eb5f86274e364a8d5cc74b849655a4
Change-Id: I2cdfcd60fc7934830e3e6ec132958aa2aa1fe486
2017-11-02 11:51:58 -07:00
Paladox
66b13d1ba8 Add support for SVGs to $wgLogoHD with PNG fallback
SVGs could already be used through $wgLogo. However, if a PNG fallback
is desired for older browsers, using SVGs was previously not possible.

This commit adds support for using an SVG image in $wgLogoHD and,
using $wgLogo as the fallback image.

Usage example:

> $wgLogo = '/path/to/png';
> $wgLogoHD = [
>     'svg' => 'path/to/svg',
> ];

Note: When the 'svg' key is set in $wgLogoHD, any '1.5x' and '2x' keys will
no longer be used because SVGs can render optimally on any screen sizes.

@Reedy, @Krinkle and @Brion VIBBER helped me alot with this.

Bug: T86229
Change-Id: I6197d96ce9110f4711ef2c4b198445bc5c6ae110
2017-10-24 17:51:28 +00:00
Max Semenik
c4145b2f08 Simplify OutputPage constructor
Make it impossible to instantiate this class without passing it
context. This appears to be the oldest wfDeprecated() in MediaWiki.
All callers have been updated.

Change-Id: I00b9e283ad22c6274b358063b9f9e60fe93d5ee7
2017-10-13 19:48:46 +00:00
jenkins-bot
a7f7bc7981 Merge "Refactor global function wfBCP47 to static function LanguageCode::bcp47" 2017-10-05 17:55:50 +00:00
Addshore
2781a0c1e0 Revert "Remove some remaining mentions of unstubbing from core"
This reverts commit 0f91e75c20.

Bug: T177478
Change-Id: I1937bd116d22479c38a9a34714c2090e2a4c0d7e
2017-10-05 17:27:08 +00:00
Fomafix
ea0bd74a94 Refactor global function wfBCP47 to static function LanguageCode::bcp47
Deprecate global function wfBCP47.

Change-Id: Ie6bb061b5d6ca67289bb18bc468a87421f38fc94
2017-10-05 09:54:45 +02:00
Chad Horohoe
0f91e75c20 Remove some remaining mentions of unstubbing from core
Change-Id: Ife34335db7afd9bd4f0936cb90be227d7c4c9651
2017-10-03 23:01:43 +00:00
Kunal Mehta
68237fb1a7 OutputPage: Turn html5shiv into a raw ResourceLoader module
This lets us take advantage of ResourceLoader's on the fly minification
rather than needing to ship a minified copy, which is problematic for
other distributions like Debian.

Because the startup module excludes raw modules, it is not possible to
load or depend upon this module, and trying to use
`mw.loader.load('html5shiv')` for example will throw an exception.

This follows-up 3a30e03645.

Change-Id: I635e224fb043c614c4918771c7c8f836575c683b
2017-10-03 18:22:43 +01:00
Timo Tijhof
c7d9e79f9e Mark various skin/OutputPage hooks as unabortable
Follows-up I94c7ab656bd1a04. An initial pass of marking various
hooks as unabortable.

* BeforePageDisplay (T173411)
* OutputPageParserOutput
* AfterFinalPageOutput
* SkinTemplateNavigation (T107980)
* SkinTemplateNavigation::SpecialPage (T107980)
* SkinTemplateNavigation::Universal
* PersonalUrls

Bug: T173615
Change-Id: I0cb333dd5ff74f7dca725ff210200a0779a9a360
2017-09-19 19:43:17 +00:00
Matthew Flaschen
b3becd3a61 Add <body> class marking whether RCFilters is enabled
Also added OutputPage->addBodyClasses to allow this

Bug: T175062
Change-Id: I2111d0762328f2e59038c92d63583a9bb267fc9f
2017-09-11 20:27:49 +00:00
Umherirrender
86463f3df6 build: Updating mediawiki/mediawiki-codesniffer to 0.12.0
Change-Id: Iefaae5043fa77d5d556c31079549dab8f61bd3ef
2017-09-10 21:11:37 +02:00
Umherirrender
3f1a52805e Use short type bool/int in param documentation
Enable the phpcs sniffs for this and used phpcbf

Change-Id: Iaa36687154ddd2bf663b9dd519f5c99409d37925
2017-08-20 13:20:59 +02:00
Umherirrender
718e63694d Add missing @param and @return documentation
Change-Id: I1d1098eec3933df6561cceef646576013ddc08c8
2017-08-11 22:17:01 +02:00
Umherirrender
5544cef16b Add missing type to @param documentation
Change-Id: I6b2c9c7af9a281fe457099cc3a336a60a25e74aa
2017-08-11 20:37:35 +02:00
Umherirrender
ace44e2064 Use correct variable name in @param documentation
For some varargs a variable name is added with suffix ,... as seen for
many other varargs

Some @param are swapped, because there are in the wrong order

Enable Sniff MediaWiki.Commenting.FunctionComment.ParamNameNoMatch

Change-Id: I60fec6025bce824d5c67563ab7b65ad6cd628ad8
2017-08-11 19:27:19 +02:00
Umherirrender
a9007e8baf Add missing & to @param documentation to match functon call
Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
2017-08-11 18:47:46 +02:00
Umherirrender
43e8cd0579 Make phpcs pass
Reenable MediaWiki.WhiteSpace.SpaceBeforeClassBrace.NoSpaceBeforeBrace,
because the mentioned bug is fixed

Bug: T172933
Change-Id: I1593bdba2295ebed401b921f2beabed69dba7638
2017-08-11 16:22:42 +02:00
Arlo Breault
3a30e03645 OutputPage: Support HTML5 elements in older browsers using html5shiv
Bug: T122965
Change-Id: Ic11ca687a5459b2dc5d942cf1dc784daa0ddc2f3
2017-08-07 21:56:18 +00:00
Fomafix
b0ae261d2c Use <link rel="license"> instead of <link rel="copyright">
"copyright" is not in the list of the allowed values for the attribut rel:
https://w3c.github.io/html/single-page.html#allowed-keywords-and-their-meanings

Bug: T167284
Change-Id: I09205bb146001d1d1d90e6a0f25d21851f3f697c
2017-07-10 00:48:50 +00:00
Bartosz Dziewoński
70471939f9 Add appropriate OOjs UI icon pack dependencies for OOjs UI itself
Ridiculous? Why yes, yes it is. See T166948.

Bug: T166730
Bug: T166948
Change-Id: I6428ca0d44d8773486230445e466bd5de272e873
2017-06-03 14:15:04 +02:00
Bartosz Dziewoński
c8ad83310f Refactor registration of OOjs UI resource modules
includes/resourceloader/ResourceLoaderOOUIModule.php
* New trait centralizing some logic for dealing with OOjs UI themes,
  previously duplicated in OutputPage, ResourcesOOUI.php and
  ResourceLoaderOOUIImageModule.
* Follow-up change I74362f0fc215b26f1f104ce7bdbbac1e106736ad uses this
  as a base to allow skins/extensions to define new OOjs UI themes.

resources/Resources.php
resources/ResourcesOOUI.php
includes/resourceloader/ResourceLoader.php
* OOjs UI resource module definitions are moved back to their rightly
  place in Resources.php. They are again (almost) normal and static.
* Theme-specific logic is now handled by the module code, definitions
  only specify 'themeScripts'/'themeStyles'/'themeImages'.
* ResourcesOOUI.php is deleted and no longer loaded by ResourceLoader.

includes/resourceloader/ResourceLoaderOOUIFileModule.php
includes/resourceloader/ResourceLoaderOOUIImageModule.php
* Glue code previously existing in ResourcesOOUI.php now lives here.
* Use the ResourceLoaderOOUIModule trait to avoid code duplication.

Change-Id: I39cc2a735d9625c87bf4ede6f5fb0ec441d47dcc
2017-06-01 17:04:05 +02:00
Bartosz Dziewoński
18d8f2aa99 OutputPage: Do not try to load non-existent 'oojs-ui.styles.icons' module
Follow-up to 0f2795d5ba.

Change-Id: I461fb179a494e00a14116361700020da577db494
2017-06-01 17:04:02 +02:00
Timo Tijhof
15ca48adf2 resourceloader: Ensure user.styles and site.styles having their own request
Regardless of whether other modules exist with group=user or group=site,
these two modules in particular must always be in their own request for
legacy reasons.

This has already always been the case because even in the few cases where
an extension uses this group (eg. MobileFrontend's custom site module) it
would load it instead of another module in that group, never at the same
time. There is one notable exception, which is GlobalCssJs. However the
ext.globalCssJs.user.styles module is usually served from another wiki
which is why that went unnoticed as well. This commit fixes that so that
even if you're viewing a page on the central wiki, the modules are still
in separate requests.

Aside from this one existing edge case, there is also need to add
group=site to gadgets by default so that they load after the DynamicStyles
marker instead of before, which is currently causing problems with the
cascading order (gadget apply before core and skin styles due to being
in the same request group and alphabetically sorting before them).

Semantically, the appropiate solution is group=site, but this wasn't
possible due to core putting "all" group=site modules in the same request
(under the assumption there is only one such module). This commit removes
that fragile assumption.

Bug: T147667
Change-Id: I9eb725c083124d22a9af3bf3d075ade6f3b970a3
2017-05-26 14:15:47 +00:00
jenkins-bot
5f764ec180 Merge "Move loading of mediawiki.toc from Parser to Skin" 2017-05-23 18:42:44 +00:00
jenkins-bot
646476af33 Merge "OutputPage: Move hardcoded default modules to Skin::getDefaultModules" 2017-05-23 18:31:20 +00:00
jenkins-bot
cfb04229b2 Merge "resourceloader: Add tests for OutputPage::buildExemptModules" 2017-05-23 01:00:55 +00:00
Timo Tijhof
c7e00974c7 Move loading of mediawiki.toc from Parser to Skin
This was the only addModules() call ever to be inside Parser.
Introduced in a54ef1a203. Prior to that, mediawiki.toc had always been loaded
by OutputPage (via mediawiki.util; and before that, via wikibits).

This patch restores that, and also fixes T130632 by making OutputPage get
it from the Skin, instead of hardcoding this somewhere in addParserOutput().

* Remove deprecated method OutputPage::enableTOC().
* Move mEnableTOC to addParserOutputText().

Bug: T130632
Change-Id: Iaad84d241a4c4348c712ac1087a664b8c9c46da4
2017-05-21 19:06:43 +02:00
Timo Tijhof
0048c3e255 OutputPage: Move hardcoded default modules to Skin::getDefaultModules
These modules should not be hardcoded in OutputPage::output() which
makes them impossible to override and also very hard to retrieve
through the API for action=parse. Move these instead to Skin which
is where all other default module loading happens already.

Moving these modules is in preparation for customising ApiParse
to support "really" returning all would-be loaded modules on a page
when setting 'useskin', which is also needed for Live Preview
and in theory for ajax navigation and other scenarios where there
is a delay between the "initial" page rendering, and a later re-render
which may not have all all the necessary modules.

Bug: T130632
Change-Id: Ic4afccf0cd0d428d7fbc36d4e747415af3ab49f5
2017-05-21 19:06:43 +02:00
Timo Tijhof
8628893d99 resourceloader: Add tests for OutputPage::buildExemptModules
Bug: T147667
Change-Id: I40245359925ef5dc4e01ada396503a758d6b95fe
2017-05-20 18:54:43 +00:00
jenkins-bot
2b5fe6e3f1 Merge "Introduce wgRelevantPageIsProbablyEditable" 2017-05-18 16:01:26 +00:00
James D. Forrester
dbfe9c99d3 Introduce wgRelevantPageIsProbablyEditable
This is equivalent to the existing variable wgIsProbablyEditable and in
keeping with wgRelevantPageName/wgRelevantArticleId; this is done as an
alternative to making a breaking change to the semantics of the former,
as that might cause issues for users who expect wgIsProbablyEditable to
return true on [[Foo]], but false on [[Special:Move/Foo]] and similar.

Change-Id: I6c6ca1cfd93e7be917952980f1e1d57aec3a1292
2017-05-18 15:29:18 +00:00
James D. Forrester
1397b21b84 OutputPage: Remove deprecated addParserOutputNoText, getHeadLinks methods
Change-Id: Idc55e7bb0f7bde8466192a81886f205de60c092c
2017-05-15 13:17:04 +01:00
Gilles Dubuc
13ffd04c5f Toggle logo preloading via the skin
Bug: T100999
Change-Id: I0e18dc7fdbf133f3e4002f48f3040604687571dc
2017-05-02 15:05:11 +02:00
Timo Tijhof
45d8cd2926 Ensure logo preload transforms urls if needed
Follows-up 5f55e9c9c2.

If the logo url is from within /w, then ResourceLoaderSkinModule
will (as it should) apply a file hash query to it.

The preloader didn't do that, so it specified the wrong url.

Refactored SkinModule to make this logic re-usable.

Bug: T100999
Change-Id: I1ba11f7c70d1a725ad72754fee4a3f33c2a4c1be
2017-04-12 21:34:31 +00:00
Fomafix
464f0c72a5 Remove multiple spaces in PHP files
Change-Id: Id9c26ec5ca730a9536f8fdccb8853eb03cbe87a4
2017-04-12 17:27:19 +02:00
jenkins-bot
85fcc8b254 Merge "Preload the logo using link rel="preload" http header" 2017-04-12 06:58:14 +00:00
Gilles Dubuc
5f55e9c9c2 Preload the logo using link rel="preload" http header
This greatly increases the priority of loading
the logo on browsers that support rel="preload".

Bug: T100999
Change-Id: I0738fcc0a575153dab65016fa87faaa9b8b97a9d
2017-04-11 19:08:53 -07:00
jenkins-bot
8ea7953ab5 Merge "Add ?safemode=1 to disable user JS/CSS" 2017-04-10 18:50:19 +00:00
Brian Wolff
14beae88b5 SECURITY: Do not directly redirect to interwikis, but use splash page
Directly redirecting based on a url paramter might potentially
be used in a phishing attack to confuse users.

Bug: T109140
Bug: T122209
Change-Id: I6c604439320fa876719933cc7f3a3ff04fb1a6ad
2017-04-06 13:42:38 -07:00
Roan Kattouw
1a9fb8cb78 Add ?safemode=1 to disable user JS/CSS
Bug: T152169
Change-Id: I112b7abf1cfa1330b2d4e6150018aad14c00b654
2017-03-29 17:01:11 -04:00
Brian Wolff
1c7889446d SECURITY: Disable <html> tag on system messages despite $wgRawHtml = true;
System messages may take parameters from untrusted sources. This
may include taking parameters from urls given by unauthenticated
users even if the wiki is a read-only wiki. Allowing <html> tags
in such a context seems like an accident waiting to happen.

Bug: T156184
Change-Id: I661f482986d319cf41da1d3e7b20a0f028a42e90
2017-03-28 21:51:44 +00:00
James D. Forrester
9635dda73a includes: Replace implicit Bugzilla bug numbers with Phab ones
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.

Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
2017-02-21 18:13:24 +00:00
Timo Tijhof
835833ea8a OutputPage: Log violations of module 'target' filter
Bug: T140675
Change-Id: Icf9a2e72b663e363e8c87d5d464892c2bbbe78b2
2017-02-14 16:25:39 -08:00
Timo Tijhof
adc0e79124 OutputPage: Support UploadPath in testTransformResourcePath()
Updated tests to reflect this use case. Currently we assume all web-accessible
paths within ResourceBasePath (e.g "/w") to exist on disk at the same path
in $IP (e.g. "/var/www/mw").

While in theory any number of web server rewrites or aliases could exist,
there is one case in particular that we should support since the information
is available in the configuration: UploadDir and UploadPath. This path may
be rewritten in a way that varies by wiki in multi-wiki installs that share
the same source code. E.g. a server may rewrite "/w/images" to somewhere
else, which means it will not match the directory on disk that is shared
between wikis.

Bug: T155146
Change-Id: I320478c9c262cc012f08b585b48d290594ec2420
2017-02-11 04:45:15 +00:00
Amir Sarabadani
a1e2f07784 Allow OpenGraph RFDa meta tags
See: http://stackoverflow.com/questions/22350105/whats-the-difference-between-meta-name-and-meta-property
And https://developers.facebook.com/docs/sharing/webmasters#markup

Bug: T51859
Change-Id: Ie8fd697e8588435a69f02e779038ae5a11d67be6
2017-01-25 21:49:55 +03:30
jenkins-bot
ea23bc97ee Merge "Replaced all deprecated Linker methods with proper ones in core(1)" 2017-01-21 19:33:09 +00:00
Yuriy Shnitkovskiy
55667f024d Replaced all deprecated Linker methods with proper ones in core(1)
Change-Id: Ie3a718dc1eae1507f8829fcf419c64c6846d2cb6
2017-01-20 11:46:13 +02:00
jenkins-bot
f8a0ab3d37 Merge "Remove unused $resourceLoader" 2017-01-19 21:07:36 +00:00
addshore
641d24b3b6 Remove unused $resourceLoader
Change-Id: I6b5aebe2c6221ee101ec3bc4c84eafd9aeb7b0e2
2017-01-19 20:51:22 +00:00
Timo Tijhof
d753e330a2 OutputPage: Ignore protocol-relative urls in transformResourcePath()
transformResourcePath is only supposed to be called with something
that starts with a '/' (absolute path from document root).

While the primary caller (CSSMin) only calls this method if the path
makes sense as a local file path, ResourceLoaderSkinModule did not,
and wgLogo may be set to a full url that includes a domain.

While chance made it so that protocol-including urls were already
discarded, protocol-relative urls were mistaken for being a path
inside the file system root with a duplicate slash (e.g.
'//tmp/foo.txt', as 'foo.txt' in /fmp, instead of '/foo.txt' at
http://tmp).

This should be fixed upstream in the wikimedia/relpath library,
but workaround it for now since it really shouldn't be called
with urls in the first place.

Bug: T155310
Change-Id: I9b063f1219ddeca5cc2c8a48832cdf8c9eaffe58
2017-01-18 18:15:01 +00:00
Aaron Schulz
b03b387e5a Include JS variable for NewPP report
Adapted from reverted commit b7c4c8717f.

Bug: T110763
Change-Id: If249b679c534879bfac622592a1d2fa913a0cf9d
2017-01-05 19:11:38 -08:00
Yuriy Shnitkovskiy
b98aa152b3 Avoid passing $this by reference in hooks
Renamed $this passed by reference usages in hooks inside includes directory

Bug: T153505
Change-Id: Ib3e6a288a423958e75b5c1bfe53dc29e0f3fee6d
2017-01-02 01:07:49 +02:00
jenkins-bot
9ac29c74ed Merge "Cleanup some incorrect return annotations" 2016-12-16 07:22:24 +00:00
jenkins-bot
3a2853e218 Merge "Add <!DOCTYPE html> to HTML responses" 2016-12-16 07:16:45 +00:00
Erik Bernhardson
d67197fa11 Cleanup some incorrect return annotations
Most of these are simply changing annotations to reflect
reality. If a function can return false to indicate failure
the @return should indicate it.

Some are fixing preg_match calls, preg match returns 1, 0 or false,
but the functions all claim to return booleans.

This is far from all the incorrect return types in mediawiki, there
are around 250 detected by phan, but have to start somewhere.

Change-Id: I1bbdfee6190747bde460f8a7084212ccafe169ef
2016-12-12 10:15:05 -08:00
Ed Sanders
5ee5ae6f69 Move link-underline user preference rule to body class
ResourceLoaderUserCSSPrefsModule is now empty and can be removed.

Change-Id: I806e117131765b859e990c14735bb9494db9a37e
2016-12-02 11:25:03 -08:00
Yuriy Shnitkovskiy
b0bd03fb13 Replace Linker::link() with LinkRenderer in includes directory
* CategoryViewer
* OutputPage
* Preferences

Bug: T149346
Change-Id: I9f9bcd9b461884817e8ceefbc6757c436221e331
2016-12-01 09:57:05 +02:00
jenkins-bot
2c0db8f5e8 Merge "OutputPage::getCategories(): Add a possibility to distinguish "normal" and "hidden" categories" 2016-11-25 00:17:04 +00:00
Florian
f4b8549f5f OutputPage::getCategories(): Add a possibility to distinguish "normal" and "hidden" categories
There's currently no way to get, e.g., all categories except the
hidden ones just as text. The OutputPage::getCategories() method
always returns all categories as an array of strings (titles) and
the getCategoryLinks() method returns the result of Linker::link
but with the distinction between "normal" and "hidden" categories.

This change adds a new parameter to OutputPage::getCategories(),
$type, which can be used to define, what categories should be
returned. The default value is "all", which means, that all categories
are returned (the current result of the method). With the value
"normal" and "hidden", the method will return the respective values.

This could be used in I97d7de723fe72da26c7dbde0a559a13704c7099a to
remove the stupid Linker::link() and isset workaround.

Change-Id: Iadda9ae362a21fbee770240234b8f55326219932
2016-11-25 00:02:28 +00:00
Bartosz Dziewoński
0e15a6068a Revert "Move NewPP limit report HTML comments to JS variables" and followups
This change resulted in unreasonable feature loss (human-readable
limit report was gone). Three months and multiple followups later,
the functionality is still not completely restored. Given lack
of response from the original author, I think it is time to revert
and reconsider, especially since the 1.28 release is soon.

A machine-readable limit report would be a very useful feature,
but not at the cost of losing human-readable limit report.

This reverts the following commits:

* Move NewPP limit report HTML comments to JS variables
  b7c4c8717f
* Only pretty-print the parser report JS vars
  28adc4d7ee
* Show wgPageParseReport on page previews too
  1255654ed5
* Re-add human readable parser limit report
  0051f108b9
* Restore hooks.txt for ParserLimitReportFormat
  4663e7a737

Resolved minor merge conflicts in OutputPage (with 80e5b160)
and release notes.

Bug: T110763
Bug: T142210
Change-Id: Id88c8066fae3f369e8977b4b7488f67071bdeeb7
2016-11-08 22:35:15 +01:00
jenkins-bot
69ae945e8d Merge "Update weblinks in comments from HTTP to HTTPS" 2016-11-08 21:32:00 +00:00
jenkins-bot
4ac6d60844 Merge "Fix docs for OutputPage::addLanguageLinks and OutputPage::setLanguageLinks" 2016-11-08 03:36:32 +00:00
Leszek Manicki
287bb1a064 Fix docs for OutputPage::addLanguageLinks and OutputPage::setLanguageLinks
Per what has been described and fixed in
Ie9c42ac2b4ff143e36d07642f57cca769e8c00e7.

Change-Id: I2af28ae97805f3259ca038942a84b43f89b55150
2016-11-07 16:18:37 +01:00
Fomafix
202f695f67 Update weblinks in comments from HTTP to HTTPS
Use HTTPS instead of HTTP where the HTTP link is a redirect to the HTTPS link.

Also update some defect links.

Change-Id: Ic3a5eac910d098ed5c2a21e9f47c9b6ee06b2643
2016-11-07 15:24:46 +01: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
Aaron Schulz
919992eece Break long lines in OutputPage::sendCacheControl()
Change-Id: I72d494f4c97aef9d500bb5d7b36dad30a44f501a
2016-11-03 13:06:59 -07:00
jenkins-bot
a6c5f1a815 Merge "Use adaptive CDN TTLs for page views" 2016-10-21 21:55:52 +00:00
Aaron Schulz
4a3e3c95b3 Use adaptive CDN TTLs for page views
This makes frequently changed pages be less likely to be
seen in stale forms if purges are delayed or lost. Pages
that have not been edited for somewhat longer than the
nominal CDN cache TTL will retain the nominal TTL.

Category pages will adapt based on page_touched rather
than the last revision, given the possibility of constaintly
changing membership. With their lesser overall usage,
this is less risky than for Article, and also more useful.

Change-Id: If621aca2fb68e9f87a50c891dac8dc6ec7641f5c
2016-10-20 23:22:31 +00:00
jenkins-bot
e097c61475 Merge "OutputPage: Reduce getTitleInfo() calls (improve preloading)" 2016-10-20 22:18:38 +00:00
Timo Tijhof
458d37f205 OutputPage: Reduce getTitleInfo() calls (improve preloading)
* Remove filter between $moduleStyles and preloadTitleInfo().
  Previously, this was filtering out wiki modules created by
  gadgets and extensions. Still causing a couple of direct queries
  from getTitleInfo().

* Store __METHOD__ in $fname outside getWithSetCallback.
  This way queries are logged as either getTitleInfo or preloadTitleInfo.
  This regressed in 0852a000a5, after which the latter was logged
  as "::{closure}".

Change-Id: I454e43f43f8ad3270b86f4cfdbd68192c305cc07
2016-10-20 21:59:23 +00:00
jenkins-bot
6d9704caef Merge "Relax phpdoc of PermissionError to match actual usage" 2016-10-20 21:16:31 +00:00
Gergő Tisza
d452323171 Relax phpdoc of PermissionError to match actual usage
Also fix OutputPage::showPermissionsErrorPage to handle everything
it claims to handle.

Change-Id: I8ed4a6f2f038fe70084ab673300e24af97e935db
2016-10-18 21:08:41 +00:00
Kunal Mehta
0051f108b9 Re-add human readable parser limit report
This mostly reverts commit 1255654ed5.

This re-adds the human readable parser limit report, and makes a few
adjustments necessary for it to work properly.

* In EditPage::getPreviewLimitReport(), only generate the HTML report,
  the JS variable will be added by OutputPage
* If there are multiple calls to OutputPage::addParserOutputMetadata(),
  only use the limit report data from the first one.
* Only add the wgPageParseReport variable if limit report data is
  available.

Bug: T142210
Change-Id: Iad2646acde79b8a59710bb9fd5fbbfea5a39c341
2016-10-16 03:47:50 +00:00
Florian Schmidt
2d52e36018 Don't use Config as an access method for global objects
The Config interface (and it's implementation(s)) was never thought
to be an access method for objects saved in the global state, even
if it works with the current implementation GlobalVarConfig.

Imagine, that MediaWiki core switches to another file-based configuratiion
storage or a a database based one, we wouldn't be able to provide
access to global objects anymore, without weird hacks in the new
config-backend implementation or serializing objects to store in
the database or something else. This all isn't the idea with the Config
interface, as far as I know, so don't use it at all.

This commit changes the access to wgContLang to use the global keyword,
instead of accessing it through Config.

Follow up: Ice4f40911c3761c2542430935bc1898bc4e7a4d4
Follow up: I46f376a82205a5c99b98c9e971f9e9d7868ce9fb

Change-Id: I7a08b3bb649898abd445317a523051b07420b211
2016-10-04 17:40:35 +02:00
Amir Sarabadani
9850c542c6 Clean up array() syntax in docs, part VII
Last part

Change-Id: I38f015e2122ef4fd2d2141718bd889794c29f06c
2016-09-27 06:53:25 +03:30
Fomafix
e101fa901b Add <!DOCTYPE html> to HTML responses
Change-Id: I080040913c4c9750104bc88b643a1ffdfd222502
2016-09-25 17:36:41 +02:00
Timo Tijhof
1b462e24f6 Clean up misuse of wfTimestampOrNull()
It's primarily meant for nullable timestamps in the database.
And for the mere purpose of an is_null() check, it's more confusion
than useful to cause this function since in these two cases its return
value is not used as-is but further conditionalized.

* Also fix fragile link between getRegistration()'s false return
  value never being passed to wfTimestamp (to mean "now") because
  of the isLoggedIn() guard. The ternary would now make those
  follow the 'else' branch toward null.

Change-Id: I9a1ee2a56e1767bfb750e27b1f37bdaeb5e6378d
2016-09-24 00:09:51 +00:00
Max Semenik
cadd370a4d Remove OutputPage->mDebugtext
Deprecated since 1.20, unused anywhere.

Change-Id: I4316b77c48e65faf788de60be28fc9cf65c785f1
2016-09-20 14:58:04 -07:00
Fomafix
e53ff931ab Apply wfBCP47() to HTTP response header Content-Language
See https://tools.ietf.org/html/rfc7231#section-3.1.3 for Content-Language.
This references https://tools.ietf.org/html/rfc5646 aka BCP 47.

Example:
curl -I https://crh.wikipedia.org/wiki/Ba%C5%9F_Saife | grep -i '^content-language:'
	should contain
Content-language: crh-Latn
	instead of
Content-language: crh-latn

Change-Id: Ice4f40911c3761c2542430935bc1898bc4e7a4d4
2016-09-16 17:43:27 +02:00
Timo Tijhof
dbbc3c2329 OutputPage: Don't set 'user' module state if filtered out
On pages where the 'user' module is filtered out (e.g.
on Special:Preferences) it would export state 'loading' (or state
'ready') eventhough the actual call to makeResourceLoader() later
in getBottomScripts() would be a no-op due to filtering.

This would cause either an indefinite state of "loading" or a
state "ready" that wasn't true.

This restores status quo as it was before 80e5b160 and 3e7a50d5f.

Test plan:
* Logged-in with non-empty user page common.js.
* View Special:Preferences.
* Verify in <head> source code, or via mw.loader.getState('user')
  that it has state "registered" (the default initial state) and
  not state "loading" or "ready".

Change-Id: I9b360d7e12703bddb80793aef47296fd63032c3d
2016-09-14 05:02:22 +00:00
Aaron Schulz
a3dacac90f Support masking the WRITE_SYNC latency from ChronologyProtector
* Use OutputPage::output() as the method to mask latency, since it
  takes a good while to run. By the time it runs, cache replication
  should have caught up, so the reap call will likely not block.
* For redirects emitted after changes in POST, instead of masking
  with OutputPage, add a parameter to the redirect and block on
  the positions appearing. This uses the redirection RTT to mask
  the replication latency.

Change-Id: Ib23690c302e8033610fef9a0ef451dafe8a5803e
2016-09-12 23:58:49 +00:00
Aaron Schulz
6f8dc27ca2 Preload ResourceLoaderWikiModule::getTitleInfo in OutputPage
This avoids a separate query for each module.

Bug: T46362
Change-Id: Ie109a8776cbdcd5928cbb59351f2cf94088c0c95
2016-09-08 14:46:18 -07: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
Aaron Schulz
16266edff3 Change "slave" => "replica DB" in /includes
Change-Id: Icb716219c9335ff8fa447b1733d04b71d9712bf9
2016-09-05 21:01:01 +00:00
Timo Tijhof
ee52872baf OutputPage: Ensure setupSkinUserCss() always applies to headElement()
Follows-up 80e5b160e0, which had to move this call out of the
headElement() and buildCssLinks() methods as it was no longer
allowed to modify the module queue after it was created.

It was moved to OutputPage::output(), right before Skin::outputPage()
is called, which ends up calling headElement().

The point in time was effectively unchanged for page views.

However for the caller in ApiParse() this meant setupSkinUserCss()
no longer got called at all as it never calls output(), but instead
calls headElement() directly.

Move it to getRlClient(), which is where we set all other 
OutputPage-specific things relating to module loading already.

* For page views this has no impact.
* For ApiParse it means headElement(), which calls getRlClient(),
  will once again include skin stylesheets.

Bug: T144301
Change-Id: I5fd4a27fb2d70b98ce9161dc050788d8ac364110
2016-09-03 18:38:49 +00:00
jenkins-bot
4b282b3ffa Merge "Floor slave lag before display" 2016-08-29 23:16:54 +00:00
Timo Tijhof
471adc7ef9 resourceloader: Make 'site.styles' actually in group 'site'
Before 93ed259cf and 7bb7315d4, 'site' and 'site.styles' module were one module
loaded in two parts. One part via the general queue (not in a separate request),
and the other part in the stylesheet queue (in a separate request).

This was achieved by hacking the stylesheet queue handler to hardcode the group
to be 'site' for a module named 'site' (later 'site.styles' in c20a76ee)
eventhough the module as a whole was not actually in that group.

Now that these modules are separated, this hack is no longer needed
and the module can be registered as being in group 'site' properly.

Change-Id: If193f556be211749b115f3808ee46536b578fb22
2016-08-25 13:39:01 -07:00
Fomafix
23fccd2708 OutputPage.php: Reuse existing variable $user
Follows-up to 81c291f2

Change-Id: Id32daf74549c8af886a46119b30ff29ab2a6ac94
2016-08-23 07:12:35 +00:00