Merge "TitleWidget: Take 'known' status into account when deciding page existence"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 13 Oct 2016 00:01:34 +0000 (00:01 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 13 Oct 2016 00:01:34 +0000 (00:01 +0000)
14 files changed:
includes/MediaWiki.php
includes/content/ContentHandler.php
includes/deferred/DeferredUpdates.php
includes/installer/MysqlUpdater.php
includes/libs/rdbms/database/DatabaseMysqlBase.php
includes/page/Article.php
includes/session/SessionBackend.php
includes/tidy/Balancer.php
languages/i18n/en.json
languages/i18n/qqq.json
maintenance/Doxyfile
maintenance/archives/patch-rc_ip_modify.sql [new file with mode: 0644]
resources/Resources.php
resources/src/mediawiki/page/gallery-slideshow.js

index 8cf009f..218337a 100644 (file)
@@ -899,6 +899,7 @@ class MediaWiki {
 
                // Do any deferred jobs
                DeferredUpdates::doUpdates( 'enqueue' );
+               DeferredUpdates::setImmediateMode( true );
 
                // Make sure any lazy jobs are pushed
                JobQueueGroup::pushLazyJobs();
index 5755918..3389a00 100644 (file)
@@ -82,15 +82,6 @@ class MWUnknownContentModelException extends MWException {
  * @ingroup Content
  */
 abstract class ContentHandler {
-       /**
-        * Switch for enabling deprecation warnings. Used by ContentHandler::deprecated()
-        * and ContentHandler::runLegacyHooks().
-        *
-        * Once the ContentHandler code has settled in a bit, this should be set to true to
-        * make extensions etc. show warnings when using deprecated functions and hooks.
-        */
-       protected static $enableDeprecationWarnings = false;
-
        /**
         * Convenience function for getting flat text from a Content object. This
         * should only be used in the context of backwards compatibility with code
@@ -1139,25 +1130,6 @@ abstract class ContentHandler {
                return $this->supportsDirectEditing();
        }
 
-       /**
-        * Logs a deprecation warning, visible if $wgDevelopmentWarnings, but only if
-        * self::$enableDeprecationWarnings is set to true.
-        *
-        * @param string $func The name of the deprecated function
-        * @param string $version The version since the method is deprecated. Usually 1.21
-        *   for ContentHandler related stuff.
-        * @param string|bool $component : Component to which the function belongs.
-        *   If false, it is assumed the function is in MediaWiki core.
-        *
-        * @see ContentHandler::$enableDeprecationWarnings
-        * @see wfDeprecated
-        */
-       public static function deprecated( $func, $version, $component = false ) {
-               if ( self::$enableDeprecationWarnings ) {
-                       wfDeprecated( $func, $version, $component, 3 );
-               }
-       }
-
        /**
         * Call a legacy hook that uses text instead of Content objects.
         * Will log a warning when a matching hook function is registered.
index 8a761f5..1ba6c1f 100644 (file)
@@ -52,6 +52,8 @@ class DeferredUpdates {
        private static $preSendUpdates = [];
        /** @var DeferrableUpdate[] Updates to be deferred until after request end */
        private static $postSendUpdates = [];
+       /** @var bool Whether to just run updates in addUpdate() */
+       private static $immediateMode = false;
 
        const ALL = 0; // all updates; in web requests, use only after flushing the output buffer
        const PRESEND = 1; // for updates that should run before flushing output buffer
@@ -85,6 +87,12 @@ class DeferredUpdates {
                        self::push( self::$postSendUpdates, $update );
                }
 
+               if ( self::$immediateMode ) {
+                       // No more explicit doUpdates() calls will happen, so run this now
+                       self::doUpdates( 'run' );
+                       return;
+               }
+
                // Try to run the updates now if in CLI mode and no transaction is active.
                // This covers scripts that don't/barely use the DB but make updates to other stores.
                if ( $wgCommandLineMode ) {
@@ -126,6 +134,14 @@ class DeferredUpdates {
                }
        }
 
+       /**
+        * @param bool $value Whether to just immediately run updates in addUpdate()
+        * @since 1.28
+        */
+       public static function setImmediateMode( $value ) {
+               self::$immediateMode = (bool)$value;
+       }
+
        /**
         * @param DeferrableUpdate[] $queue
         * @param DeferrableUpdate $update
index 497f273..a637ce0 100644 (file)
@@ -290,6 +290,7 @@ class MysqlUpdater extends DatabaseUpdater {
                        [ 'doNonUniquePlTlIl' ],
                        [ 'addField', 'change_tag', 'ct_id', 'patch-change_tag-ct_id.sql' ],
                        [ 'addField', 'tag_summary', 'ts_id', 'patch-tag_summary-ts_id.sql' ],
+                       [ 'modifyField', 'recentchanges', 'rc_ip', 'patch-rc_ip_modify.sql' ],
                ];
        }
 
index fb5fed7..9662a5b 100644 (file)
@@ -72,8 +72,6 @@ abstract class DatabaseMysqlBase extends Database {
         * @param array $params
         */
        function __construct( array $params ) {
-               parent::__construct( $params );
-
                $this->lagDetectionMethod = isset( $params['lagDetectionMethod'] )
                        ? $params['lagDetectionMethod']
                        : 'Seconds_Behind_Master';
@@ -89,6 +87,8 @@ abstract class DatabaseMysqlBase extends Database {
                }
                $this->sqlMode = isset( $params['sqlMode'] ) ? $params['sqlMode'] : '';
                $this->utf8Mode = !empty( $params['utf8Mode'] );
+
+               parent::__construct( $params );
        }
 
        /**
index 9428609..548e533 100644 (file)
@@ -210,7 +210,7 @@ class Article implements Page {
         * @return string Return the text of this revision
         */
        public function getContent() {
-               ContentHandler::deprecated( __METHOD__, '1.21' );
+               wfDeprecated( __METHOD__, '1.21' );
                $content = $this->getContentObject();
                return ContentHandler::getContentText( $content );
        }
index 263cb11..ea811b6 100644 (file)
@@ -642,7 +642,11 @@ final class SessionBackend {
                        ] );
                        $this->user->setToken();
                        if ( !wfReadOnly() ) {
-                               $this->user->saveSettings();
+                               // Promise that the token set here will be valid; save it at end of request
+                               $user = $this->user;
+                               \DeferredUpdates::addCallableUpdate( function () use ( $user ) {
+                                       $user->saveSettings();
+                               } );
                        }
                        $this->metaDirty = true;
                }
index 069b460..aef73c7 100644 (file)
@@ -328,7 +328,7 @@ class BalanceElement {
        /**
         * Parent of this element, or the string "flat" if this element has
         * already been flattened into its parent.
-        * @var string|null $parent
+        * @var BalanceElement|string|null $parent
         */
        public $parent;
 
@@ -337,7 +337,7 @@ class BalanceElement {
         * child will be an actual BalanceElement object; the rest will
         * be strings, representing either text nodes or flattened
         * BalanceElement objects.
-        * @var array $children
+        * @var BalanceElement[]|string[] $children
         */
        public $children;
 
@@ -465,6 +465,7 @@ class BalanceElement {
         * in its parent by that string.
         *
         * @param array $config Balancer configuration; see Balancer::__construct().
+        * @return string
         *
         * @see __toString()
         */
@@ -653,7 +654,7 @@ class BalanceElement {
 class BalanceStack implements IteratorAggregate {
        /**
         * Backing storage for the stack.
-        * @var array $elements
+        * @var BalanceElement[] $elements
         */
        private $elements = [];
        /**
@@ -717,6 +718,7 @@ class BalanceStack implements IteratorAggregate {
        /**
         * Insert text at the appropriate place for inserting a node.
         * @param string $value
+        * @param bool $isComment
         * @see https://html.spec.whatwg.org/multipage/syntax.html#appropriate-place-for-inserting-a-node
         */
        public function insertText( $value, $isComment = false ) {
@@ -906,7 +908,7 @@ class BalanceStack implements IteratorAggregate {
        /**
         * Return an iterator over this stack which visits the current node
         * first, and the root node last.
-        * @return Iterator
+        * @return \Iterator
         */
        public function getIterator() {
                return new ReverseArrayIterator( $this->elements );
@@ -1080,6 +1082,8 @@ class BalanceStack implements IteratorAggregate {
        /**
         * Foster parent the given $elt in the stack of open elements.
         * @param BalanceElement|string $elt
+        * @return BalanceElement|string
+        *
         * @see https://html.spec.whatwg.org/multipage/syntax.html#foster-parent
         */
        private function fosterParent( $elt ) {
@@ -1520,6 +1524,7 @@ class BalanceActiveFormattingElements {
 
        /**
         * Determine whether an element is in the list of formatting elements.
+        * @param BalanceElement $elt
         * @return boolean
         */
        public function isInList( BalanceElement $elt ) {
@@ -1529,6 +1534,8 @@ class BalanceActiveFormattingElements {
        /**
         * Find the element $elt in the list and remove it.
         * Used when parsing &lt;a&gt; in body mode.
+        *
+        * @param BalanceElement $elt
         */
        public function remove( BalanceElement $elt ) {
                if ( $this->head !== $elt && !$elt->prevAFE ) {
@@ -1597,6 +1604,9 @@ class BalanceActiveFormattingElements {
 
        /**
         * Find element $a in the list and replace it with element $b
+        *
+        * @param BalanceElement $a
+        * @param BalanceElement $b
         */
        public function replace( BalanceElement $a, BalanceElement $b ) {
                if ( $this->head !== $a && !$a->prevAFE ) {
@@ -1628,6 +1638,9 @@ class BalanceActiveFormattingElements {
 
        /**
         * Find $a in the list and insert $b after it.
+
+        * @param BalanceElement $a
+        * @param BalanceElement $b
         */
        public function insertAfter( BalanceElement $a, BalanceElement $b ) {
                if ( $this->head !== $a && !$a->prevAFE ) {
@@ -1778,9 +1791,12 @@ class BalanceActiveFormattingElements {
  */
 class Balancer {
        private $parseMode;
+       /** @var \Iterator */
        private $bitsIterator;
        private $allowedHtmlElements;
+       /** @var BalanceActiveFormattingElements */
        private $afe;
+       /** @var BalanceStack */
        private $stack;
        private $strict;
        private $allowComments;
@@ -1795,6 +1811,11 @@ class Balancer {
        private $inRCDATA;
        private $inRAWTEXT;
 
+       /** @var callable|null */
+       private $processingCallback;
+       /** @var array */
+       private $processingArgs;
+
        /**
         * Valid HTML5 comments.
         * Regex borrowed from Tim Starling's "remex-html" project.
@@ -2582,6 +2603,7 @@ class Balancer {
                        case 'tt':
                        case 'u':
                                $this->afe->reconstruct( $this->stack );
+                               // FIXME: only takes one parameter
                                $this->afe->push( $this->stack->insertHTMLElement( $value, $attribs ), $attribs );
                                return true;
 
@@ -2591,6 +2613,7 @@ class Balancer {
                                        $this->inBodyMode( 'endtag', 'nobr' );
                                        $this->afe->reconstruct( $this->stack );
                                }
+                               // FIXME: only takes one parameter
                                $this->afe->push( $this->stack->insertHTMLElement( $value, $attribs ), $attribs );
                                return true;
 
index d10749d..30adf58 100644 (file)
        "newimages-showbots": "Show uploads by bots",
        "newimages-hidepatrolled": "Hide patrolled uploads",
        "noimages": "Nothing to see.",
+       "gallery-slideshow-toggle": "Toggle thumbnails",
        "ilsubmit": "Search",
        "bydate": "by date",
        "sp-newimages-showfrom": "Show new files starting from $2, $1",
        "feedback-thanks": "Thanks! Your feedback has been posted to the page \"[$2 $1]\".",
        "feedback-thanks-title": "Thank you!",
        "feedback-useragent": "User agent:",
-       "searchsuggest-search": "Search",
+       "searchsuggest-search": "Search {{SITENAME}}",
        "searchsuggest-containing": "containing...",
        "api-error-autoblocked": "Your IP address has been blocked automatically, because it was used by a blocked user.",
        "api-error-badaccess-groups": "You are not permitted to upload files to this wiki.",
index 96f8c38..235bf1e 100644 (file)
        "newimages-showbots": "Used as label for a checkbox. When checked, [[Special:NewImages]] will also display uploads by users in the bots group.",
        "newimages-hidepatrolled": "Used as label for a checkbox. When checked, [[Special:NewImages]] will not display patrolled uploads.\n\nCf. {{msg-mw|tog-hidepatrolled}} and {{msg-mw|apihelp-feedrecentchanges-param-hidepatrolled}}.",
        "noimages": "This is shown on the special page [[Special:NewImages]], when there aren't any recently uploaded files.",
+       "gallery-slideshow-toggle": "Tooltip for the icon that toggles thumbnails on a slideshow  gallery.",
        "ilsubmit": "Used as label for input box in the MIMESearch form on [[Special:MIMESearch]].\n\nSee also:\n* {{msg-mw|Mimesearch|page title}}\n* {{msg-mw|Mimetype|label for input box}}\n{{Identical|Search}}",
        "bydate": "{{Identical|Date}}",
        "sp-newimages-showfrom": "This is a link on [[Special:NewImages]] which takes you to a gallery of the newest files.\n* $1 is a date (example: ''19 March 2008'')\n* $2 is a time (example: ''12:15'')",
        "feedback-thanks": "Thanks message, appears if feedback was successful. Parameters:\n* $1 - \"Feedback\"\n* $2 - Feedback page URL",
        "feedback-thanks-title": "The title of the thank you dialog at the end of the submission process.\n{{Identical|Thank you}}",
        "feedback-useragent": "A label denoting the user agent in the feedback that is posted to the feedback page.\n{{Identical|User agent}}",
-       "searchsuggest-search": "Greyed out default text in the simple search box in the Vector skin. (It disappears and lets the user enter the requested search terms when the search box receives focus.)\n\n{{Identical|Search}}",
+       "searchsuggest-search": "Greyed out default text in the simple search box in the Vector skin. (It disappears and lets the user enter the requested search terms when the search box receives focus.)",
        "searchsuggest-containing": "Label used in the special item of the search suggestions list which gives the user an option to perform a full text search for the term.",
        "api-error-autoblocked": "API error message that can be used for client side localisation of API errors.\n\nCf. {{msg-mw|Autoblockedtext}}.",
        "api-error-badaccess-groups": "API error message that can be used for client side localisation of API errors.",
index 0c89c05..7e9220c 100644 (file)
@@ -4,10 +4,10 @@
 # doxygen (www.doxygen.org) for MediaWiki.
 #
 # Some placeholders have been added for MediaWiki usage:
-# {{OUTPUT_DIRECTORY}}
-# {{CURRENT_VERSION}}
-# {{STRIP_FROM_PATH}}
-# {{INPUT}}
+# OUTPUT_DIRECTORY = {{OUTPUT_DIRECTORY}}
+# CURRENT_VERSION  = {{CURRENT_VERSION}}
+# STRIP_FROM_PATH  = {{STRIP_FROM_PATH}}
+# INPUT            = {{INPUT}}
 #
 # To generate documentation run: php mwdocgen.php --no-extensions
 
diff --git a/maintenance/archives/patch-rc_ip_modify.sql b/maintenance/archives/patch-rc_ip_modify.sql
new file mode 100644 (file)
index 0000000..e889b5c
--- /dev/null
@@ -0,0 +1 @@
+ALTER TABLE /*_*/recentchanges MODIFY COLUMN rc_ip varbinary(40) NOT NULL default '';
index e7c8e49..2b7a644 100644 (file)
@@ -1725,6 +1725,9 @@ return [
                        'oojs-ui-core',
                        'oojs-ui-widgets',
                        'oojs-ui.styles.icons-media'
+               ],
+               'messages' => [
+                       'gallery-slideshow-toggle'
                ]
        ],
        'mediawiki.page.ready' => [
index 3b2c86e..cf448b0 100644 (file)
 
                toggle = new OO.ui.ButtonWidget( {
                        framed: false,
-                       icon: 'imageGallery'
+                       icon: 'imageGallery',
+                       title: mw.msg( 'gallery-slideshow-toggle' )
                } ).on( 'click', this.toggleThumbnails.bind( this ) );
 
                interfaceElements = new OO.ui.PanelLayout( {
                // Show thumbnail stretched to the right size while the image loads
                this.$thumbnail = imageLi.find( 'img' );
                this.$img.attr( 'src', this.$thumbnail.attr( 'src' ) );
+               this.$img.attr( 'alt', this.$thumbnail.attr( 'alt' ) );
                this.$imgLink.attr( 'href', imageLi.find( 'a' ).eq( 0 ).attr( 'href' ) );
                this.setImageSize();