Commit graph

1773 commits

Author SHA1 Message Date
C. Scott Ananian
6859304afc Hard-deprecate OutputPage::enableClientCache()
Code search:
https://codesearch.wmcloud.org/deployed/?q=enableClientCache&i=nope&files=&excludeFiles=&repos=

Depends-On: I91d0b8e8f69a2d309b6fc61e13bfb5d86dc0218d
Depends-On: I0b0cc58f18a47766a174af7f25be51d7630ecb37
Depends-On: I4aff8ceeae7e28a869c8cb60b69f59a4dac48b5d
Depends-On: I70c4b719346b737c801257c37c26997fbbecd27f
Depends-On: Ib195336a8f6bb9f7d4a1344e9dcf3c01dfd5d114
Depends-On: Idf1cf2fac3311f50ed3cbc420f7772b5c71b1992
Depends-On: I7c89e20528a0d91173f0edcb997dcae631935ee5
Change-Id: I3a8a0897ed36dac5927dc7fb3d533cdb12e5136f
2022-02-04 15:51:53 -05:00
C. Scott Ananian
065617f93c Add OutputPage::disableClientCache() and deprecate ::enableClientCache(false)
As far as I can tell, outside of test cases, every single time we call
OutputPage::enableClientCache() we pass it `false` and actually mean to
*disable* the client cache.  Create a new less-confusingly-named method
and deprecate the old one.

Change-Id: I7c89e20528a0d91173f0edcb997dcae631935ee5
2022-02-04 15:51:50 -05:00
jenkins-bot
3776cd2497 Merge "Skins can define bodyClasses at skin registration" 2022-02-04 09:00:04 +00:00
Jon Robson
ad6ac30741 Skins can define bodyClasses at skin registration
Bug: T298734
Change-Id: I55fbe6c8d90fb2c13a5661c4f328f26fa48f1245
2022-02-03 21:16:16 +00:00
Bartosz Dziewoński
59c346f7fc Normalize HTML of page titles using Tidy/Remex
This affects titles set using {{DISPLAYTITLE:…}} and some special pages.

This is a quick-and-dirty stopgap while we work on a proper fix (T299722).

Bug: T298401
Change-Id: Ib2854de808e1235a695ad03808ceac179b7c28da
2022-01-22 01:06:00 +00:00
Siddharth VP
1fa10ef036 resourceloader: Use named constants for groups
Makes the code easier to follow, in particular to identify functionality of the various groups.

Change-Id: Ib2dae5757e9325f9706ff2a9f760f311475fe615
2022-01-19 21:21:00 +00:00
Jdlrobson
07ce31850f Revert "Revert "Categories are modelled as a portlet""
This reverts commit c360439219.

Reason for revert: The issue was fixed elsewhere, see T299352.

Bug: T299352
Bug: T298302
Bug: T298801
Change-Id: I67f699e57e47b36d183e5d90ba407b48dbe5e425
2022-01-18 20:18:36 +00:00
Esanders
c360439219 Revert "Categories are modelled as a portlet"
This reverts commit 0e52aeb356.

Reason for revert: Caused T299352

Bug: T299352
Bug: T298302
Bug: T298801
Change-Id: Id1f7e7d90ca9886c403e4ceb98c3cd6409165d74
2022-01-17 18:35:47 +00:00
jdlrobson
0e52aeb356 Categories are modelled as a portlet
- Skins using SkinMustache will now be able to render
categories as a portlet instead of using html-categories
- Skin::getCategoryLinks is extended to support the
SkinAfterPortlet hook.
	```
$wgHooks['SkinAfterPortlet'][] = function ( $skin, $name, &$html ) {
	if ( $name === 'category-normal' ) {
		$html .= 'I am text after the categories';
	}
};
```
- Links can now be added to the portal via
SkinTemplateNavigation::Universal

Bug: T298302
Bug: T298801
Change-Id: Icfb8da09cd43854d1aa12e10af704047ad222aec
2022-01-11 20:07:58 -08:00
Siddharth VP
38295f9226 Fix typos in comments (N-R)
Change-Id: I2d1bdb7531ff5126114a391550c2615ea6e244b3
2022-01-09 23:14:44 +05:30
Kosta Harlan
891b51b258 Prefer is_dir/is_file to file_exists
Mirco-optimisation for performance, part II.

Change-Id: Ie8d5332a510bd18456ebc4a851f4d47f6a010dcb
2022-01-04 11:03:09 +01:00
Legoktm
93f79a9122 Revert "Replace deprecated methods IContextSource::getWikiPage && IContextSource::canUseWikiPage"
This reverts commit ef458e8948.

