Commit graph

237 commits

Author SHA1 Message Date
Tim Starling
65b1b6b56a Remove $wgShellLocale, always use C
$wgShellLocale was a flawed solution to the problem of locale
dependence. MediaWiki has its own concept of locale (the Language
hierarchy) and any kind of dependence on the server's libc locale is
incorrect and harmful, leading to bugs. Developers have an expectation
that functions like strtolower() will work in a certain way, and
respecting the locale set in the environment at install time violates
this expectation.

The problems with using C as a locale, which led to $wgShellLocale, are:

* escapeshellarg() will strip non-ASCII characters. This can be worked
  around by not using it. The security vulnerability it was trying to
  fix can be prevented in another way.
* Shell commands like rsvg will fail to correctly interpret UTF-8
  arguments. This is the reason for the putenv(). On Linux, this can
  be fixed by using C.UTF-8, which we didn't know at the time. On
  Windows, the problem is not relevant (there are unrelated issues
  with UTF-8 arguments).

Bug: T291234
Change-Id: Ib5ac0e7bc720dcc094303a358ee1c7bbdcfc6447
2021-09-24 17:25:01 -07:00
Alexander Vorwerk
1a22c1c1d7 Remove global function mimeTypeMatch()
This is done without a deprecation process since the function is
@internal and completely unused outside of core.

Bug: T291341
Change-Id: I4b074f83f9be67b5b5bc2d33b2a6a55bb109a2b3
2021-09-19 19:03:46 +00:00
DannyS712
a2b20b63d7 Emit deprecation warnings reading from $wgUser
With this patch deprecation warnings will be emitted
if $wgUser is accessed or written into. The only pattern
of usage still allowed is

$oldUser = $wgUser;
$wgUser = $newUser;
// Do something
$wgUser = $oldUser;

Once there is no deprecation warnings, we know that nothing
legitimately depends on $wgUser being set, so we can safely
remove the code that's still allowed as well.

Bug: T267861
Change-Id: Ia1c42b3a32acd0e2bb9b0e93f1dc3c82640dcb22
2021-09-15 20:17:04 -07:00
Fomafix
12f9cba673 Rename PHP class RandomPage to SpecialRandomPage
This change is for consistency to the file name and to other classes.

The old class name RandomPage is kept as alias for compatibility and is
now deprecated.

Also change the letter case in the class names and file names:
* SpecialRandompage     -> SpecialRandomPage
* SpecialRandomredirect -> SpecialRandomRedirect
* SpecialRandomrootpage -> SpecialRandomRootPage

The change of the letter case of file names may cause problems on
Windows operating systems.

