Merge "Adding SITENAME to search box placeholder"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 12 Oct 2016 20:36:22 +0000 (20:36 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 12 Oct 2016 20:36:22 +0000 (20:36 +0000)
includes/MediaWiki.php
includes/deferred/DeferredUpdates.php
includes/libs/rdbms/database/DatabaseMysqlBase.php
includes/session/SessionBackend.php
includes/tidy/Balancer.php
languages/i18n/en.json
languages/i18n/qqq.json
maintenance/Doxyfile
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 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 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 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 3ff031f..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",
index 88e6e42..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'')",
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
 
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();