Use name constants instead of string literals in calls to Config::get
and ServiceOptions::get, when referring to core configuration variables.
This protects against typos and makes the decumentation and schema
declaration of the config settings discoverable.
This is the first batch, only touching files directly under /includes/
Change-Id: I7252e636c7c86d950d9257b33491af492c6dd5eb
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
* Fix comments at end of lines of code
* Swap ini_get( 'memory_limit' ) comparison to !== and compare to a string
** ini_get returns a string - https://www.php.net/manual/en/function.ini-get.php
Change-Id: I3026578cbe5189fdb703233c25aaa42cfa2cb664
The service has an early return already and the performance overhead
of scheduling, executing and instantiatingn the service and its deferred
update is extremely low.
But, it makes the overall system harder to reason about when execution
always runs through here. And it helps developers to isolate problems
and improve fault tolerance by being able to properly turn this off
if it or its dependencies are causing issues for whatever reason.
The dependencies it uses are quite core to MW, and so their issues
should not be ignored, but it makes the difference between a site
mostly working for readers and a site completely being down, because
on a stock MW install, Pingback is the only feature that uses
DeferredUpdates on regular page views by default.
Bug: T270540
Change-Id: I0d5da6bf3affdf8ab27239ef77fb8cfd87aa70d0
* Inject dependencies from the constructor and use those instead.
* Make getSystemInfo() static since its sole purpose is to collect
global state. This also means it can be safely called from the
Installer without needing to construct this class and its unsafe
dependencies as the Installer was doing previously.
* Remove private 'id' member. This cached the fetchOrInsertId()
return value but was never used.
* Remove selectField() fallback IGNORE-mode insert from fetchOrInsertId().
This existed to handle concurrent writes, but this isn't possible
since all this runs inside a DB_MASTER lock.
* Add missing call to $cache->makeKey().
Avoid passing unformatted strings directly to BagOStuff methods.
Bug: T270540
Change-Id: I984526020ea4d5f0fd6f72b6be527edaf6ab0917
- Arrange the methods in order of execution.
- Provide a single run() entrypoint for testing
(added in the next commit).
Bug: T270540
Change-Id: I27369de38a033397aa15e3a7aba7a034dd1c94f3
All methods got moved to HttpRequestFactory or MWHttpRequest or dropped.
I made the return value of the new HttpRequestFactory::request/get/post
methods null on error instead of false, so that when we drop PHP 7
support, we can use a "?string" return value. This could theoretically
change behavior of code that was switched from the old Http methods, but
probably won't. I kept the old behavior for the deprecated methods.
I changed the default value of $wgHTTPProxy from false to ''. This way
it should be usable directly without a trivial wrapper method. For the
benefit of anyone who might have set it to false in LocalSettings.php, I
also recommend casting to string just in case.
Http::$httpEngine is deprecated. Eventually it will be removed along
with the curl and PHP engines, leaving only the Guzlle engine.
I also added deprecation of MWHttpRequest::factory, which occurred in
1.31, to the release notes for 1.34. Now hopefully we can hard-deprecate
it in another couple of versions.
Bug: T214390
Change-Id: I2a316a758d793857f248bd251b90f5e9a6440e3a
MySQL has its own implementation of upsert(), but the others rely on
$uniqueIndexes being a field list, not a field/value associative array.
The previous code generated an SQL error when checking for existing
values.
Bug: T200864
Change-Id: Ifb56f7f350fbb84144bc6f5a1dd76939816338a6
The current implementation of the pingback feature sends new data on
the first page load after running the update.php maintenance script if
no ping has yet been sent for the wiki's current MediaWiki version.
There is no way by observing the event log to determine if a given wiki
is still operational, since no further pings are sent unless the
MediaWiki version on the wiki changes. Wikis that are created for
testing purposes or that have been decommissioned will continue to live
on in the pingback data.
This patch adds a monthly heartbeat ping. The structure of the heartbeat
ping is identical to the original ping. The heartbeat ping serves not
only to indicate that the wiki is still alive; it will send updated
information, so it will be possible to find out if any of the data, such
as the PHP version or memory limit, has changed since the last ping even
if the MediaWiki version has stayed the same.
Bug: T189785
Change-Id: Ia3077ed02e36eb6ad6ef0ae4d085ecaeb1547a52
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.
The old constant is an alias now.
Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
We have access to all the information that will be transmitted, so for
full transparency, display the actual JSON blob that will be sent.
Change-Id: I7dcc7bafb42619a8d49a27649fd7ac981efcd960
When $wgPingback is true, MediaWiki will periodically ping
https://www.mediawiki.org/beacon with basic information about the local
MediaWiki installation. This data includes, for example, the type of system,
PHP version, and chosen database backend.
The pingback is sent via a deferred (post-send) update whenever $wgVersion
changes, using the updatelog table to ensure we don't send duplicate pingbacks.
A database lock ensures only one thread attempts to send the pingback, and a
cache key throttles attempts to no more than once per hour.
$wgPingback is false by default. The web installer has a checkbox for
controlling this option, and it is checked by default. This nudges new installs
to turn on pingbacks, but does not sneak this decision past sysops of existing
installs.
Change-Id: Ie43a6b46a07ebd9ccc1b9c3001f2ea02435d826b