// Do any deferred jobs
DeferredUpdates::doUpdates( 'enqueue' );
+ DeferredUpdates::setImmediateMode( true );
// Make sure any lazy jobs are pushed
JobQueueGroup::pushLazyJobs();
* @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
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.
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
[ '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' ],
];
}
* @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 );
}
/**
* @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 );
}
] );
$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",
"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.",
"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.",
# 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
--- /dev/null
+ALTER TABLE /*_*/recentchanges MODIFY COLUMN rc_ip varbinary(40) NOT NULL default '';
'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();