Commit graph

2062 commits

Author SHA1 Message Date
Umherirrender
06947613d7 maintenance: Use namespaced classes
This does not include use of MediaWiki\Maintenance\Maintenance,
assuming the maintenance scripts going into the same namespace

Change-Id: I488f95b537ce86eb5e463be7bce3653610dd13d9
2024-10-21 19:08:08 +02:00
Umherirrender
f1804bd6d4 language: Use const keyword for mapping of strings
The variables on the converter are not usable outside of the class,
so making the public ones also private.

Change-Id: I6087dcdac761916359009548beb5210671a32ee5
2024-09-17 18:24:55 +00:00
Umherirrender
c8ec25a961 maintenance: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I7dec01892a987a87b1b79374a1c28f97d055e8fa
2024-09-13 19:29:24 +02:00
Umherirrender
be39a18332 build: Use inline ignore for Generic.CodeAnalysis.AssignmentInCondition
Avoid that new code contains this pattern.

Depends-On: I7a9b5c89129fe4b555d03861f2c3ce3e9e2b2446
Depends-On: Ic2bcc7eeb16d3333dcd019bd209bd7fde843dab9
Depends-On: If20eddd8376ae2e8e29c4e56cd51f7b8eb6642b0
Depends-On: I3414f7e17f4bcb801857bc986bae8eb97aa2bfb8
Depends-On: I38b2729418e8389c681c6cd84858f5e5ed25bd3e
Change-Id: I7cfd2e027edd327cf8be6471e348c137fefacda0
2024-09-01 00:15:10 +02:00
Dreamy Jazz
e7393b3cc7 Exclude boilerplate maintenance code from code coverage reports
Why:
* Maintenance scripts in core have bolierplate code that is
  added before and after the class to allow directly running
  the maintenance script.
* Running the maintenance script directly has been deprecated
  since 1.40, so this boilerplate code is only to support a now
  deprecated method of running maintenance scripts.
* This code cannot also be marked as covered, due to PHPUnit
  not recognising code coverage for files.
* Therefore, it is best to ignore this boilerplate code in code
  coverage reports as it cannot be marked as covered and also
  is for deprecated code.

What:
* Wrap the boilerplate code (requiring Maintenance.php and then
  later defining the maintenance script class and running if the
  maintenance script was called directly) with @codeCoverageIgnore
  comments.
* Some files use a different boilerplate code, however, these
  should also be marked as ignored for coverage for the same
  reason that coverage is not properly reported for files.

Bug: T371167
Change-Id: I32f5c6362dfb354149a48ce9c28da9a7fc494f7c
2024-08-27 13:22:29 +01:00
Chiefwei
7816d3e4e8 Chinese Conversion Table Update 2024-3.1
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: I02396a408fb00ef32ddf6d9b164f37dffc3e0dab
2024-08-18 13:35:42 +08:00
Chiefwei
3f579dd6e4 Chinese Conversion Table Update 2024-3
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: I50920b1be658741bfb3643e3992b3ebd6727e0ec
2024-08-11 15:16:55 +00:00
Chiefwei
d4ed98177c Chinese Conversion Table Update 2024-2
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: I4da56d4083406639a41a15de6ed9263411217ac3
2024-06-10 10:09:20 +08:00
Ebrahim Byagowi
a717db8e60 Add namespace and deprecation alias to FormatJson
This patch introduces a namespace declaration for the
MediaWiki\Json to FormatJson and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I5e1311e4eb7a878a7db319b725ae262f40671c32
2024-05-16 16:28:01 +03:30
Chiefwei
7555eb2ef7 Chinese Conversion Table Update 2024-1
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: I71591d77028d818dc20e04b9be4508e74c127f83
2024-02-13 17:26:18 +00:00
Umherirrender
72d6b46339 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statements and changes to docs done manually

Change-Id: I443aada1c18c8628b02671aa9fd6f441961e5c2e
2023-12-11 16:07:18 +01:00
Derick Alangi
74033c50cd maintenance: Begin using Maintenance::getServiceContainer()
Maintenance class provides a method for getting a fresh reference
of the MW services container instance. Let's make use of these in
maintenance scripts now that we have it.

