Merge "Don't infer parsoid-only parser tests based on presence of parsoid option."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 2 Nov 2018 23:49:50 +0000 (23:49 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 2 Nov 2018 23:49:50 +0000 (23:49 +0000)
RELEASE-NOTES-1.32
RELEASE-NOTES-1.33
composer.json
includes/OutputPage.php
includes/PHPVersionCheck.php
index.php
maintenance/Maintenance.php
mw-config/index.php

index 2cd1222..438fac3 100644 (file)
@@ -607,6 +607,11 @@ because of Phabricator reports.
   OutputPage::addWikiTextAsContent() instead, which ensures the output is
   tidy and clarifies whether content-language specific postprocessing should
   be done on the text.
+* OutputPage::parse() and OutputPage::parseInline() have been deprecated
+  due to untidy output and inconsistent handling of wrapper divs and
+  interface/content language defaults.  Use OutputPage::parseAsContent(),
+  OutputPage::parseAsInterface(), or OutputPage::parseInlineAsInterface()
+  as appropriate.
 * QuickTemplate::msgHtml() and BaseTemplate::msgHtml() have been deprecated
   as they promote bad practises. I18n messages should always be properly
   escaped.
index 9aaf4af..6ded7cb 100644 (file)
@@ -30,6 +30,7 @@ production.
 * …
 
 ==== Changed external libraries ====
+* Updated wikimedia/xmp-reader from 0.6.0 to 0.6.1.
 * …
 
 ==== Removed external libraries ====
@@ -114,11 +115,6 @@ because of Phabricator reports.
   applied for Arabic and Malayalam in the future.  Please enable these on
   your local wiki (if you have them explicitly set to false) and run
   maintenance/cleanupTitles.php to fix any existing page titles.
-* OutputPage::parse() and OutputPage::parseInline() have been deprecated
-  due to untidy output and inconsistent handling of wrapper divs and
-  interface/content language defaults.  Use OutputPage::parseAsContent(),
-  OutputPage::parseAsInterface(), or OutputPage::parseInlineAsInterface()
-  as appropriate.
 * The LegacyHookPreAuthenticationProvider class, deprecated since its creation
   in 1.27 as part of the AuthManager re-write, now emits deprecation warnings.
   This will help identify the issue if you added it to $wgAuthManagerConfig.
index ae9e3ca..867d2ff 100644 (file)
@@ -52,7 +52,7 @@
                "wikimedia/timestamp": "2.2.0",
                "wikimedia/wait-condition-loop": "1.0.1",
                "wikimedia/wrappedstring": "3.0.1",
-               "wikimedia/xmp-reader": "0.6.0",
+               "wikimedia/xmp-reader": "0.6.1",
                "zordius/lightncandy": "0.23"
        },
        "require-dev": {
index aa2afe9..4a9b542 100644 (file)
@@ -2093,7 +2093,7 @@ class OutputPage extends ContextSource {
         * @param Language|null $language Target language object, will override $interface
         * @throws MWException
         * @return string HTML
-        * @deprecated since 1.33, due to untidy output and inconsistent wrapper;
+        * @deprecated since 1.32, due to untidy output and inconsistent wrapper;
         *  use parseAsContent() if $interface is default value or false, or else
         *  parseAsInterface() if $interface is true.
         */
@@ -2114,7 +2114,7 @@ class OutputPage extends ContextSource {
         * @param bool $linestart Is this the start of a line? (Defaults to true)
         * @throws MWException
         * @return string HTML
-        * @since 1.33
+        * @since 1.32
         */
        public function parseAsContent( $text, $linestart = true ) {
                return $this->parseInternal(
@@ -2135,7 +2135,7 @@ class OutputPage extends ContextSource {
         * @param bool $linestart Is this the start of a line? (Defaults to true)
         * @throws MWException
         * @return string HTML
-        * @since 1.33
+        * @since 1.32
         */
        public function parseAsInterface( $text, $linestart = true ) {
                return $this->parseInternal(
@@ -2158,7 +2158,7 @@ class OutputPage extends ContextSource {
         * @param bool $linestart Is this the start of a line? (Defaults to true)
         * @throws MWException
         * @return string HTML
-        * @since 1.33
+        * @since 1.32
         */
        public function parseInlineAsInterface( $text, $linestart = true ) {
                return Parser::stripOuterParagraph(
@@ -2174,7 +2174,7 @@ class OutputPage extends ContextSource {
         * @param bool $interface Use interface language (instead of content language) while parsing
         *   language sensitive magic words like GRAMMAR and PLURAL
         * @return string HTML
-        * @deprecated since 1.33, due to untidy output and confusing default
+        * @deprecated since 1.32, due to untidy output and confusing default
         *   for $interface.  Use parseInlineAsInterface() if $interface is
         *   the default value or false, or else use
         *   Parser::stripOuterParagraph($outputPage->parseAsContent(...)).
index aee2a0c..8406bfb 100644 (file)
  * Check PHP Version, as well as for composer dependencies in entry points,
  * and display something vaguely comprehensible in the event of a totally
  * unrecoverable error.
+ *
+ * @note Since we can't rely on anything external, the minimum PHP versions
+ * and MW current version are hardcoded in this class.
+ *
+ * @note This class uses setter methods instead of a constructor so that
+ * it can be compatible with PHP 4, PHP 5 and PHP 7 (without warnings).
+ *
  * @class
  */
 class PHPVersionCheck {
@@ -41,29 +48,35 @@ class PHPVersionCheck {
        );
 
        /**
-        * @var string Which entry point we are protecting. One of:
-        *   - index.php
-        *   - load.php
-        *   - api.php
-        *   - mw-config/index.php
-        *   - cli
+        * @var string $format The format used for errors. One of "text" or "html"
+        */
+       var $format = 'text';
+
+       /**
+        * @var string $scriptPath
         */
-       var $entryPoint = null;
+       var $scriptPath = '/';
 
        /**
-        * @param string $entryPoint Which entry point we are protecting. One of:
-        *   - index.php
-        *   - load.php
-        *   - api.php
-        *   - mw-config/index.php
-        *   - cli
+        * Set the format used for errors.
+        *
+        * @param string $format One of "text" or "html"
         */
-       function setEntryPoint( $entryPoint ) {
-               $this->entryPoint = $entryPoint;
+       function setFormat( $format ) {
+               $this->format = $format;
        }
 
        /**
-        * Returns the version of the installed PHP implementation.
+        * Set the script path used for images in HTML-formatted errors.
+        *
+        * @param string $scriptPath
+        */
+       function setScriptPath( $scriptPath ) {
+               $this->scriptPath = $scriptPath;
+       }
+
+       /**
+        * Return the version of the installed PHP implementation.
         *
         * @param string $impl By default, the function returns the info of the currently installed PHP
         *  implementation. Using this parameter the caller can decide, what version info will be
@@ -236,14 +249,8 @@ HTML;
         * @return string
         */
        function getIndexErrorOutput( $title, $longHtml, $shortText ) {
-               $pathinfo = pathinfo( $_SERVER['SCRIPT_NAME'] );
-               if ( $this->entryPoint == 'mw-config/index.php' ) {
-                       $dirname = dirname( $pathinfo['dirname'] );
-               } else {
-                       $dirname = $pathinfo['dirname'];
-               }
                $encLogo =
-                       htmlspecialchars( str_replace( '//', '/', $dirname . '/' ) .
+                       htmlspecialchars( str_replace( '//', '/', $this->scriptPath . '/' ) .
                                'resources/assets/mediawiki.png' );
                $shortHtml = htmlspecialchars( $shortText );
 
@@ -308,23 +315,13 @@ HTML;
         * @param string $longHtml
         */
        function triggerError( $title, $shortText, $longText, $longHtml ) {
-               switch ( $this->entryPoint ) {
-                       case 'cli':
-                               $finalOutput = $longText;
-                               break;
-                       case 'index.php':
-                       case 'mw-config/index.php':
-                               $this->outputHTMLHeader();
-                               $finalOutput = $this->getIndexErrorOutput( $title, $longHtml, $shortText );
-                               break;
-                       case 'load.php':
-                               $this->outputHTMLHeader();
-                               $finalOutput = "/* $shortText */";
-                               break;
-                       default:
-                               $this->outputHTMLHeader();
-                               // Handle everything that's not index.php
-                               $finalOutput = $shortText;
+               if ( $this->format === 'html' ) {
+                       // Used by index.php and mw-config/index.php
+                       $this->outputHTMLHeader();
+                       $finalOutput = $this->getIndexErrorOutput( $title, $longHtml, $shortText );
+               } else {
+                       // Used by Maintenance.php (CLI)
+                       $finalOutput = $longText;
                }
 
                echo "$finalOutput\n";
@@ -336,12 +333,13 @@ HTML;
  * Check PHP version and that external dependencies are installed, and
  * display an informative error if either condition is not satisfied.
  *
- * @note Since we can't rely on anything, the minimum PHP versions and MW current
- * version are hardcoded here.
+ * @param string $format One of "text" or "html"
+ * @param string $scriptPath Used when an error is formatted as HTML.
  */
-function wfEntryPointCheck( $entryPoint ) {
+function wfEntryPointCheck( $format = 'text', $scriptPath = '/' ) {
        $phpVersionCheck = new PHPVersionCheck();
-       $phpVersionCheck->setEntryPoint( $entryPoint );
+       $phpVersionCheck->setFormat( $format );
+       $phpVersionCheck->setScriptPath( $scriptPath );
        $phpVersionCheck->checkRequiredPHPVersion();
        $phpVersionCheck->checkVendorExistence();
        $phpVersionCheck->checkExtensionExistence();
index 791ffb1..0df4cd0 100644 (file)
--- a/index.php
+++ b/index.php
@@ -34,7 +34,7 @@
 // dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
 // phpcs:ignore MediaWiki.Usage.DirUsage.FunctionFound
 require_once dirname( __FILE__ ) . '/includes/PHPVersionCheck.php';
-wfEntryPointCheck( 'index.php' );
+wfEntryPointCheck( 'html', dirname( $_SERVER['SCRIPT_NAME'] ) );
 
 require __DIR__ . '/includes/WebStart.php';
 
index c786ce8..e76426d 100644 (file)
@@ -23,7 +23,7 @@
 // Bail on old versions of PHP, or if composer has not been run yet to install
 // dependencies.
 require_once __DIR__ . '/../includes/PHPVersionCheck.php';
-wfEntryPointCheck( 'cli' );
+wfEntryPointCheck( 'text' );
 
 use MediaWiki\Shell\Shell;
 
index a47822b..804d0a1 100644 (file)
@@ -25,7 +25,7 @@
 // dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
 // phpcs:ignore MediaWiki.Usage.DirUsage.FunctionFound
 require_once dirname( __FILE__ ) . '/../includes/PHPVersionCheck.php';
-wfEntryPointCheck( 'mw-config/index.php' );
+wfEntryPointCheck( 'html', dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) );
 
 define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
 define( 'MEDIAWIKI_INSTALL', true );