Commit graph

1664 commits

Author SHA1 Message Date
Petr Pchelko
66e58d1ea7 wfParseUrl: rely on parse_url for proto-relative urls
On July 12 2011 in df2306b97 Roan added this workaround
for parse_url lacking support for protocol-relative URLs.

In 2012 PHP 5.4.7 came out, that added support for
protocol-relative URLs to parse_url, see [1].

It's 2021, and after a decade of honorably serving our
community, this workaround can be now be retired.

It's not a simple deletion since we have custom 'delimiter'
bit that wfParseUrl returns, and we need to keep supporting
that.

[1] https://bugs.php.net/bug.php?id=62844
Change-Id: If9b3bb2a51afa7af1ba8e674eadaa8db4f6f33f9
2021-10-18 20:30:29 -07:00
Timo Tijhof
df32228920 profiler: Remove dependency on WebRequest from Profiler
I intent to remove Profiler::getContext/setContext after a week
without deprecation. I consider these methods as internal (they
predate the stable interface policy, and we forgot to triage this
class, it has neither `@stable` nor `@internal`).

The hard-deprecation in this commit is to detect any use that may
have gone unnoticed in WMF production from Codesearch analysis alone,
where no usage was found.

Bug: T292269
Change-Id: Id40679f21cc7a3f77a1b96a4bbd55daeaea16892
2021-10-09 03:00:45 +00:00
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
jenkins-bot
0220465fb6 Merge "Soft deprecate wfReadOnly() and wfReadOnlyReason()" 2021-09-20 06:04:40 +00: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
Alexander Vorwerk
5097461939 Soft deprecate wfReadOnly() and wfReadOnlyReason()
Bug: T283978
Change-Id: I4362ba6a6f0cf016d5d63404335d8fa35073f991
2021-09-19 10:49:28 +00:00
Umherirrender
07b499fbcf build: Update mediawiki/mediawiki-phan-config to 0.11.0
Addition and remove of suppression needs to be done with the version
update.

Change-Id: I3288b3cefa744b507eadebb67b8ab08c86517c1c
2021-09-07 17:19:05 +02:00
Umherirrender
032b03dc7a Remove unneeded variable assignment
The variable already has the value

Change-Id: I75f25cc944e30d91a65e1d2bb0abce7d671b19b8
2021-09-03 22:51:22 +00:00
Timo Tijhof
837923941d debug: Return early in wfDeprecated(), and improve docs
Change-Id: I1e0832190a440b4c0cd0f725ed72bb883cd7cd9f
2021-09-02 02:57:47 +00:00
Alexander Vorwerk
b88ec6ac24 Remove global function wfDiff(), deprecated since 1.25 and unused
Bug: T249061
Change-Id: I7ebb3611d1bd57c47c98c8dd07ad232c8c7e6c67
2021-07-23 12:23:40 +00:00
ZabeMath
ec4e84953c Hard deprecate global function wfGetLB()
The global function wfGetLB() is deprecated since 1.27
and unused. This patch now makes it emit deprecation
warnings.

Depends-On: I5c719f5f96ced15ffd027b5d0d6fe1a41d2a61b9
Change-Id: I95bd3c7ec31625170fd7e8e2ff6017676a425dae
2021-07-20 18:28:42 +01:00
jenkins-bot
ad09b01fda Merge "Remove comments that repeat the code" 2021-06-02 10:06:20 +00:00
DannyS712
5c079ebc78 Fix documentation of wfTimestampOrNull
Can return null, per the documentation block and the code itself,
or false if wfTimestamp() returns false, but the @return tag
says its always a string.

Also clarify wfTimestamp() documentation that it returns
a string or false, never true.

Change-Id: I67340ad9316e1150ad2e7c2eb71d9b90112b69d2
2021-06-02 09:13:00 +00:00
DannyS712
c80841f58b Remove comments that repeat the code
Don't provide any addition information

Change-Id: I4f474537056e34bac74b0d0cd5b4beb800664f90
2021-06-02 08:03:09 +00:00
Alexander Vorwerk
e1dd5e0f2d Hard deprecate global function wfFindFile()
The global function wfFindFile() is deprecated since 1.34 and unused.
This patch now makes it emit deprecation warnings.

Depends-On: Idbb4762ee3097884eee234633fecf2e363cbdcd4
Change-Id: I419310f8507f3a8a1d8cf385ca51954623a8d814
2021-05-18 15:17:13 +00:00
Alexander Vorwerk
65015ad2d8 Hard deprecate global function wfLocalFile()
The global function wfLocalFile() is deprecated since 1.34 and unused.
This patch now makes it emit deprecation warnings.

Change-Id: Ib9f94b4f49e7720bd4455d019995037eaa4e3980
2021-05-18 14:59:25 +00:00
Alexander Vorwerk
d9ed4f6153 Remove global function wfGetRusage()
wfGetRusage() is deprecated since 1.35 and unused.

