Commit graph

101 commits

Author SHA1 Message Date
Alexander Vorwerk aae6e29547 Replace usages of deprecated wfWikiID()
The global function wfWikiID() is deprecated since 1.35 and it's usages
should be replaced with WikiMap::getCurrentWikiId().

Bug: T298059
Change-Id: Idb937a82b08679f6552699ecc4a7ea1da7006e09
2021-12-21 02:32:15 +01:00
Brad Jorsch 602cef87e0 mw.title: Add pageLanguage property
Bug: T161976
Change-Id: Ifc7a462efb11b28f20ebaad5d62cba8f1f1f8e91
2021-12-17 04:10:40 +00:00
Brian Wolff 405045c416 Return correct lua version on windows
For some reason this is hard coded 5.1.4. But if you look at the
included binaries, the windows ones are clearly 5.1.5.

Change-Id: If0e7e6ae47b058b3d425b586955cc87a14b21eb8
2021-11-15 19:33:30 -08:00
Roman Stolar d2c23dd3a3 Override ContentHandler::validateSave instead of Content::prepareSave.
Prepare override for ScribuntoContentHandler, remove usage in ScribuntoContent.

Bug: T287159
Depends-On: I7f23e6e97b1c7d27a6aaefdb88b19b2fc6e8b3a8
Change-Id: I4b9287372a95f4b6178dc321105081552d040ef8
2021-11-11 16:01:05 +00:00
Thiemo Kreuz 51592c654f Add missing & and (int) casts
Bug: T290189
Change-Id: I0bd0d06834f91fbc6a4067987e7e9e9e09b4e740
2021-10-27 17:27:33 +00:00
Roman Stolar 8c66ac25c9 Override ContentHandler::fillParserOutput instead of Content::fillParserOutput.
Prepare override for ScribuntoContentHandler, remove usage in ScribuntoContent.

Bug: T287158
Change-Id: I91f6a077f5cc0de25f83bea26d9f1772af0d3d68
2021-10-19 14:08:17 +00:00
C. Scott Ananian 1af638f8db Replace use of deprecated ParserOutput::addWarning()
Bug: T293515
Depends-On: I6a7c04c67ac586ab00d4edcbb3d09485a7794e23
Change-Id: Ib51c75e38b9bf490b4ded481ee92ede0949f272e
2021-10-16 01:17:20 +00:00
C. Scott Ananian c0963eced7 Replace use of deprecated ParserOutput::{get,set}Flag()
Depends-On: I39bc58d207836df6f328c54be9e3330719cebbeb
Change-Id: I906a5970088965c187bf653267ac4b369dac9b9b
2021-10-15 23:41:06 +00:00
C. Scott Ananian 0453ef6021 Replace use of deprecated ParserOutput::addTrackingCategory()
Depends-On: I697ce188a912e445a6a748121575548e79aabac6
Change-Id: Ie41ad70f1fb5de202355314a96a1243234fb267c
2021-10-13 21:46:57 -04:00
Petr Pchelko ae920ae5b8 Replace deprecated ParserOptions::getUser with ::getUserIdentity
Bug: T292589
Change-Id: I381863a62340292e8bbc7840256f591a31afb42e
2021-10-05 14:48:28 -07:00
Arlo Breault 97cae0d3e0 Apply utf normalize to lua module name in error messages
This previously bypassed normalization because only the "value" part
of the internal exception message was normalized, the "module" part
can be invalid as well since it's derived from the original message.

Similar to Idc5514261e99d64222b86877dd0500d425a26988

Bug: T289358
Change-Id: I1ce09dd521eb80ba0d2fb6f84508a1a77d339496
2021-09-13 19:33:24 +00:00
libraryupgrader 5c63190944 build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.10.6 → 0.11.0
* php-parallel-lint/php-parallel-lint: 1.3.0 → 1.3.1

npm:
* stylelint-config-wikimedia: 0.10.3 → 0.11.1

Change-Id: I82e56565364f0502b0e70fe7414057ae876c0b98
2021-09-11 22:36:44 +00:00
daniel 1a24ade06c Use mock restriction store in tests
This fixes an incompatibility introduced by Ia73ea587586cb69eb5.

