// Do any deferred jobs
DeferredUpdates::doUpdates( 'enqueue' );
+ DeferredUpdates::setImmediateMode( true );
// Make sure any lazy jobs are pushed
JobQueueGroup::pushLazyJobs();
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
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 ) {
}
}
+ /**
+ * @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
* @param array $params
*/
function __construct( array $params ) {
- parent::__construct( $params );
-
$this->lagDetectionMethod = isset( $params['lagDetectionMethod'] )
? $params['lagDetectionMethod']
: 'Seconds_Behind_Master';
}
$this->sqlMode = isset( $params['sqlMode'] ) ? $params['sqlMode'] : '';
$this->utf8Mode = !empty( $params['utf8Mode'] );
+
+ parent::__construct( $params );
}
/**
] );
$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;
}
/**
* 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;
* 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;
* in its parent by that string.
*
* @param array $config Balancer configuration; see Balancer::__construct().
+ * @return string
*
* @see __toString()
*/
class BalanceStack implements IteratorAggregate {
/**
* Backing storage for the stack.
- * @var array $elements
+ * @var BalanceElement[] $elements
*/
private $elements = [];
/**
/**
* 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 ) {
/**
* 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 );
/**
* 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 ) {
/**
* Determine whether an element is in the list of formatting elements.
+ * @param BalanceElement $elt
* @return boolean
*/
public function isInList( BalanceElement $elt ) {
/**
* Find the element $elt in the list and remove it.
* Used when parsing <a> in body mode.
+ *
+ * @param BalanceElement $elt
*/
public function remove( BalanceElement $elt ) {
if ( $this->head !== $elt && !$elt->prevAFE ) {
/**
* 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 ) {
/**
* 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 ) {
*/
class Balancer {
private $parseMode;
+ /** @var \Iterator */
private $bitsIterator;
private $allowedHtmlElements;
+ /** @var BalanceActiveFormattingElements */
private $afe;
+ /** @var BalanceStack */
private $stack;
private $strict;
private $allowComments;
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.
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;
$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;
"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",
"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'')",
# 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
'oojs-ui-core',
'oojs-ui-widgets',
'oojs-ui.styles.icons-media'
+ ],
+ 'messages' => [
+ 'gallery-slideshow-toggle'
]
],
'mediawiki.page.ready' => [
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();