Reason for revert: Causes page tabs to disappear on Special:WhatLinksHere.

Bug: T297744
Change-Id: I0ee282a9f7a5a9b2cfdc3261d800d9e27eaf977e
2021-12-14 12:43:15 -08:00
Amir Sarabadani
70acd1dcd4 Reuse the query result in addCategoryLinks instead of relying on cache
This is an implicit logic that it first loads everything as a batch and
then adds them to the LinkCache and then just hopes it works.

During passing arround of Title object, it reaches Title::getArticleID()
(in Title::exists()) and that now reads it from PageStore
(by using ::getFieldFromPageStore) and since the Page object doesn't
exist yet (we only populated the LinkCache), it loads the page again.

Bug: T297669
Change-Id: Icca81c97a15d90f593090711cdccdee3ea404ae2
2021-12-14 09:08:57 +01:00
Amir Sarabadani
9bcd3fdfa5 Remove ActionAjax
Bug: T42786
Change-Id: I8bda0c281e1f4abbffbddb80ac74a6d61a034d28
2021-12-01 22:31:30 +01:00
jenkins-bot
6f210f1128 Merge "Replace deprecated methods IContextSource::getWikiPage && IContextSource::canUseWikiPage" 2021-11-19 15:09:58 +00:00
Roman Stolar
ef458e8948 Replace deprecated methods IContextSource::getWikiPage && IContextSource::canUseWikiPage
Bug: T275710
Change-Id: I74b8f76a525793bc029d9ee1f7297b46ac0a9174
2021-11-16 13:58:39 +02:00
Umherirrender
b9a6c99032 Use WrappedString to build strings in MWDebug
This gives a small performance benefit on developer wikis when the html
page is build.

Change-Id: Ic90bde09500776ae24952d627e582fbce688e36c
2021-11-05 18:33:15 +00:00
jdlrobson
24949480eb Give skins more flexibility over table of contents render
* Do not store table of contents in parser output
* Instead inject table of contents via strpos where needed
  inside Article based on Skin "toc" option
* Use <mw:tocplace> as a TOC placeholder; for Parsoid compatibility
  this will be replaced with a <meta> tag in a followup patch.

Bug: T287767
Change-Id: I44045b3b9e78e7ab793da3f37e3c0dbc91cd7d39
2021-10-25 22:26:41 +00:00
Tks4Fish
76e3701d6a OutputPage: Remove $wgLoggedOutMaxAge experiment and related tests
Bug: T293848
Change-Id: I5e5e52fac7fe389b36715dae11cc30cdb2b9136a
2021-10-25 19:33:32 +00:00
Fomafix
e86f180bd4 Merge "Encode & to &amp; in displaytitle fallback" 2021-10-14 17:58:06 +00:00
Timo Tijhof
d457762706 resourceloader: Remove obsolete logic for handheld=yes pageviews
This feature was removed in 2013 (Ia8d79b4a, T49504), with further
remnants removed in (1965df8df3, I7c24128f7b1).

* Simplify the code of transformCssMedia() as it now only needs to
  support printable=yes.
* Remove query parameter abstraction from test cases, use query
  array directly.
* Remove internal use of the $handheld parameter.
  Function signature of makeLoaderQuery() left in-tact for
  compatibility with $extraData. This will be deprecated and removed
  in a follow-up commit.

Bug: T49504
Bug: T32956
Change-Id: Id16ef3f4630538de1887ac2327eb317c6c6b1f9d
2021-10-09 02:47:39 +01:00
jenkins-bot
e13337b0ca Merge "OutputPage: Remove redundant "rel=edit" head link after "x-wiki" link" 2021-10-08 19:12:38 +00:00
DannyS712
736e00ee8c resourceloader: omit noscript module from client registry
In all cases where the client registry is used, the `noscript` module
is inapplicable. Additionally, make it illegal to have a module
include the 'noscript' module as a dependency.

Bug: T291735
Change-Id: I5846f2c19b003989b56b12628b385fd37049483b
2021-10-07 01:21:02 +00:00
Fomafix
eed3121a8f Encode & to &amp; in displaytitle fallback
The value in the attribute displaytitle must contain valid HTML. The
sanitizer of the {{DISPLAYTITLE}} parser ensures that only valid HTML
is accepted.

If there is no {{DISPLAYTITLE}} in the wikitext then displaytitle
falls back to $title->getPrefixedText(). Here an HTML encoding of
special characters is necessary. This affects only the replacement of
& by &amp; because other special characters like < and > are not
allowed in the title.

This change affects the displaytitle fallback on the following places:
* ApiParse
* ApiQueryInfo
* InfoAction
* Parser