Change-Id: I0f4678555f069beafcfd580bdd374cd56a8439ed
2021-05-16 18:44:38 +02:00
James D. Forrester
f2f9345e39 Replace uses of DB_MASTER with DB_PRIMARY in documentation and local variables
This is just a start.

Bug: T254646
Change-Id: I9213aad4660e27afe7ff9e5d2e730cbf03911068
2021-05-14 12:40:34 -07:00
James D. Forrester
269e7e1d44 Drop global function wfNegotiateType, deprecated in 1.36
No uses known in code search.

Bug: T264984
Change-Id: Ia69d3a11653671d46e71f9248e0e62445f4f9d54
2021-05-10 15:09:49 -07:00
James D. Forrester
0b6ba3566f Drop global function wfGetPrecompiledData, deprecated in 1.36
No uses known in code search.

Bug: T264985
Change-Id: I023c6006aaf756b22805f648db41c3b55c8b9534
2021-05-10 15:08:40 -07:00
James D. Forrester
b7ff9dfe0c Drop global function wfConfiguredReadOnlyReason, deprecated in 1.36
No uses known in code search.

Bug: T264979
Change-Id: Ifcc375333fb5b1e46b9198462d67d34673b92e5f
2021-05-10 15:07:17 -07:00
James D. Forrester
cd9cf8d081 Drop global function wfDebugMem, deprecated in 1.36
No uses known in code search.

Bug: T264976
Change-Id: I9f7553ea405cc096a1d6596e1d6511e7dd634009
2021-05-10 15:05:45 -07:00
James D. Forrester
dbc55642c1 Drop global function wfAcceptToPrefs, deprecated in 1.36
No uses known in code search.

Bug: T264983
Change-Id: Iecbd1843f53c5a824a6948d97eca4c0e9da8f208
2021-05-10 15:04:03 -07:00
ZabeMath
e6640038ee Drop global function wfAppendToArrayIfNotDefault, deprecated in 1.36
No uses known in code search.

Bug: T264975
Change-Id: I5e739d8de4a4739c0d7014439f3d49ee67addc16
2021-05-10 14:55:31 -07:00
DannyS712
5e5b5b196b Remove uses and hard deprecate wfCanIPUseHTTPS
Bug: T281598
Change-Id: I4685674921eb68f8fb540607d88d07416749bc1c
Depends-on: Ic86d68d5b328e84cdb6a0cc9f1b6adfd2ac0a604
2021-04-30 19:09:20 +00:00
DannyS712
c6216377bb Remove deprecated https-related hooks
All hard deprecated in 1.35
* BeforeHttpsRedirect
* CanIPUseHTTPS
* UserRequiresHTTPS

Also soft deprecate the wfCanIPUseHTTPS
method, which always returns true. Will
be hard deprecated once callers are updated

Change-Id: Ie6d71809d09edf6be9b8280debeb152ef7fce398
2021-04-30 11:53:18 -07:00
jenkins-bot
b92d5e0e0e Merge "Document methods that may return StubUserLang instead of Language" 2021-04-30 04:36:32 +00:00
Taavi Väänänen
eab7fc0618 Hard deprecate wfIncrStats
Bug: T250316
Change-Id: I49b62cdad5e70ef2e96bfec3bd589ca285406564
2021-04-20 18:05:20 +00:00
Ammarpad
ed6450374b Document methods that may return StubUserLang instead of Language
Typehinting parameters that take the return value of these methods
with Language is not safe as they may return global $wgLang which
may or may not be instance of Language.

Bug: T278429
Change-Id: Ia5a71e4c39124f4427bd816e6e19207bb371cc6b
2021-04-19 12:50:14 +00:00
Reedy
fb771021ea Use some more neutral language
Bug: T277987
Change-Id: Ieceb01f7a61693a0f03cc331213cb8f93163b8e9
2021-04-18 16:49:36 +01:00
Tim Starling
bcec556b77 Don't send headers on ob_end_clean()
Replace the global variable hack in wfResetOutputBuffers() with a check
for the PHP_OUTPUT_HANDLER_CLEAN flag in the $phase parameter, available
since PHP 5.4.0. Aaron's Content-Length patch will work if applied on top
of this.

Bug: T278579
Change-Id: I9ec12f499821826038a39ebe94eed136f123b078
2021-04-08 11:26:06 +10:00
Reedy
cce3fb49d0 Use more neutral or alternative language
Bug: T277987
Change-Id: Iafc4b3e3137936046487119b7e17635f4e560277
2021-03-20 19:47:18 +00:00
Ammarpad
a0d6a4ccd1 wfDeprecated: Use InvalidArgumentException for invalid arguments
Change-Id: I0bf84810cee8c8aa4ca15b7f94fa9467a52b0278
2021-03-12 02:11:04 +00:00
Umherirrender
8de3b7d324 Use static closures where safe to use
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.

Created by I25a17fb22b6b669e817317a0f45051ae9c608208

Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
2021-02-11 00:13:52 +00:00
Tim Starling
2697837fd8 RequestTimeout library integration
* Add $wgRequestTimeLimit. If it is non-null, it starts a time limit,
  using Excimer with a fallback to set_time_limit().
