Pingback: Show exactly what data is being sent during the installer
authorKunal Mehta <legoktm@member.fsf.org>
Fri, 22 Jul 2016 21:08:14 +0000 (14:08 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Fri, 22 Jul 2016 21:08:14 +0000 (14:08 -0700)
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

includes/Pingback.php
includes/installer/WebInstallerName.php
includes/installer/i18n/en.json
includes/installer/i18n/qqq.json

index f633029..10d2904 100644 (file)
@@ -115,9 +115,11 @@ class Pingback {
         * 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
+        *
         * @return array
         */
-       private function getData() {
+       public function getSystemInfo() {
                $event = [
                        'database'   => $this->config->get( 'DBtype' ),
                        'MediaWiki'  => $this->config->get( 'Version' ),
@@ -136,11 +138,20 @@ class Pingback {
                        $event['memoryLimit'] = $limit;
                }
 
+               return $event;
+       }
+
+       /**
+        * Get the EventLogging packet to be sent to the server
+        *
+        * @return array
+        */
+       private function getData() {
                return [
                        'schema'           => 'MediaWikiPingback',
                        'revision'         => self::SCHEMA_REV,
                        'wiki'             => $this->getOrCreatePingbackId(),
-                       'event'            => $event,
+                       'event'            => $this->getSystemInfo(),
                ];
        }
 
index 2345d89..e6deed5 100644 (file)
@@ -50,6 +50,11 @@ class WebInstallerName extends WebInstallerPage {
                        wfMessage( 'config-ns-other-default' )->inContentLanguage()->text()
                );
 
+               $pingbackInfo = ( new Pingback() )->getSystemInfo();
+               // Database isn't available in config yet, so take it
+               // from the installer
+               $pingbackInfo['database'] = $this->getVar( 'wgDBtype' );
+
                $this->addHTML(
                        $this->parent->getTextBox( [
                                'var' => 'wgSitename',
@@ -103,7 +108,10 @@ class WebInstallerName extends WebInstallerPage {
                        $this->parent->getCheckBox( [
                                'var' => 'wgPingback',
                                'label' => 'config-pingback',
-                               'help' => $this->parent->getHelpBox( 'config-pingback-help' ),
+                               'help' => $this->parent->getHelpBox(
+                                       'config-pingback-help',
+                                       FormatJson::encode( $pingbackInfo, true )
+                               ),
                                'value' => true,
                        ] ) .
                        $this->getFieldsetEnd() .
index dbe4266..3f3032b 100644 (file)
        "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": "If you select this option, MediaWiki will periodically ping https://www.mediawiki.org with basic data about this MediaWiki instance. 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-pingback-help": "If you select this option, MediaWiki will periodically ping https://www.mediawiki.org with basic data about this MediaWiki instance. 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. The following data will be sent for your system:\n<pre>$1</pre>",
        "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.",
index 6a1dd08..833e7d6 100644 (file)
        "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-pingback-help": "Explains what data will be shared if the user chooses to submit data to MediaWiki.org. $1 is the JSON data that will be sent",
        "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.",