The displaytitle fallback in OutputPage is also updated to this
behavior although
Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags( $html )
also replaces & by &amp;.

Also add test cases with & in the displaytitle to:
* ApiParseTest
* ApiQueryInfoTest
* parserTests

Bug: T291985
Change-Id: I8ee1e2731d9bfa49725d663b34986e7e3073e4ca
2021-10-05 18:09:15 +00:00
C. Scott Ananian
df3cc40fac Rename ParserOutput::{allow,prevent}Clickjacking() -> ::{get,set}PreventClickjacking()
This name is consist with the rest of the setter and getter methods
in ParserOutput.  Renamed the methods in OutputPage, ImageHistoryList,
ImageHistoryPseudoPager, and ContribsPager as well for consistency;
it also makes chasing down lingering references in codesearch easier.

Soft-deprecated the old name for 1.38.  Hard-deprecation will follow,
but there are a number of users in production that should be chased
down first.

Code search:

https://codesearch.https://codesearch.wmcloud.org/deployed/?q=(allow%7Cprevent)Clickjacking&i=nope&files=&excludeFiles=&repos=

Bug: T287216
Change-Id: I9822c60c180d204bd30cb4447a1120155d456da4
2021-10-01 14:13:47 -04:00
Umherirrender
362a48e316 Change null to [] for html attributes on call of Html functions
Change-Id: Ia84f5b1f210396cba5daa7b9e8bb8c4069e0171d
2021-09-22 22:47:28 +02:00
Timo Tijhof
4c7055fcea OutputPage: Remove redundant "rel=edit" head link after "x-wiki" link
Bug: T21165
Change-Id: I53f4b8cfc117012abecdfb5e751886be8ef6cda6
2021-09-21 04:15:22 +01:00
Alexander Vorwerk
c4b2765ebd Avoid using ContentHandler::getContentText()
ContentHandler::getContentText() is deprecated and should be
replaced with Content::getText() for TextContent instances.

Change-Id: I556d3d3f64fafd1d54c4a0c5021efaff2d9c3ce8
2021-09-20 15:32:44 +02:00
Ammarpad
2d18a56d54 Soft deprecate Skin::bottomScripts
Also prepare OutputPage::getBottomScripts to handle the work of
SkinAfterBottomScripts hook in the future.

Bug: T257704
Change-Id: Ib0a8b72faa88259c24b5fb7e9d5a908423494247
2021-09-03 19:26:51 +00:00
jenkins-bot
6b115843ed Merge "Introduce OutputPage::tailElement" 2021-08-30 05:42:33 +00:00
Ammarpad
162b66b245 Introduce OutputPage::tailElement
* SkinMustache::tailElement is removed, SkinMustache now calls
the OutputPage method

Bug: T257704
Change-Id: Ief537d2c317595d192a37e8493369e08e1fb2f45
2021-08-29 11:15:07 +01:00
Timo Tijhof
e387cd9c35 Change trivial use of getVal('action') to getRawVal
Per docs added in I18767cd809f67b, these don't need normalization
as they are only compared against predefined strings, and besides
are generally entered manually in a form, and even then would not
require the kinds of Unicode chars that have multiple/non-normalized
forms.

In nearby areas to also fix some trivial cases:

* getVal('title') obviously needs normalization.
  Use getText() to make this more obvious.

* getVal() compared against simple string literals within the code
  obviously don't need normalization (e.g. printable === 'no').

* Change hot code in MediaWiki checking for whether 'diff' or 'oldid'
  are set to getCheck (which uses getRawVal) instead of getVal.
  As a bonus this means it now handles values like "0" correctly,
  which could theoretically have caused bad behaviour before.

Change-Id: Ied721cfdf59c7ba11d1afa6f4cc59ede1381238e
2021-08-26 22:11:58 +01:00
Kunal Mehta
a85f569dd1 Revert "Use CsrfTokenSet as CSRF token source"
This reverts commit 0d75fdb4f7.

Bug: T287542
Change-Id: Iedd3461869f973f8d621a39e6ad4674cbb577551
2021-08-05 15:48:26 -07:00
Jack Phoenix
b326dd4352 Remove capitalize-all-nouns CSS class support
Functionality has been moved to MonoBook.

Bug: T97892
Change-Id: I3d4d74a2caa77f975b415af5977253ddeff6af21
Depends-On: I598c4469c46d284562ea3aec79330f9a1f40d2ce
2021-07-30 16:59:36 +00:00
jdlrobson
0fc9cf4282 Remove doSetupSkinUserCss and setupSkinUserCss
These methods have been replaced by skin options.
Skins should now declare their style modules in skin.json using
the `styles` option.

