Commit graph

1653 commits

Author SHA1 Message Date
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
C. Scott Ananian
29546bf612 Hard-deprecate global function wfDiff
Code search: https://codesearch.wmcloud.org/search/?q=wfDiff&i=nope&files=&repos=

Bug: T249061
Followup-To: Ib20a9fbcc2b40e21bc9e99c1197991569b149b00
Change-Id: I2232f7964333c825d80d039fe3a77940fa7271ff
2020-08-19 05:57:59 -04:00
Gergő Tisza
918bab5f1d
Improve wfParseUrl docs
One of the possible fields was omitted.

Change-Id: I18477a515f91acc273017507414d947ce15ded89
2020-08-15 22:18:19 +02:00
Umherirrender
ba216e52e7 includes: Use expression assignment operator += or |= where possible
It is easier to read.

Change-Id: Ia3965b80153d64f95b415c6c30f526efa252f554
2020-07-31 22:26:42 +00:00
jenkins-bot
c64b405758 Merge "GlobalFunctions: Add documentation for replacing wfGetDB" 2020-07-16 12:46:45 +00:00
Amir Sarabadani
e4e81778fa Drop wfWaitForSlaves()
It has been soft deprecated since 1.27 and hard deprecated since 1.35
After the branch cut, this can be removed now.

Bug: T254646
Change-Id: I01e3267de50508e272a56302aae7809d06b66073
2020-07-16 11:26:16 +01:00
Thalia
4a265deb5d GlobalFunctions: Add documentation for replacing wfGetDB
Add a note about the difference between LoadBalancer methods
::getMaintenanceConnectionRef, which wfGetDB returns and
::getConnectionRef, which is more commonly needed when replacing
wfGetDB.

Change-Id: Ic14dcdf7c8af6f20b3a4a697a6c5fbe9a7eb6f2e
2020-07-13 18:00:00 +01:00
Timo Tijhof
ee4819418f GlobalFunctions,WebRequest: Remove use of AtEase for parse_url()
According to php.net docs, the warnings this used to emit have
been removed in PHP 5.3.
<https://www.php.net/manual/en/function.parse-url.php>

Thanks Ammarpad for showing this during development of
Ib829afc7b33419b0.

Change-Id: Ia078049c34f5fc6b1534f0ea0551ecc2c1fc3388
2020-07-08 20:35:16 +00:00
daniel
f59bf8a22f Use @internal instead of @private per policy
https://www.mediawiki.org/wiki/Stable_interface_policy mandates the use
of @internal. The semantics of @private was never properly defined.

Bug: T247862
Change-Id: I4c7c6e7b5a80e86456965521f88d1dfa7d698f84
2020-06-26 14:14:23 +02:00
Tim Starling
d459add63d Introduce wfDeprecatedMsg()
Deprecating something means to say something nasty about it, or to draw
its character into question. For example, "this function is lazy and good
for nothing". Deprecatory remarks by a developer are generally taken as a
warning that violence will soon be done against the function in question.
Other developers are thus warned to avoid associating with the deprecated
function.

However, since wfDeprecated() was introduced, it has become obvious that
the targets of deprecation are not limited to functions. Developers can
deprecate literally anything: a parameter, a return value, a file
format, Mondays, the concept of being, etc. wfDeprecated() requires
every deprecatory statement to begin with "use of", leading to some
awkward sentences. For example, one might say: "Use of your mouth to
cough without it being covered by your arm is deprecated since 2020."

So, introduce wfDeprecatedMsg(), which allows deprecation messages to be
specified in plain text, with the caller description being optionally
appended. Migrate incorrect or gramatically awkward uses of wfDeprecated()
to wfDeprecatedMsg().

Change-Id: Ib3dd2fe37677d98425d0f3692db5c9e988943ae8
2020-06-22 14:34:39 +10:00
DannyS712
733872afda wfLogProfilingData: Remove $request, created but never used
Change-Id: I5c6937c939c699681976e230124a00af10e2cbd0
2020-06-21 07:23:39 +00:00
Timo Tijhof
76b6cfeca9 GlobalFunctions: Use php_uname instead of posix_uname
* posix_uname() is only available when PHP is compiled with
  ext-posix, which MW installer and composer.json do not currently
  require. That's why it was conditionally used (good), but
  we can simply use php_uname() instead and not worry about this.

* php_uname uses POSIX on *nix systems whenever possible
  (even if compiled without ext-posix), and has a C-level fallback
  to ComputerName on Windows built-in as well.

* Remove the fallback to SERVER_NAME was imho quite poor because:
  - The domain name used as virtual host (e.g. on Apache) isn't
    relevant to what wfHostname() is about.
  - It can change from request to request, even influenced by
    end-users, thus could be problematic, poison caches, or behave
    in other unexpected ways.
  - It is unreliable because it is only expected to be set
    on web requests. Even on POSIX or Windows, it would be
    unset when on the command-line, so this would need to use
    an additional fallback either way.

Bug: T172060
Change-Id: I6251122f38db1edf5f85aecc8d8733b56c8222ee
2020-06-14 22:27:45 +00:00