Change-Id: If4dd23126e0d032f42a86aff7d09414edcb1ade2
2021-09-03 09:26:06 -07:00
DannyS712
57139640c5 phpcs: remove class name exclusion for invalidateUserSessions
Follow-up: I0c0f5c94a7ee0aa3f0aeb8b7f84857022810f17a
Change-Id: I0e24cf641ad16330ee152e80dbcad6a2f71a7001
2021-08-24 11:40:09 +00:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
Umherirrender
7f684ed81c build: Cleanup and improve .phpcs.xml
Use /* at the end of exclude-pattern when excluding the whole folder,
see Id95236edbd3d87f57719d235c7c9cee366180099 for explaination

Remove the file extension when excluding the whole folder,
because it process php files only by the extensions argument set to php

Change-Id: Icaad23ab4b1708a5ce17930f77067ac9224169b5
2021-04-29 20:51:09 +00:00
James D. Forrester
623f80ff04 Follow-up dcdec1a2b: Also update path to file in .phpcs.xml exclusions
Change-Id: I21597266131aca1d0190f4eee4a42fc8335da74b
2021-04-29 13:00:15 -07:00
Reedy
2b40657a36 .phpcs.xml: Replace useage of whitelist in comments
Bug: T277987
Change-Id: I7735279b4dceceb0c9620bb0983ca4839245f194
2021-04-18 16:22:58 +01:00
DannyS712
7aba39a718 Update .phpcs.xml to remove deleted maintenance scripts
Scripts that were removed:
* maintenance/archives/upgradeLogging.php
* maintenance/benchmarks/bench_wfIsWindows.php
* maintenance/minify.php

Change-Id: I05c198e7f1bf8e8f57ba82cce4223fe73c6af3f9
2021-04-14 00:38:20 +00:00
libraryupgrader
649d0cb4f2 build: Updating eslint-config-wikimedia to 0.19.0
Additional changes:
* Dropped .php5 and .inc files from .phpcs.xml (T200956).

Change-Id: I66c9980d3ef6f6604c3145ad0b7f308257dff046
2021-03-12 10:55:29 +00:00
James D. Forrester
bdddfb92ba Drop wgContLang, deprecated in 1.32
Bug: T245940
Depends-On: Ib7fe7318100c0aadc3aa759416bf787913a9b788
Change-Id: I75c3b6715abd5eaf3619337cab8b1844e9a8349a
2021-03-08 13:27:28 -06:00
Umherirrender
393b6fb508 Add missing @param tags in tests
And exclude the rest inline to remove global exclude

Bug: T238572
Change-Id: Ib4c207177dd73702c113e6233f59be6e571a0f6a
2021-02-01 20:38:05 +01:00
Umherirrender
62002cdcf1 build: Update mediawiki/mediawiki-codesniffer to 35.0.0
Change-Id: Idb413be4b8cba8611afdc022af59810ce1a4531e
2021-01-31 13:34:38 +00:00
Reedy
d4a5632307 PHPVersionCheck: Enable Generic.Arrays.DisallowShortArraySyntax
Bug: T273340
Change-Id: Ic24e16897b90b92467a270b5ef64b1a0d7694eb5
2021-01-30 01:30:35 +00:00
C. Scott Ananian
f99a79cef9 phpcs: Ignore LocalSettings-installer.php
The quibble test infrastructure generates LocalSettings-installer.php
during continuous integration testing, and (depending on the exact
set of extensions installed) it could end up violating various sniffs
relating to excess white space.  Easiest just to ignore it.

Change-Id: I34c5783a1bc8c5646fbabafaf442e20c91de41ed
2021-01-12 16:42:02 -05:00
Reedy
b16a862d43 Upgrade doctrine/dbal from 2.10.4 to 3.0.0 for PHP 8.0 support
Some irritating breaking changes, including dropping PHP 7.2 support
and renaming the classes we care about. For now, hack in via || and
some back-compatibility class aliases.

Bug: T270732
Change-Id: I685f099584d2f0e5fa17f1f4275eab5289c7bfee
2020-12-23 02:24:31 +00:00
Umherirrender
49efbfe2fb Improve documentation about object to be stdClass or specific type
Some classes still needs exclude for the sniff

Change-Id: I9536c2ee84f6fb4c83cf862a152cf6b00344cb97
2020-11-20 14:47:56 +00:00
Daimona Eaytoy
4f2692a056 Kill tests/phan
As per comments on phabricator, the Suppressor was used when phan still
didn't have per-line suppression, which is no longer the case. The phan
script was also outdated and broken, so just remove everything.

Bug: T267859
Change-Id: Ic4a68dd30a4481656a5c44b2446cf851ea638c1c
2020-11-17 16:04:33 +01:00
Umherirrender
d53f786a80 build: Updating mediawiki/mediawiki-codesniffer to 33.0.0
Change-Id: I4dbe8ce6f130fe6631e6329ba972d1569741e072
2020-11-02 02:05:02 +01:00
jenkins-bot
3c262bffdf Merge "Make unit tests assertion about assertNotEquals more strict" 2020-11-02 00:37:36 +00:00
Umherirrender
bdf8cefaf8 Make unit tests assertion about assertNotEquals more strict
Originally an autofix of PHPUnitAssertEquals sniff, but manually
updated.

Change-Id: I78efc6f7997f0b7227b40d7eab1495cc7a1d7da5
2020-11-01 23:12:06 +00:00
jenkins-bot
0ea13bb963 Merge "Improve class property documentation" 2020-10-30 17:12:33 +00: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
Umherirrender
448d2f4d51 Avoid local variable with wg prefix
Change-Id: Ib32cc0db07636238aa0b4f8ea7f8c1ae37084889
2020-10-28 22:21:24 +01:00
Umherirrender
d621adbcb6 build: Updating mediawiki/mediawiki-codesniffer to 32.0.0
Exclude failing sniff to fix in follow ups
Includes some simply fix, most are autofix

Change-Id: I5bb4743f08618bb6226bc2a4cc7f4d73a7ad142d
2020-10-28 20:06:22 +00:00
jenkins-bot
b1308abc3d Merge "maintenance: Move cleanupTable from .inc to .php" 2020-09-29 06:07:39 +00:00
James D. Forrester
7282ea26a4 maintenance: Move commandLine from .inc to .php
… and fix the name to match the class.

Bug: T184782
Change-Id: Id3d0d0a6b3f2da6316d18eb57804c5a2b697108b
2020-09-28 15:03:05 +00:00
James D. Forrester
74ee16732e maintenance: Move cleanupTable from .inc to .php
… and fix the name.

Bug: T184782
Change-Id: I670af00baed690ef57413e721b8f5f615ea46502
2020-09-25 17:36:39 +01:00
James D. Forrester
be448ac1b2 maintenance: Move sqlite from .inc to .php
Bug: T184782
Change-Id: I18fabbcc8588518f5cc10c8e3f0fba2379263c6c
2020-09-25 17:36:38 +01:00
James D. Forrester
4272da2c62 maintenance: Move sqlite.php to SqliteMaintenance.php to match class name
Change-Id: I4d6be08082fd1841d3056a0554376e8e9665b429
2020-09-25 17:36:36 +01:00
James D. Forrester
562f0fa8fb maintenance: Move userDupes from .inc to .php
Bug: T184782
Change-Id: I99056b21664a460ec2b16899e7cfa617511b7d0b
2020-09-23 11:59:41 +01:00
James D. Forrester
edc2b8d323 maintenance: Move CodeCleanerGlobalsPass from .inc to .php
Bug: T184782
Change-Id: Ifefeb88e3e84eff909ad56aef630b94df8250429
2020-09-23 11:59:41 +01:00
James D. Forrester
f08389d910 phpcs: Drop exceptions for /maintenance/language/languages.inc, deleted
Dropped in cdfd1e1891.

Bug: T184782
Change-Id: I7c42c2b4ebfb8018841e88b799523bf07e8d4110
2020-09-23 11:59:41 +01:00
James D. Forrester
52b1b16148 phpcs: Drop exceptions for maintenance/language/checkLanguage.php, deleted
Dropped in 3af1ef9c0e.

Bug: T184782
Change-Id: Ia31a30faffdead4f95bc3afe56081e61a914de19
2020-09-23 11:59:41 +01:00
Timo Tijhof
10bdad0d35 Remove $wgMemc
Deprecated since 1.35, and no longer used in core, bundled, or
wmf-deployed projects.

Bug: T160813
Change-Id: Idd3166ef90d1795a0b22dc29d52de76048d0703e
2020-07-27 23:45:22 +00:00
DannyS712
631578c685 Remove old references to AdminSettings, which was removed in 1.23
Change-Id: I90575b6af120bf73c3be71ca6bffafe09b9b2c83
2020-07-13 08:15:03 +00:00
Daimona Eaytoy
50c990fcda phpcs: Enable PSR2.Classes.ClassDeclaration.InterfaceWrongIndent
This reverts commit ef7af6ea77.

Reason for revert: the rule is now working thanks to T243598.

Bug: T243529
Change-Id: I2e7e4e684adf74efdac3d23ceffc9958447998c5
2020-05-30 15:16:43 +00:00
Daimona Eaytoy
2b37cfaf18 build: Bump mediawiki-codesniffer to 31.0.0
Done with `composer fix` and suppressing the rest (i.e. sniffs for
global variables, which for core should be suppressed anyway).

Additionally, add `-p` to `phpcbf`, as otherwise it just seems stuck.

Change-Id: Ide8d6cdd083655891b6d654e78440fbda81ab2bc
2020-05-30 14:56:28 +00:00
Reedy
3b94e2af1c Narrow MediaWiki.Commenting.FunctionComment.WrongStyle
Change-Id: I95d1195f09a806910559a0c5106d472addd3dec4
2020-05-20 03:33:39 +01:00
jenkins-bot
2839f771d8 Merge "Remove MediaWiki.Commenting.IllegalSingleLineComment.* exclusions" 2020-05-19 22:33:03 +00:00
Reedy
a71112ca5e Remove MediaWiki.Commenting.IllegalSingleLineComment.* exclusions
IllegalSingleLineCommentEnd and IllegalSingleLineCommentStart don't
require any fixes, core is clean

Change-Id: Id4771b829d2f126b953bb312104a4d861703eb14
2020-05-19 22:36:13 +01:00
Reedy
efa1f43a0b Final Squiz.Scope.MethodScope.Missing commit
Change-Id: I12c3705af348f91ea1f175028d2360209df18d75
2020-05-19 04:08:56 +01:00
Reedy
1c009dffe4 Fix the rest of includes/specials/ Squiz.Scope.MethodScope.Missing
Change-Id: Ica6397199603f2979b8c863a1f250da2edd77ba5
2020-05-18 21:21:25 +00:00
Reedy
161baa43dd Fix includes/media/ Squiz.Scope.MethodScope.Missing
Change-Id: I2bf5543b99dc2ae05f7de02940d120dee353adfe
2020-05-18 21:02:22 +00:00
Reedy
af063dd794 Fix more Squiz.Scope.MethodScope.Missing
Change-Id: I44cd7ba39a898a27f0f66cf34238ab95370d2279
2020-05-18 21:02:14 +00:00
Reedy
a5a6cc3495 Fix more Squiz.Scope.MethodScope.Missing
Change-Id: If48a16c4c1139342d597c2f6204348c1070dfc71
2020-05-18 20:42:50 +00:00
Reedy
98a2ef8608 Fix more Squiz.Scope.MethodScope.Missing
Change-Id: I271362623760be8d3aa3cffa84026e72c5d1b52a
2020-05-18 20:42:42 +00:00
Reedy
51d3ade7d4 Fix more Squiz.Scope.MethodScope.Missing
Member variables in HistoryBlobStub have been marked protected

SpecialPage::setListed() and listed() have been deprecated

CategoryPage::getCategoryViewerClass() and setCategoryViewerClass()
have been deprecated

Change-Id: Id1f530c2c8ec1171615f726dc7446431ee7ca8fe
2020-05-18 20:35:38 +00:00
Reedy
384d84ffa8 Narrow Squiz.Scope.MethodScope.Missing to match current reality
Change-Id: I54b7d0eb96e3151f58e861fdaf954df2ea7c3878
2020-05-17 17:29:34 +01:00