* Add pretty formatting of timeout exceptions thrown by the library.
  Related refactoring.
* Expose the library's critical section feature in MediaWikiServices
* In Setup.php, call warnIfHeadersSent() before sending session headers.
  This helped to debug a related issue I had.
* In wfTransactionalTimeLimit() use the new library, and respect the
  existing library time limit if it is larger than
  $wgTransactionalTimeLimit.

Bug: T269326
Depends-On: I6409ad8a5cba775c27b0d5a79d3300c4dac4c91a
Change-Id: I2e6f6351c451407c06cc7e20932548f7b62e36b6
2021-02-08 11:58:45 +11:00
jenkins-bot
c8b1375fb9 Merge "Use short array syntax to add array element" 2021-01-02 09:55:52 +00:00
Ammarpad
9efb07c9d2 Use short array syntax to add array element
The short syntax is faster and recommended over the method call

Change-Id: I18a3adcfa66abe5eadb834c0b23b54c6853b8c91
2021-01-02 08:20:24 +01:00
jenkins-bot
72ab56471d Merge "Soft deprecate wfIncrStats()" 2020-12-30 16:15:46 +00:00
Taavi Väänänen
c572e6f0ee Soft deprecate wfIncrStats()
Bug: T250316
Change-Id: I10c4f476392a933ac53ac4379edf60477ede1261
2020-12-29 16:12:45 +02:00
Taavi Väänänen
b8d9f54028 Remove hard deprecated wfIsBadImage()
Bug: T249459
Change-Id: I363ec383295aff8a2d6cc89b1f0df5369a537473
2020-12-29 15:55:10 +02:00
DannyS712
f4e21014ce Deprecate a bunch of global functions
* wfAcceptToPrefs
* wfClearOutputBuffers
* wfConfiguredReadOnlyReason
* wfDebugMem
* wfGetPrecompiledData
* wfNegotiateType

Bug: T264976
Bug: T264979
Bug: T264981
Bug: T264983
Bug: T264984
Bug: T264985
Change-Id: Ia05bc84e4d1be7c8a02472f32e2c009e4bb32032
2020-12-18 21:34:50 +00:00
Umherirrender
2579ca623a build: Updating mediawiki/mediawiki-codesniffer to 34.0.0
Change-Id: I2fb18ddd4c144655a665792901e59f88bcd906dc
2020-12-07 14:55:24 +01:00
Ammar Abdulhamid
e69efdaaca Deprecate wfAppendToArrayIfNotDefault
No known remaining caller. Last usage removed in I1ce51f6

Change-Id: Ife783173fb777c7fc8f33478e80b52a09168373e
2020-12-03 08:58:01 +01:00
Timo Tijhof
ea586cfa2e GlobalFunctions: Unbreak handling of '?0' query in wfAssembleUrl()
Follows-up Ief9c15cc8fe0fcae07d2c.

Bug: T268852
Change-Id: I5ddac943aad4d634ea20cd4d4cb21d1c857c05fd
2020-11-26 23:45:45 +00:00
Máté Szabó
44516c671c wfAssembleUrl: Handle empty query field in URL bits
parse_url() on PHP >= 8 will include an empty 'query' bit for input URLs that
end in '?' and have no query string, such as 'http://www.example.com/foo?'.
This causes the parser test for T4372 to break. Accordingly, fix wfAssembleUrl()
to not generate a query string if the input query field is empty.

Bug: T268852
Change-Id: Ief9c15cc8fe0fcae07d2cc3120db9ca95573324c
2020-11-26 22:47:25 +01:00
Aaron Schulz
d1d952473c Remove deprecated wfMemcKey() function
Bug: T266502
Change-Id: I1e4b20cc30fa3ef4671d8b80e660b2ac3f469d80
2020-11-23 16:57:06 -08:00
Thiemo Kreuz
1fc8d79ac6 Remove documentation that literally repeats the code
For example, documenting the method getUser() with "get the User
object" does not add any information that's not already there.
But I have to read the text first to understand that it doesn't
document anything that's not already obvious from the code.

Some of this is from a time when we had a PHPCS sniff that was
complaining when a line like `@param User $user` doesn't end
with some descriptive text. Some users started adding text like
`@param User $user The User` back then. Let's please remove
this.

Change-Id: I0ea8d051bc732466c73940de9259f87ffb86ce7a
2020-10-27 19:20:26 +00:00
Aaron Schulz
369a953e85 Remove deprecated wfForeignMemcKey()
Bug: T250407
Change-Id: Ie9352d297382689a2fc2634e1160d7fe7b91e89b
2020-10-26 19:33:29 +00:00
Ammar Abdulhamid
c0c8dad053 Deprecate Skin::makeVariablesScript()
Bug: T257995
Change-Id: I9789bb1a209a8f07cb2bb07140f2cc4fd778436a
2020-09-21 20:02:13 +00:00
jenkins-bot
2cc3d4f0ba Merge "Hard-deprecate global function wfDiff" 2020-08-19 15:13:12 +00:00