Depends-On: I1f24703b80566220ac6fe8ee500e838ed7fd29af
Change-Id: I31ca0a8987f9694bc3b312a48c2c111ceda6fa3e
2021-09-10 14:50:04 +00:00
Func b765524ac8 Handle EditFilterMergedContent hook properly to break hook chains and display error message
Extensions are supposed to return false to break hook chains when failed, which can avoid unnecessary call of later handlers in other extensions and work around with problems caused by difference betwen multiple triggers.

On mediawiki version 1.36 and before, just returning false in this hook can't display error message by default.
Set $status->value manually still to provide backward compatibility.

Bug: T280312
Change-Id: I935eb40d41c4bf9c123e131a54f6bfca2d517450
2021-06-26 12:21:06 +00:00
Alexander Vorwerk 0533aa40ab Avoid using MWNamespace
The MWNamespace class has been deprecated in favor of the NamespaceInfo
service. All methods in the MWNamespace should be replaced with the
equavilent methods of the NamespaceInfo service.

Change-Id: I964d3b191cc3129b8e467e6fbbccd2fcc0b89e11
2021-06-09 01:25:55 +00:00
Umherirrender 87e2d2ed18 Remove PHP 5.3 $this closure workaround
Change-Id: I7f2b71823844e39339811ca4bee316b432b54adb
2021-05-15 02:03:24 +02:00
libraryupgrader 31335d4602 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

npm:
* grunt: 1.3.0 → 1.4.0
* lodash: 4.17.19 → 4.17.21
  * https://npmjs.com/advisories/1673 (CVE-2021-23337)
* hosted-git-info: 3.0.7 → 3.0.8
  * https://npmjs.com/advisories/1677 (CVE-2021-23362)
* postcss: 7.0.35 → 8.2.15
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)

Change-Id: If78d89f465be14d63824f2701daca5a257edba30
2021-05-13 08:26:27 +00:00
Umherirrender d5781bd8a2 build: Swap deprecated @codingStandardsIgnore to phpcs:ignore
Bug: T278594
Change-Id: I33cc55782915f819ca3a05f2c6a535d73ac03e00
2021-04-04 19:06:50 +00:00
Ori Livneh 47f0194c2a Avoid calling into PHP from Lua to check if 'current' or 'empty' frames exist
On the Wikimedia cluster, 1.6% of MediaWiki wall-clock time is burnt on
calls from Lua into Scribunto_LuaSandboxCallback::frameExists()[1]. We
can optimize away many of these calls by not calling into PHP to check
if 'empty' or 'current' exist: the engine always reports that the
'empty' frame exists, and 'current' is guaranteed to have been set up
(in LuaEngine::setupCurrentFrames) prior to calling into Lua.

To help validate this, I added debug logging to the current production
branch of Scribunto[2] to see if there are any cases where
Scribunto_LuaSandboxCallback::frameExists('current') is false. As I
write this commit message, the logging code has been active for 24H and
there have not been any occurrences.

  [1]: https://performance.wikimedia.org/arclamp/svgs/daily/2021-03-16.excimer-wall.all.reversed.svgz
  [2]: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Scribunto/+/672836

Change-Id: I1902b711c9a442a5a42745a582a6a9ff988a355f
2021-03-17 18:04:09 -07:00
vladshapik 7ee79747e8 Avoid using User::getDefaultOption
Remove using of User::getDefaultOption since this method will be hard-deprecated. Now it is soft-deprecated

Bug: T276035
Change-Id: I34a9ece7ee25c8fa85849c9dc8d6634cde53cfe5
2021-03-01 13:19:04 +02:00
C. Scott Ananian 96da9fe0e9 Replace use of Parser::$mStripState, deprecated in 1.35
The replacement, Parser::getStripState(), was added to MediaWiki in
1.34.

The extension.json for this extension already requires MW >= 1.35.