Bug: T280610
Change-Id: I24abe7e2539499089e91151d9122e05bcb2d32ca
2021-07-27 08:39:25 -07:00
Derk-Jan Hartman
7b7f3ac563 Disable browser data detection of telephone numbers
Number ranges are common and easily mistaken as telephone numbers by
the data detectors of popular browsers. To link a telephone number,
use the explicit [tel:phonenumber display value] syntax.

If you want to re-enable, set the BrowserFormatDetection configuration
variable to false.

Bug: T256758
Change-Id: I49dff3c084d8c9a66defcdae5a1ffb8f35ba8a93
2021-07-26 09:39:07 +00:00
Petr Pchelko
0d75fdb4f7 Use CsrfTokenSet as CSRF token source
Change-Id: I079d2c802d9b48d6abf7f37fa9ef7dafac631345
2021-07-12 14:19:15 -07:00
Roman Stolar
6ebaa5caf6 Remove the fallback for create rights (covered in PM edit rights check).
Remove key to i18n message, no longer being used.

Bug: T272079
Change-Id: Id6566e5241b06ba377c2eca083221ee02556365f
2021-06-30 17:30:30 +03:00
DannyS712
30c10a2e8d Remove unneeded title casts
Parser::parse() accepts PageReference, and
WikiPage::factory() accepts PageIdentity

Change-Id: If8d15863045d7690fd6d965341ec8564d50db2d7
2021-06-07 13:36:03 +00:00
Mark A. Hershberger
e4a95b9b82
Stop logging and md5'ing if the file does not exist
Also bring this more in line with CSSMin::remapOne()

Bug: T283387
Change-Id: Iea5e68f48be96fae5b5640fe26c2095ca5196e88
2021-05-21 14:31:17 -04:00
daniel
fd2a9bf4a4 resourceloader: Remove Title from public interfaces
Bug: T278459
Depends-On: I9bc371fd299e7a5401ebc1b8d7456d9a4ecde90d
Change-Id: Ib3a0591766f873492ec5a24721e7840f4e1a6407
2021-05-13 10:06:30 +02:00
mainframe98
c87462097c Don't use classes error, success and warning outside parser
Bug: T280766
Change-Id: I83f2828bcde160c98a1d97e783a869e64fb4c6ea
2021-04-27 17:11:14 +02:00
daniel
c1eb74603a Remove Title from public interface of OutputPage
Bug: T278459
Change-Id: If455682540faf8d42fd8a14e0ef09bac24f72db4
2021-04-16 10:01:56 -07:00
mainframe98
20fc80577b Rename $wgSlaveLagWarning and $wgSlaveLagCritical to match DB_REPLICA
These are now named $wgDatabaseReplicaLagWarning and
$wgDatabaseReplicaLagCritical, respectively.

Bug: T277987
Change-Id: I62d8c2028fdfee00904f1058f8387499f2b2e977
2021-03-21 17:58:15 +00:00
jenkins-bot
7cc9b84af9 Merge "Convert second batch of special pages to authority" 2021-03-08 22:33:53 +00:00
Ammar Abdulhamid
242b9b2f6a Enforce concealment of hidden RelevantUser at Skin level
Skin is what takes a user or extract it from a title to set relevant
user and so this is the right place to handle permission check too
because if the user is hidden, it should be made known for all
callers, instead of hoping each caller will do similar check
which is duplication and not guranteed.

Skin:setRelevantUser always takes user and this is now typehinted to
avoid errors. Callers need to give what's required.

Bug: T120883
Change-Id: I177cd83a9c4f87c27a63d8f530c40895d0f3f5dd
2021-03-08 15:38:07 +01:00
Petr Pchelko
bfa145fae7 Convert second batch of special pages to authority
Depends-On: Ifc82d29a00d3fd136c44e0699e6bbfa11b8cf2a6
Change-Id: Iaf559a72cc47ec5d2481d7f740ad0eb303c94002
2021-03-04 15:37:59 -07:00
Petr Pchelko
244bbc8edc OutputPage: move to authority where relevant
Change-Id: Iae42cc747f80cb0215f862d633e9af32fc7c8571
2021-03-04 08:55:20 -07:00
Timo Tijhof
26c9849330 docs: Fix 'dependant' typos
The intended word in all these cases was the adjective "dependent".

Whilst the "dependant" does exist, it is a noun and generally
refers to a person. The word is rare used in general, but
especially so in a technology context.

Change-Id: Ic7e2d2ea6a566f4139ff1fdb77f38b0e962ccd9c
2021-02-18 16:59:20 +00:00
jenkins-bot
5ea464b234 Merge "Use static closures where safe to use" 2021-02-14 23:05:48 +00:00