NOTE: There are still some static methods like in refreshLinks.php
that makes use of services that we can't use this method for now.

Change-Id: Idba744057577896fc97c9ecf4724db27542bf01c
2023-09-04 10:39:58 +00:00
Umherirrender
1086958611 Replace array_keys in foreach to use $_ as value instead
When the value of the associated array is not used, there is no need to
use array_keys and create internal a copy of the array, just omit the
value with $_ to tell static analyzer that the var is unused.

Change-Id: I5c6d667e98c0167c0573c683f0d617bc1d4ca619
2023-07-10 02:53:52 +00:00
Daimona Eaytoy
837322a8a9 languages: Prettify ZhConversion.php
Update the python script so that the generated PHP file uses proper
indentation. Correct indentation will be enforced with PHPCS (T319352),
and this file alone is responsible for roughly 20000 violations. Even if
it's automatically generated, to me it seems better to have it comply
with our conventions, rather than excluding it.

Bug: T319352
Change-Id: Iafaca207d21e56257d2e0adec53934855a5a7c2a
2023-07-01 18:18:19 +02:00
Daimona Eaytoy
0d29958cc1 Replace more usages of deprecated MWException
Bug: T328220
Change-Id: Ib619ead0f397188d828e6e5dfc80ed1fa7175c7d
2023-06-08 21:37:07 +00:00
Chiefwei
c40f34c856 Chinese Conversion Table Update 2023-1
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: If2a859cc25bee0c4c3b5024c2ba3a56e23b29509
2023-05-01 18:37:19 +00:00
Tim Starling
be3018b268 Just another 80 or so PHPStorm inspection fixes (#4)
* Unnecessary regex modifier. I agree with this inspection which flags
  /s modifiers on regexes that don't use a dot.
* Property declared dynamically.
* Unused local variable. But it's acceptable for an unused local
  variable to take the return value of a method under test, when it is
  being tested for its side-effects. And it's acceptable for an unused
  local variable to document unused list expansion elements, or the
  nature of array keys in a foreach.

Change-Id: I067b5b45dd1138c00e7269b66d3d1385f202fe7f
2023-03-25 00:39:06 +00:00
Tim Starling
be64d1ac85 Add a maintenance script to merge an extension i18n directory with core
Bug: T28751
Change-Id: Ie8829d521936f10dfbe50cf375b683af2b4f69ab
2023-03-02 21:48:35 +00:00
jenkins-bot
69e40f7be6 Merge "Check return value of XMLReader::open" 2023-02-10 01:35:40 +00:00
Umherirrender
2dff6b74d6 maintenance: Replace deprecated Language::(has|get)Variants
Bug: T252095
Change-Id: Ied99fcad9468dd212093910984827f4c965de24d
2023-01-30 21:41:16 +01:00
Kevin Israel
8c4cea2ca2 Clean up old ICU version checks
Since 1.36, intl has been a required PHP extension, and PHP 7.4 dropped
support for ICU < 50.1 (Unicode 6.2), so:

* In SpecialVersion, don't check whether INTL_ICU_VERSION is defined.

* Remove check in the installer for outdated Unicode normalization. It
  was added over twelve years ago in r70126 (a21fb8651f) with a
  comment that it should be kept up to date, but no one ever did.

* Remove IcuCollation::getUnicodeVersionForICU(), which contained a long
  list of ICU versions and corresponding Unicode versions that had to be
  kept up to date manually. Instead use IntlChar::getUnicodeVersion(),
  which was added in PHP 7.0. There are no known callers outside core.

* Remove LinkFilter::supportsIDN(), as ICU has had support for UTS#46
  since version 4.6. There are no known callers outside core. Also
  remove $flags and $variant from the idn_to_utf8() call, which match
  PHP 7.4's defaults. (INTL_IDNA_VARIANT_2003 was the default in 7.3.)

* Display the ICU and Unicode versions in the installer, just below the
  PHP version. The ICU version is shown on Special:Version near the PHP
  version, and it probably makes sense to show it there as well.

Change-Id: Ibdfac1a6f46fd56b84de1140292e0ec863f043ee
2023-01-26 06:49:13 -05:00
jenkins-bot
104652fdb3 Merge "Chinese Conversion Table Update 2022-2" 2023-01-05 00:10:01 +00:00
Umherirrender
72751cbecb Replace deprecated Language::getMessagesFileName
Bug: T325982
Change-Id: I3c583d7d6914dd46311fd379168ee7dbae71707b
2022-12-28 15:56:30 +00:00
Chiefwei
71f47d912f Chinese Conversion Table Update 2022-2
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: If2f2e3117eb6d5716bcf7bf2fd2409e4fa77382b
2022-12-16 10:36:18 +08:00
Umherirrender
58bd711355 Check return value of XMLReader::open
Change-Id: I623aa515d21726fa201c0bc49ab7c370f72b71ec
2022-11-18 20:19:53 +01:00
Tim Starling
1a2190a1ed Maintenance script updates to support ucfirst() title case
generateUpperCharTable.php: add --title option, which generates the
title case table.

Allow generateUcfirstOverrides.php to take multiple "override" tables

This is to allow MW with PHP 7.4 to act like PHP 7.2 regardless of
whether the MW core title case patch If02247fd15ad2a392a488d is merged.
It's just a union of the result arrays.

Bug: T292552
Change-Id: Id0a727ba3ac714b1198dd7556a3d5d0dd2ca973b
2022-10-13 15:50:20 +11:00
Func
56417313aa Clean up tables of Chinese conversion rules
Most of the changes are generated with the help of my modified version
of Makefile.py and the BCompare software.
Also:
* Rules about 鰛、鳁、鰮 in symme_supp.manual are removed since they are
not one-to-one rules as the file should handle.
* Rules of 乾卦、髮踴沖冠、矇松雨 in tradphrases.manual are removed to fix
the output table.
  To reviewer: You may want to check other terms which are removed from
tradphrases_exclude.manual but still exist in tradphrases.manual.

Since some useless rules are added in recent years, I will upload my
revised version of Makefile.py in a follow-up which can provide warnings
about probably wrong inputs.

Change-Id: I139e26f7b6fc5730ae65474567f5a53c77e3d292
2022-05-22 23:24:45 +08:00
jenkins-bot
a199f2f532 Merge "Chinese Conversion Table Update 2022-1" 2022-05-22 15:02:21 +00:00
Matěj Suchánek
e47c441078 Fix many typos in comments
Found using IntelliJ's "Typo" code inspection.

Change-Id: I746220ebe6e1e39f6cb503390ec9053e6518cf16
2022-05-10 12:46:11 +00:00
Chiefwei
75fc5dd1b9 Chinese Conversion Table Update 2022-1
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: Ie26ebbf60c3cf53814d28e861a5f5bb61e04d7ab
2022-05-08 12:12:38 +08:00
Reedy
8016d7262f maintenance: Replace some usages of Wikimedia\(suppress|restore)Warnings()
Change-Id: Id1a2d0dedd3326083b6a9727f1ab68ddd8f65df8
2022-02-24 12:52:05 +00:00
Chiefwei
1b711fa9a8 Chinese Conversion Table Update 2021-3
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: I504cc826959538703c2b15f7ccc62c544eedafd2
2021-12-26 16:21:59 +08:00
Alexander Vorwerk
3aa5b6643b Use LanguageNameUtils constants instead of strings
Change-Id: I8521d00675008da0d7c8c768ab75352212653c66
2021-12-05 22:13:34 +01:00
Fomafix
ffd3da0068 Fix path for ZhConversion.php
In e07a279a39 ZhConversion.php was moved
from
	languages/data/ZhConversion.php
to
	includes/languages/data/ZhConversion.php

Change-Id: If48e19c89882a72ba130b98cf9f1ef62e2626462
2021-11-20 18:09:34 +00:00
Chiefwei
d1989b857f Chinese Conversion Table Update 2021-2
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: I14fc68ae8f6792e24127aaa93f6fe7aa1f786a26
2021-09-20 12:31:57 +08:00
jenkins-bot
224efbdfe1 Merge "Remove dead variables and functions and unneeded parenthesis" 2021-08-17 07:25:24 +00:00
jenkins-bot
f327fb73bb Merge "Remove trailing dot/space from some exception messages and output strings" 2021-08-16 17:40:55 +00:00
Chiefwei
e46a978f06 Chinese Conversion Table Update 2021-1
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: Ibb306188daa8c1fb97ae45d07f44022c35f46115
2021-08-15 03:39:10 +00:00
Umherirrender
b4bd3d4ee8 Remove dead variables and functions and unneeded parenthesis
Found by sonarqube

Change-Id: I3464d25e94d98aaca55d9209d5175542b335f994
2021-08-13 21:41:59 +02:00
Timo Tijhof
e07a279a39 language: Add MediaWiki\Languages\Data namespace to PSR-4 autoloader
Bug: T225756
Change-Id: I7e30a5f5c9f3c36e8a9e3f1fb6ebebb3bbe727ab
2021-08-10 22:00:25 +00:00
Timo Tijhof
f3ef7f7f23 language: Autoload normalize data and remove transformUsingPairFile compat
* Turn normalize data into an autoloadable class and use the class name
  as key instead of a partial file name with a base directory.

* This protected function is not aimed at re-use in extensions,
  has no other usage known to Codesearch. Mark it internal,
  and remove the compat introduced by 31283f34bf.

* Update the now ten-year-old documentation comments that described
  this as "Temporary". The functionality and comment were introduced
  in 2010 by Tim with r60599 (ad19c032b0).
  Ref <https://bash.toolforge.org/search?p=0&q=temporary>.

* Replace the broken wikitech-l archive link with a working one,
  and describe the thread for easier future reference.

Bug: T225756
Change-Id: I004da1f25c19e1095d0917349f2ba8461f9f0715
2021-08-10 21:03:13 +00:00
Timo Tijhof
9a7c213682 Remove trailing dot/space from some exception messages and output strings
One exception message contained a trailing dot/space, which I removed
as well, following I935835316c0.

A very small number of exceptions and output() calls contained trailing
space, which I removed for consistency.

Change-Id: I16f48c1a051c452bbef699eb9b7476d83f8821d8
2021-08-04 02:38:48 +00:00
Fomafix
ea1b06c150 Fix various typos in documentation
Bug: T201491
Change-Id: Ifa1b84b28ea97dfb4212658b02f24ee6881c1cb0
2021-06-21 00:26:07 +00:00
Tim Starling
9c3c0b704b Use array_fill_keys() instead of array_flip() if that reflects the developer's intention
array_fill_keys() was introduced in PHP 5.2.0 and works like
array_flip() except that it does only one thing (copying keys) instead
of two things (copying keys and values). That makes it faster and more
obvious.

When array_flip() calls were paired, I left them as is, because that
pattern is too cute. I couldn't kill something so cute.

Sometimes it was hard to figure out whether the values in array_flip()
result were used. That's the point of this change. If you use
array_fill_keys(), the intention is obvious.

Change-Id: If8d340a8bc816a15afec37e64f00106ae45e10ed
2021-06-15 00:11:10 +00:00
jenkins-bot
41784a5f5c Merge "Chinese Conversion Table Update 2020-2" 2021-02-21 17:24:51 +00:00
jenkins-bot
d749cbdf38 Merge "Use __CLASS__/::class to define callback for array_map/_filter/usort" 2021-02-05 03:14:42 +00:00
Umherirrender
e4d1a2c8bd Use __CLASS__/::class to define callback for array_map/_filter/usort
Change-Id: I3519dd5a1ce1ea688de602190cd74755c400c717
2021-01-22 16:39:29 +00:00
daniel
47bb958f03 Deprecate premature instantiation of services.
This deprecates access to the global service container before
initialization is complete. For now, such premature access will
trigger a deprecation warning. In 1.37 we can prevent it entirely.

Bug: T153256
Change-Id: Ibd3ab32d92c9c3d3783082ab574739467c1c2ff9
2021-01-19 22:33:13 +01:00
Umherirrender
c85a43561e Improve class property documentation
Reformat existing documentation to match the format

Change-Id: I190b54b5e962f17bab6502dd1b3c02f11dc926d2
2020-10-30 10:38:58 +01:00
Chiefwei
249ce4ef1f Chinese Conversion Table Update 2020-2
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: Ife8aa010d7b1d77c2fe05df4bea856c4f36c464b
2020-08-02 18:14:47 +08:00