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
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
The global function wfLocalFile() is deprecated since 1.34 and unused.
This patch now makes it emit deprecation warnings.
Change-Id: Ib9f94b4f49e7720bd4455d019995037eaa4e3980
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
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
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
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
* 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
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
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
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
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
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
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
* 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