MediaWiki REL1_31
|
Send information about this MediaWiki instance to MediaWiki.org. More...
Public Member Functions | |
__construct (Config $config=null, LoggerInterface $logger=null) | |
getSystemInfo () | |
Collect basic data about this MediaWiki installation and return it as an associative array conforming to the Pingback schema on MetaWiki (https://meta.wikimedia.org/wiki/Schema:MediaWikiPingback). | |
sendPingback () | |
Send information about this MediaWiki instance to MediaWiki.org. | |
Static Public Member Functions | |
static | schedulePingback () |
Schedule a deferred callable that will check if a pingback should be sent and (if so) proceed to send it. | |
Protected Attributes | |
Config | $config |
string | $id |
Randomly-generated identifier for this wiki. | |
string | $key |
updatelog key (also used as cache/db lock key) | |
LoggerInterface | $logger |
Private Member Functions | |
acquireLock () | |
Acquire lock for sending a pingback. | |
checkIfSent () | |
Has a pingback been sent in the last month for this MediaWiki version? | |
getData () | |
Get the EventLogging packet to be sent to the server. | |
getOrCreatePingbackId () | |
Get a unique, stable identifier for this wiki. | |
markSent () | |
Record the fact that we have sent a pingback for this MediaWiki version, to ensure we don't submit data multiple times. | |
postPingback (array $data) | |
Serialize pingback data and send it to MediaWiki.org via a POST to its event beacon endpoint. | |
shouldSend () | |
Should a pingback be sent? | |
Send information about this MediaWiki instance to MediaWiki.org.
Definition at line 31 of file Pingback.php.
Pingback::__construct | ( | Config | $config = null, |
LoggerInterface | $logger = null ) |
Config | $config | |
LoggerInterface | $logger |
Definition at line 56 of file Pingback.php.
References $config, $logger, RequestContext\getMain(), and key.
|
private |
Acquire lock for sending a pingback.
This ensures only one thread can attempt to send a pingback at any given time and that we wait an hour before retrying failed attempts.
Definition at line 116 of file Pingback.php.
References $cache, DB_MASTER, and wfGetDB().
Referenced by sendPingback().
|
private |
Has a pingback been sent in the last month for this MediaWiki version?
Definition at line 74 of file Pingback.php.
References $dbr, DB_REPLICA, key, and wfGetDB().
Referenced by shouldSend().
|
private |
Get the EventLogging packet to be sent to the server.
Definition at line 169 of file Pingback.php.
References getOrCreatePingbackId(), and getSystemInfo().
Referenced by sendPingback().
|
private |
Get a unique, stable identifier for this wiki.
If the identifier does not already exist, create it and save it in the database. The identifier is randomly-generated.
Definition at line 186 of file Pingback.php.
References $id, DB_MASTER, DB_REPLICA, MWCryptRand\generateHex(), and wfGetDB().
Referenced by getData().
Pingback::getSystemInfo | ( | ) |
Collect basic data about this MediaWiki installation and return it as an associative array conforming to the Pingback schema on MetaWiki (https://meta.wikimedia.org/wiki/Schema:MediaWikiPingback).
This is public so we can display it in the installer
Developers: If you're adding a new piece of data to this, please ensure that you update https://www.mediawiki.org/wiki/Manual:$wgPingback
Definition at line 142 of file Pingback.php.
Referenced by getData().
|
private |
Record the fact that we have sent a pingback for this MediaWiki version, to ensure we don't submit data multiple times.
Definition at line 96 of file Pingback.php.
References DB_MASTER, key, and wfGetDB().
Referenced by sendPingback().
|
private |
Serialize pingback data and send it to MediaWiki.org via a POST to its event beacon endpoint.
The data encoding conforms to the expectations of EventLogging, a software suite used by the Wikimedia Foundation for logging and processing analytic data.
Compare: <https://github.com/wikimedia/mediawiki-extensions-EventLogging/ blob/7e5fe4f1ef/includes/EventLogging.php#L32-L74>
array | $data | Pingback data as an associative array |
Definition at line 228 of file Pingback.php.
References Http\post().
Referenced by sendPingback().
|
static |
Schedule a deferred callable that will check if a pingback should be sent and (if so) proceed to send it.
Definition at line 271 of file Pingback.php.
Pingback::sendPingback | ( | ) |
Send information about this MediaWiki instance to MediaWiki.org.
The data is structured and serialized to match the expectations of EventLogging, a software suite used by the Wikimedia Foundation for logging and processing analytic data.
Compare: <https://github.com/wikimedia/mediawiki-extensions-EventLogging/ blob/7e5fe4f1ef/includes/EventLogging.php#L32-L74>
The schema for the data is located at: https://meta.wikimedia.org/wiki/Schema:MediaWikiPingback
Definition at line 250 of file Pingback.php.
References acquireLock(), getData(), markSent(), and postPingback().
|
private |
Should a pingback be sent?
Definition at line 66 of file Pingback.php.
References checkIfSent().
|
protected |
Definition at line 44 of file Pingback.php.
Referenced by __construct().
|
protected |
Randomly-generated identifier for this wiki.
Definition at line 50 of file Pingback.php.
Referenced by getOrCreatePingbackId().
|
protected |
updatelog key (also used as cache/db lock key)
Definition at line 47 of file Pingback.php.
|
protected |
Definition at line 41 of file Pingback.php.
Referenced by __construct().