Bug: T275160
Change-Id: I062ac8b69756a7ad35d8cc744b4735fd2e70f13e
2021-02-25 03:03:29 +00:00
Umherirrender 764d265623 Remove wrong return type from ScribuntoEngineBase::reportLimitData
Change-Id: Ide01f5c5a497d6ee9553daaacbf2e098826860f6
2021-02-03 22:10:20 +01:00
Ed Sanders 999ec38d90 Add line link anchors
Bug: T29531
Change-Id: I312169142fa901bb4bd0a359089b90e7b8dc35c5
2021-01-11 19:06:04 +00:00
Ed Sanders 68191f337c Show line numbers on Module pages
Bug: T270991
Depends-On: Ic5d5c341687e965804cb33da07dda23913718ff5
Change-Id: Ifdc2f1527435140caec86dbda68dc73e392a18a9
2021-01-01 19:41:00 +00:00
Ed Sanders 16f2db8987 Use strict equality when comparing namespaces
Change-Id: I15288a83d1ddb3744653077daddd7ebb7e8bba73
2021-01-01 16:44:40 +00:00
libraryupgrader 7e49f2396e build: Updating mediawiki/mediawiki-phan-config to 0.10.6
Change-Id: I400be95d82c6cc5d0473eaba932b34146526eff8
2020-12-30 14:30:00 +00:00
Umherirrender cb39fead91 Add missing @var and improve documentation
Change-Id: Idb7ff848ba702eac2cde31c6198a70311e3bdb69
2020-12-22 01:15:00 +00:00
shubham656 11244fed16 Add length attribute in TitleLibrary.php
Bug: T209679
Change-Id: Ieb7aac0c4131b76ae872151d6f5b815ce9ca3e0a
2020-12-21 09:15:55 +00:00
libraryupgrader 66e8b6a46f build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.10.4 → 0.10.5

npm:
* ini: 1.3.5 → 1.3.7
  * https://npmjs.com/advisories/1589

Change-Id: I334074a31e68cdd8fb4f278fe279d6e1e11d78d6
2020-12-11 16:24:46 +00:00
Derk-Jan Hartman d65c61e49b Error message for formatNum should not refer to formatDate
These new error messages were referring to formatDate instead of
formatNum.

Change-Id: Ic20a5a5515ee55d46087449627138cc779909ec3
Follow-up: Ib7706ad40f7ee2da6ab7c6b2dab6ae8d129dab52
Bug: T268758
2020-11-26 14:12:15 +01:00
libraryupgrader 14046a6414 build: Updating mediawiki/mediawiki-phan-config to 0.10.4
Additionally, unbreak master build after core change T10327.

Change-Id: I8fb240c9b8291d907b857f17d6f4960a24de2ef7
2020-11-20 17:01:25 +00:00
C. Scott Ananian 078253bd06 library: Lua formatNum should check that the value is not infinity or NaN
The core formatNum method only works on strings which pass `is_numeric`,
not NaN and +/- infinity.

Bug: T267587
Change-Id: Ib7706ad40f7ee2da6ab7c6b2dab6ae8d129dab52
2020-11-16 17:44:17 +00:00
Tim Starling eb01c6ad22 Fix invalid UTF-8 in LuaSandbox profiler data
Bug: T228746
Change-Id: Idf5cd4ed230a40f6894ed7b435c28c9ec2764b9b
2020-11-10 15:13:27 +00:00
C. Scott Ananian 7ec0ebfb2a Format Scribunto Lua Preview Limit Report memory numbers in bytes
Makes it consistent with other entries

Bug: T263592
Change-Id: Icc303455feab27966480854ea1c055ceab864ee0
2020-11-05 13:43:27 -05:00
libraryupgrader 00fc2c3f1e build: Updating mediawiki/mediawiki-codesniffer to 33.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic
* MediaWiki.Commenting.PropertyDocumentation.WrongStyle

Additional changes:
* Added the `wikimedia/mediawiki` profile in .eslintrc.json (T262222).
* Added the `wikimedia/jquery` profile in .eslintrc.json (T262222).
* Removed global `$`, included in the `wikimedia/jquery` profile (T262222).
* Removed global `mw`, included via `wikimedia/mediawiki` profile (T262222).
* Dropped the emtpy global definition in .eslintrc.json.

Change-Id: Ib0acbf92bcb8327ecd065db5db1083d7b222976c
2020-11-04 17:24:30 +00:00
Reedy b53689abde Fix double formatting of memory units
Bug: T263592
Change-Id: If8a71419d656530859552abaddeed66d5a9ddc4b
2020-10-23 19:46:57 +00:00
C. Scott Ananian 0cd8904842 Suppress phan false positives in LuaSandboxEngine::formatLimitData()
Most of this function deals with values for the single
scribunto-limitreport-profile key, where $value is an array of
strings.  Phan's security check plugin was getting confused because
*in general* the $value passed to a ParserLimitReportFormat hook can
be almost anything.

