Merge "Use imported namespaces, don't fully qualify"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 18 Mar 2016 18:15:39 +0000 (18:15 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 18 Mar 2016 18:15:39 +0000 (18:15 +0000)
14 files changed:
RELEASE-NOTES-1.27
includes/DefaultSettings.php
includes/EditPage.php
includes/Sanitizer.php
includes/Setup.php
includes/jobqueue/JobRunner.php
includes/skins/Skin.php
includes/specials/SpecialUploadStash.php
includes/user/User.php
languages/i18n/en.json
tests/parser/parserTest.inc
tests/parser/parserTests.txt
tests/phpunit/includes/deferred/LinksUpdateTest.php
tests/phpunit/includes/parser/NewParserTest.php

index 45b06e9..4d7f444 100644 (file)
@@ -10,6 +10,9 @@ As of 1.27, MediaWiki now requires PHP 5.5.9 or higher. This corresponds with
 HHVM 3.1.
 
 === Configuration changes in 1.27 ===
+* $wgAllowMicrodataAttributes and $wgAllowRdfaAttributes were removed,
+  now always enabled. If you use RDFa on your wiki, you now have to explicitly
+  set $wgHtml5Version to 'HTML+RDFa 1.0' or 'XHTML+RDFa 1.0'.
 * $wgUseLinkNamespaceDBFields was removed.
 * Deprecated $wgResourceLoaderMinifierStatementsOnOwnLine and
   $wgResourceLoaderMinifierMaxLineLength, because there was little value in
index c09f2af..63d04c9 100644 (file)
@@ -3081,10 +3081,11 @@ $wgHtml5 = true;
 
 /**
  * Defines the value of the version attribute in the &lt;html&gt; tag, if any.
- * If $wgAllowRdfaAttributes is true, and this evaluates to boolean false
- * (like if it's left at the default null value), it will be auto-initialized
- * to the correct value for RDFa+HTML5.  As such, you should have no reason to
- * ever actually set this to anything.
+ *
+ * If your wiki uses RDFa, set it to the correct value for RDFa+HTML5.
+ * Correct current values are 'HTML+RDFa 1.0' or 'XHTML+RDFa 1.0'.
+ * See also http://www.w3.org/TR/rdfa-in-html/#document-conformance
+ * @since 1.16
  */
 $wgHtml5Version = null;
 
@@ -3105,17 +3106,6 @@ $wgHTMLFormAllowTableFormat = true;
  */
 $wgUseMediaWikiUIEverywhere = false;
 
-/**
- * Enabled RDFa attributes for use in wikitext.
- * NOTE: Interaction with HTML5 is somewhat underspecified.
- */
-$wgAllowRdfaAttributes = false;
-
-/**
- * Enabled HTML5 microdata attributes for use in wikitext.
- */
-$wgAllowMicrodataAttributes = false;
-
 /**
  * Should we try to make our HTML output well-formed XML?  If set to false,
  * output will be a few bytes shorter, and the HTML will arguably be more
index 3268700..520ca57 100644 (file)
@@ -530,11 +530,12 @@ class EditPage {
                if ( $permErrors ) {
                        wfDebug( __METHOD__ . ": User can't edit\n" );
                        // Auto-block user's IP if the account was "hard" blocked
-                       $user = $wgUser;
-                       DeferredUpdates::addCallableUpdate( function() use ( $user ) {
-                               $user->spreadAnyEditBlock();
-                       } );
-
+                       if ( !wfReadOnly() ) {
+                               $user = $wgUser;
+                               DeferredUpdates::addCallableUpdate( function () use ( $user ) {
+                                       $user->spreadAnyEditBlock();
+                               } );
+                       }
                        $this->displayPermissionsError( $permErrors );
 
                        return;
@@ -1735,7 +1736,9 @@ class EditPage {
 
                if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) {
                        // Auto-block user's IP if the account was "hard" blocked
-                       $wgUser->spreadAnyEditBlock();
+                       if ( !wfReadOnly() ) {
+                               $wgUser->spreadAnyEditBlock();
+                       }
                        # Check block state against master, thus 'false'.
                        $status->setResult( false, self::AS_BLOCKED_PAGE_FOR_USER );
                        return $status;
index d52bc07..d321e9f 100644 (file)
@@ -363,14 +363,14 @@ class Sanitizer {
         * @return array
         */
        public static function getRecognizedTagData( $extratags = [], $removetags = [] ) {
-               global $wgAllowMicrodataAttributes, $wgAllowImageTag;
+               global $wgAllowImageTag;
 
                static $htmlpairsStatic, $htmlsingle, $htmlsingleonly, $htmlnest, $tabletags,
                        $htmllist, $listtags, $htmlsingleallowed, $htmlelementsStatic, $staticInitialised;
 
                // Base our staticInitialised variable off of the global config state so that if the globals
                // are changed (like in the screwed up test system) we will re-initialise the settings.
-               $globalContext = implode( '-', compact( 'wgAllowMicrodataAttributes', 'wgAllowImageTag' ) );
+               $globalContext = $wgAllowImageTag;
                if ( !$staticInitialised || $staticInitialised != $globalContext ) {
                        $htmlpairsStatic = [ # Tags that must be closed
                                'b', 'bdi', 'del', 'i', 'ins', 'u', 'font', 'big', 'small', 'sub', 'sup', 'h1',
@@ -386,10 +386,10 @@ class Sanitizer {
                        $htmlsingleonly = [ # Elements that cannot have close tags
                                'br', 'wbr', 'hr'
                        ];
-                       if ( $wgAllowMicrodataAttributes ) {
-                               $htmlsingle[] = $htmlsingleonly[] = 'meta';
-                               $htmlsingle[] = $htmlsingleonly[] = 'link';
-                       }
+
+                       $htmlsingle[] = $htmlsingleonly[] = 'meta';
+                       $htmlsingle[] = $htmlsingleonly[] = 'link';
+
                        $htmlnest = [ # Tags that can be nested--??
                                'table', 'tr', 'td', 'th', 'div', 'blockquote', 'ol', 'ul',
                                'li', 'dl', 'dt', 'dd', 'font', 'big', 'small', 'sub', 'sup', 'span',
@@ -734,15 +734,13 @@ class Sanitizer {
         * @todo Check for unique id attribute :P
         */
        static function validateAttributes( $attribs, $whitelist ) {
-               global $wgAllowRdfaAttributes, $wgAllowMicrodataAttributes;
-
                $whitelist = array_flip( $whitelist );
                $hrefExp = '/^(' . wfUrlProtocols() . ')[^\s]+$/';
 
                $out = [];
                foreach ( $attribs as $attribute => $value ) {
-                       # allow XML namespace declaration if RDFa is enabled
-                       if ( $wgAllowRdfaAttributes && preg_match( self::XMLNS_ATTRIBUTE_PATTERN, $attribute ) ) {
+                       # Allow XML namespace declaration to allow RDFa
+                       if ( preg_match( self::XMLNS_ATTRIBUTE_PATTERN, $attribute ) ) {
                                if ( !preg_match( self::EVIL_URI_PATTERN, $value ) ) {
                                        $out[$attribute] = $value;
                                }
@@ -817,15 +815,14 @@ class Sanitizer {
                        $out[$attribute] = $value;
                }
 
-               if ( $wgAllowMicrodataAttributes ) {
-                       # itemtype, itemid, itemref don't make sense without itemscope
-                       if ( !array_key_exists( 'itemscope', $out ) ) {
-                               unset( $out['itemtype'] );
-                               unset( $out['itemid'] );
-                               unset( $out['itemref'] );
-                       }
-                       # TODO: Strip itemprop if we aren't descendants of an itemscope or pointed to by an itemref.
+               # itemtype, itemid, itemref don't make sense without itemscope
+               if ( !array_key_exists( 'itemscope', $out ) ) {
+                       unset( $out['itemtype'] );
+                       unset( $out['itemid'] );
+                       unset( $out['itemref'] );
                }
+               # TODO: Strip itemprop if we aren't descendants of an itemscope or pointed to by an itemref.
+
                return $out;
        }
 
@@ -1561,12 +1558,9 @@ class Sanitizer {
         * @return array
         */
        static function setupAttributeWhitelist() {
-               global $wgAllowRdfaAttributes, $wgAllowMicrodataAttributes;
-               static $whitelist, $staticInitialised;
+               static $whitelist;
 
-               $globalContext = implode( '-', compact( 'wgAllowRdfaAttributes', 'wgAllowMicrodataAttributes' ) );
-
-               if ( $whitelist !== null && $staticInitialised == $globalContext ) {
+               if ( $whitelist !== null ) {
                        return $whitelist;
                }
 
@@ -1586,23 +1580,24 @@ class Sanitizer {
                        'aria-labelledby',
                        'aria-owns',
                        'role',
-               ];
 
-               if ( $wgAllowRdfaAttributes ) {
-                       # RDFa attributes as specified in section 9 of
+                       # RDFa
+                       # These attributes are specified in section 9 of
                        # http://www.w3.org/TR/2008/REC-rdfa-syntax-20081014
-                       $common = array_merge( $common, [
-                               'about', 'property', 'resource', 'datatype', 'typeof',
-                       ] );
-               }
+                       'about',
+                       'property',
+                       'resource',
+                       'datatype',
+                       'typeof',
 
-               if ( $wgAllowMicrodataAttributes ) {
-                       # add HTML5 microdata tags as specified by
+                       # Microdata. These are specified by
                        # http://www.whatwg.org/html/microdata.html#the-microdata-model
-                       $common = array_merge( $common, [
-                               'itemid', 'itemprop', 'itemref', 'itemscope', 'itemtype'
-                       ] );
-               }
+                       'itemid',
+                       'itemprop',
+                       'itemref',
+                       'itemscope',
+                       'itemtype',
+               ];
 
                $block = array_merge( $common, [ 'align' ] );
                $tablealign = [ 'align', 'valign' ];
@@ -1773,8 +1768,6 @@ class Sanitizer {
                        'link' => [ 'itemprop', 'href' ],
                ];
 
-               $staticInitialised = $globalContext;
-
                return $whitelist;
        }
 
index f26d789..2585738 100644 (file)
@@ -443,15 +443,6 @@ $wgHtml5 = true;
 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
 $wgJsMimeType = 'text/javascript';
 
-if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
-       // see http://www.w3.org/TR/rdfa-in-html/#document-conformance
-       if ( $wgMimeType == 'application/xhtml+xml' ) {
-               $wgHtml5Version = 'XHTML+RDFa 1.0';
-       } else {
-               $wgHtml5Version = 'HTML+RDFa 1.0';
-       }
-}
-
 // Blacklisted file extensions shouldn't appear on the "allowed" list
 $wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) );
 
index ef3d61d..0a0a7a2 100644 (file)
@@ -506,7 +506,7 @@ class JobRunner implements LoggerAwareInterface {
 
                $ms = intval( 1000 * $dbwSerial->pendingWriteQueryDuration() );
                $msg = $job->toString() . " COMMIT ENQUEUED [{$ms}ms of writes]";
-               $this->logger->warning( $msg );
+               $this->logger->info( $msg );
                $this->debugCallback( $msg );
 
                // Wait for an exclusive lock to commit
index b80788b..3cc1d8f 100644 (file)
@@ -451,7 +451,7 @@ abstract class Skin extends ContextSource {
        }
 
        /**
-        * @return string
+        * @return string HTML
         */
        function getCategoryLinks() {
                global $wgUseCategoryBrowser;
@@ -542,25 +542,27 @@ abstract class Skin extends ContextSource {
        }
 
        /**
-        * @return string
+        * @return string HTML
         */
        function getCategories() {
                $out = $this->getOutput();
-
                $catlinks = $this->getCategoryLinks();
 
-               $classes = 'catlinks';
-
                // Check what we're showing
                $allCats = $out->getCategoryLinks();
                $showHidden = $this->getUser()->getBoolOption( 'showhiddencats' ) ||
                                                $this->getTitle()->getNamespace() == NS_CATEGORY;
 
+               $classes = [ 'catlinks' ];
                if ( empty( $allCats['normal'] ) && !( !empty( $allCats['hidden'] ) && $showHidden ) ) {
-                       $classes .= ' catlinks-allhidden';
+                       $classes[] = 'catlinks-allhidden';
                }
 
-               return "<div id='catlinks' class='$classes' data-mw='interface'>{$catlinks}</div>";
+               return Html::rawElement(
+                       'div',
+                       [ 'id' => 'catlinks', 'class' => $classes, 'data-mw' => 'interface' ],
+                       $catlinks
+               );
        }
 
        /**
index 2e622e1..199eebd 100644 (file)
@@ -369,13 +369,14 @@ class SpecialUploadStash extends UnlistedSpecialPage {
 
                $context = new DerivativeContext( $this->getContext() );
                $context->setTitle( $this->getPageTitle() ); // Remove subpage
-               $form = new HTMLForm( [
+               $form = HTMLForm::factory( 'ooui', [
                        'Clear' => [
                                'type' => 'hidden',
                                'default' => true,
                                'name' => 'clear',
                        ]
                ], $context, 'clearStashedUploads' );
+               $form->setSubmitDestructive();
                $form->setSubmitCallback( [ __CLASS__, 'tryClearStashedUploads' ] );
                $form->setSubmitTextMsg( 'uploadstash-clear' );
 
index 09124bf..831966e 100644 (file)
@@ -3989,6 +3989,7 @@ class User implements IDBAccessObject {
                if ( $this->isLoggedIn() && $this->isBlocked() ) {
                        return $this->spreadBlock();
                }
+
                return false;
        }
 
index 5b32b97..b27aee4 100644 (file)
        "recentchangeslinked-page": "Page name:",
        "recentchangeslinked-to": "Show changes to pages linked to the given page instead",
        "recentchanges-page-added-to-category": "[[:$1]] added to category",
-       "recentchanges-page-added-to-category-bundled": "[[:$1]] and {{PLURAL:$2|one page|$2 pages}} added to category",
+       "recentchanges-page-added-to-category-bundled": "[[:$1]] and [[Special:WhatLinksHere/$1|{{PLURAL:$2|one page|$2 pages}}]] added to category",
        "recentchanges-page-removed-from-category": "[[:$1]] removed from category",
-       "recentchanges-page-removed-from-category-bundled": "[[:$1]] and {{PLURAL:$2|one page|$2 pages}} removed from category",
+       "recentchanges-page-removed-from-category-bundled": "[[:$1]] and [[Special:WhatLinksHere/$1|{{PLURAL:$2|one page|$2 pages}}]] removed from category",
        "autochange-username": "MediaWiki automatic change",
        "upload": "Upload file",
        "uploadbtn": "Upload file",
index 9f45307..c10d3f7 100644 (file)
@@ -896,7 +896,6 @@ class ParserTest {
                        'wgExternalLinkTarget' => false,
                        'wgHtml5' => true,
                        'wgWellFormedXml' => true,
-                       'wgAllowMicrodataAttributes' => true,
                        'wgAdaptiveMessageCache' => true,
                        'wgDisableLangConversion' => false,
                        'wgDisableTitleConversion' => false,
index d01ebdf..356eed3 100644 (file)
@@ -24664,7 +24664,7 @@ Don't block XML namespace declaration
 !! wikitext
 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
 !! html/php
-<p><span>MediaWiki</span>
+<p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
 </p>
 !! html/parsoid
 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
index 9609f74..ac75e55 100644 (file)
@@ -223,7 +223,11 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
                        $templateTitle,
                        $templatePage->getParserOutput( new ParserOptions() ),
                        Title::newFromText( 'Baz' ),
-                       [ [ 'Baz', '[[:Template:TestingTemplate]] and 2 pages added to category' ] ]
+                       [ [
+                               'Baz',
+                               '[[:Template:TestingTemplate]] and [[Special:WhatLinksHere/Template:TestingTemplate|2 pages]] '
+                               . 'added to category'
+                       ] ]
                );
        }
 
index 4eb480d..0ad4b27 100644 (file)
@@ -102,7 +102,6 @@ class NewParserTest extends MediaWikiTestCase {
                $tmpGlobals['wgAllowExternalImages'] = true;
                $tmpGlobals['wgRawHtml'] = false;
                $tmpGlobals['wgWellFormedXml'] = true;
-               $tmpGlobals['wgAllowMicrodataAttributes'] = true;
                $tmpGlobals['wgExperimentalHtmlIds'] = false;
                $tmpGlobals['wgAdaptiveMessageCache'] = true;
                $tmpGlobals['wgUseDatabaseMessages'] = true;