Hello Tim Starling, Krinkle, Brion VIBBER, MaxSem,

I'd like you to do a code review.  Please visit

    https://gerrit.wikimedia.org/r/296699

to review the following change.

Change subject: For discussion: add installer option to share env data with WMF
......................................................................

For discussion: add installer option to share env data with WMF

Log an event containing basic information about MediaWiki's environment if the
user agrees to share data with MediaWiki developers.

The option is checked by default. I think it is innocuous and I'm skeptical
that we'd get good data otherwise.

Change-Id: Ie43a6b46a07ebd9ccc1b9c3001f2ea02435d826b
---
M includes/installer/Installer.php
M includes/installer/WebInstallerName.php
M includes/installer/i18n/en.json
M includes/installer/i18n/qqq.json
4 files changed, 57 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/99/296699/1

diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php
index 4d5aa7a..9f0b32b 100644
--- a/includes/installer/Installer.php
+++ b/includes/installer/Installer.php
@@ -1617,10 +1617,56 @@
                        $this->subscribeToMediaWikiAnnounce( $status );
                }
 
+               if ( $this->getVar( '_Pingback' ) ) {
+                       try {
+                               $this->sendPingback();
+                       } catch ( Exception $e ) { }
+               }
+
                return $status;
        }
 
        /**
+        * 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:MediaWikiInstallPingback>
+        */
+       private function sendPingback() {
+               global $wgVersion;
+
+               $event = [
+                       'schema'           => 'MediaWikiInstallPingback',
+                       'revision'         => 15732959,
+                       'wiki'             => 'Installer',
+                       'event'            => [
+                               'database'  => $this->getVar( 'wgDBtype' ),
+                               'MediaWiki' => $wgVersion,
+                               'PHP'       => PHP_VERSION,
+                               'OS'        => PHP_OS . ' ' . php_uname( 'r' ),
+                               'arch'      => PHP_INT_SIZE === 8 ? 64 : 32,
+                               'curl'      => extension_loaded( 'curl' ),
+                               'machine'   => php_uname( 'm' ),
+                               'webServer' => isset( 
$_SERVER['SERVER_SOFTWARE'] )
+                                       ?  $_SERVER['SERVER_SOFTWARE']
+                                       : PHP_SAPI,
+                       ],
+               ];
+               $json = str_replace( ' ', '\u0020', FormatJson::encode( $event 
) );
+               $url = 'https://www.mediawiki.org/beacon/event?' . 
rawurlencode( $json ) . ';';
+
+               Http::post( $url );
+       }
+
+       /**
         * @param Status $s
         */
        private function subscribeToMediaWikiAnnounce( Status $s ) {
diff --git a/includes/installer/WebInstallerName.php 
b/includes/installer/WebInstallerName.php
index dcd30cf..b6de1fc 100644
--- a/includes/installer/WebInstallerName.php
+++ b/includes/installer/WebInstallerName.php
@@ -100,6 +100,12 @@
                                'label' => 'config-subscribe',
                                'help' => $this->parent->getHelpBox( 
'config-subscribe-help' )
                        ] ) .
+                       $this->parent->getCheckBox( [
+                               'var' => '_Pingback',
+                               'label' => 'config-pingback',
+                               'help' => $this->parent->getHelpBox( 
'config-pingback-help' ),
+                               'value' => true,
+                       ] ) .
                        $this->getFieldsetEnd() .
                        $this->parent->getInfoBox( wfMessage( 
'config-almost-done' )->text() ) .
                        // getRadioSet() builds a set of labeled radio buttons.
@@ -129,7 +135,7 @@
                $retVal = true;
                $this->parent->setVarsFromRequest( [ 'wgSitename', 
'_NamespaceType',
                        '_AdminName', '_AdminPassword', 
'_AdminPasswordConfirm', '_AdminEmail',
-                       '_Subscribe', '_SkipOptional', 'wgMetaNamespace' ] );
+                       '_Pingback', '_Subscribe', '_SkipOptional', 
'wgMetaNamespace' ] );
 
                // Validate site name
                if ( strval( $this->getVar( 'wgSitename' ) ) === '' ) {
diff --git a/includes/installer/i18n/en.json b/includes/installer/i18n/en.json
index 79383f3..59e4ab5 100644
--- a/includes/installer/i18n/en.json
+++ b/includes/installer/i18n/en.json
@@ -196,6 +196,8 @@
        "config-subscribe": "Subscribe to the 
[https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce release 
announcements mailing list].",
        "config-subscribe-help": "This is a low-volume mailing list used for 
release announcements, including important security announcements.\nYou should 
subscribe to it and update your MediaWiki installation when new versions come 
out.",
        "config-subscribe-noemail": "You tried to subscribe to the release 
announcements mailing list without providing an email address.\nPlease provide 
an email address if you wish to subscribe to the mailing list.",
+       "config-pingback": "Share data about this installation with MediaWiki 
developers.",
+       "config-pingback-help": "Selecting this option will submit basic data 
about this MediaWiki instance to the Wikimedia Foundation. This data includes, 
for example, the type of system, PHP version, and chosen database backend. The 
Wikimedia Foundation shares this data with MediaWiki developers to help guide 
future development efforts.",
        "config-almost-done": "You are almost done!\nYou can now skip the 
remaining configuration and install the wiki right now.",
        "config-optional-continue": "Ask me more questions.",
        "config-optional-skip": "I'm bored already, just install the wiki.",
diff --git a/includes/installer/i18n/qqq.json b/includes/installer/i18n/qqq.json
index 69a6830..6a1dd08 100644
--- a/includes/installer/i18n/qqq.json
+++ b/includes/installer/i18n/qqq.json
@@ -214,6 +214,8 @@
        "config-subscribe": "Used as label for the installer checkbox",
        "config-subscribe-help": "\"Low-volume\" in this context means that 
there will be few e-mails to that mailing list per time period.",
        "config-subscribe-noemail": "Error text in MediaWiki installer.",
+       "config-pingback": "Option in the MediaWiki installer to submit data 
about this installation to MediaWiki.org.",
+       "config-pingback-help": "Explains what data will be shared if the user 
chooses to submit data to MediaWiki.org.",
        "config-almost-done": "Status message in the MediaWiki installer.",
        "config-optional-continue": "Option in the MediaWiki installer to make 
a more fine-tuned installation.",
        "config-optional-skip": "Option in the MediaWiki installer to start 
executing the actual installation and stop asking questions.",

-- 
To view, visit https://gerrit.wikimedia.org/r/296699
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie43a6b46a07ebd9ccc1b9c3001f2ea02435d826b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to