Change-Id: I0ef5ef71f00a92bd5db0df340725c88595fcb0c6
2020-10-23 17:02:23 +00:00
C. Scott Ananian 2bec230e3d Use Language::formatNumNoSeparators where appropriate
Avoids using the deprecated $noSeparators parameter to Language::formatNum
in favor of Language::formatNumNoSeparators, which has been around since
MW 1.21.

Change-Id: If3de5645a92514f605d4117fea3a820ed6c86624
2020-09-09 18:17:23 -04:00
libraryupgrader b9c82f4d4a build: Updating mediawiki/mediawiki-phan-config to 0.10.2
Additional changes:
* Removed phan-taint-check-plugin from extra, now inherited from mediawiki-phan-config.

Change-Id: I83fff3a5ff566790bc051d7bfffe7f3b124d3de7
2020-06-02 01:54:01 +00:00
Reedy aeaa5172b9 Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: I50048f917c4b8cde4ebc002ed57f0e0afcf6e8c6
2020-05-30 01:32:16 +01:00
Brad Jorsch 34fc672f6d Add tests and type checking for mw.addWarning()
Testing was overlooked when this was added in Ibdd2506f.

Change-Id: Ie17020e3082668180dfa1d6532946891ea7951ea
2020-05-08 17:05:11 +00:00
DannyS712 c062595b01 Handle RevisionAccessException with try-catch
Failures caused by a9b073fc62

Bug: T252156
Change-Id: I703c2e0b13e79716f156e1c995fd139fbc68e321
2020-05-07 20:57:42 +00:00
DannyS712 a9b073fc62 Remove use of Parser::fetchCurrentRevisionOfTitle and Revision::getSha1
Use new fetchCurrentRevisionRecordOfTitle

Bug: T249384
Bug: T251233
Change-Id: I9a4974a990f8e4f7935cd8e38da918fd45a2282c
2020-04-28 09:34:26 +00:00
libraryupgrader 9facd741cc build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 29.0.0 → 30.0.0

npm:
* eslint-config-wikimedia: 0.15.0 → 0.15.3
* grunt-stylelint: 0.14.0 → 0.15.0
* stylelint-config-wikimedia: 0.9.0 → 0.10.1

Change-Id: I684372efb0248862700184546a5172bfd6d81ae0
2020-04-22 19:07:11 +00:00
C. Scott Ananian e0837cfd46 Don't use deprecated Parser::OutputType()
Depends-On: I0b4d5f170216597afb259cedbb13b8028d284715
Change-Id: I70e0ecb201d5ffdc3ccb75caf552a1dee4ad9e60
2020-04-17 00:47:42 +00:00
Antoine Musso fda6a663aa Remove trailing newline from log messages
wfDebug() required a newline in the message. That is no need with
wfDebugLog() or with our PSR-3 logging interface.

Bug: T228848
Change-Id: Ieb3de1ab59174ec0e1301e42bccee6cebce8749f
2020-03-23 14:58:33 +00:00
Umherirrender 724c38c892 Use MediaWikiServices::getRepoGroup
This required MediaWiki 1.34

Change-Id: Ie7186b0729b54ef9a52b18bb6a2a2696dca6daed
2020-03-16 17:58:49 +00:00
Umherirrender 92587641dc Use MediaWikiServices::getContentLanguage()
This required MediaWiki 1.32

Change-Id: Iff717eba8f4fad1e80229ebcf317ceec81667846
2020-03-16 17:58:26 +00:00
DannyS712 fb850e853c Don't fall back to global $wgUser when creating ParserOptions
Pass a user when relevant, or use ParserOptions::newFromAnon()

Bug: T246861
Change-Id: I44adb6d5c037de2fb05573cde3c7356cb73e8b42
2020-03-07 02:33:24 +00:00
DannyS712 d1f6e793ee Stop using old deprecated SpecialPageFactory static functions
Bug: T245686
Change-Id: If4d166c9a95bb9381ea4de560168f5d9d683d6f5
2020-02-19 23:12:56 +00:00