$rev: the new revision
$baseID: the revision ID this was based off, if any
$user: the editing user
+&$tags: tags to apply to the edit and recent change
'OldChangesListRecentChangesLine': Customize entire recent changes line, or
return false to omit the line from RecentChanges and Watchlist special pages.
$wgShowSQLErrors = true;
$wgDebugRawPage = true; // T49960
-// Enable verbose logging
-$wgDebugComments = true;
-$wgDebugDumpSql = true;
-$wgDebugTimestamps = true;
-
// Enable log files
$logDir = getenv( 'MW_LOG_DIR' );
if ( $logDir ) {
// load() calls do try to refresh the cache with replica DB data
$this->mCache[$code]['LATEST'] = time();
// Pre-emptively update the local datacenter cache so things like edit filter and
- // blacklist changes are reflect immediately, as these often use MediaWiki: pages.
+ // blacklist changes are reflected immediately; these often use MediaWiki: pages.
// The datacenter handling replace() calls should be the same one handling edits
// as they require HTTP POST.
$this->saveToCaches( $this->mCache[$code], 'all', $code );
if ( $useDB ) {
$uckey = $wgContLang->ucfirst( $lckey );
- if ( !isset( $alreadyTried[ $langcode ] ) ) {
+ if ( !isset( $alreadyTried[$langcode] ) ) {
$message = $this->getMsgFromNamespace(
$this->getMessagePageName( $langcode, $uckey ),
$langcode
if ( $message !== false ) {
return $message;
}
- $alreadyTried[ $langcode ] = true;
+ $alreadyTried[$langcode] = true;
}
} else {
$uckey = null;
$fallbackChain = Language::getFallbacksFor( $langcode );
foreach ( $fallbackChain as $code ) {
- if ( isset( $alreadyTried[ $code ] ) ) {
+ if ( isset( $alreadyTried[$code] ) ) {
continue;
}
if ( $message !== false ) {
return $message;
}
- $alreadyTried[ $code ] = true;
+ $alreadyTried[$code] = true;
}
}
if ( isset( $this->mCache[$code][$title] ) ) {
$entry = $this->mCache[$code][$title];
if ( substr( $entry, 0, 1 ) === ' ' ) {
- // The message exists, so make sure a string is returned.
+ // The message exists and is not '!TOO BIG'
return (string)substr( $entry, 1 );
} elseif ( $entry === '!NONEXISTENT' ) {
return false;
- } elseif ( $entry === '!TOO BIG' ) {
- // Fall through and try invididual message cache below
}
+ // Fall through and try invididual message cache below
} else {
// XXX: This is not cached in process cache, should it?
$message = false;
/**
* @param string $message
* @param bool $interface
- * @param string $language Language code
+ * @param Language $language
* @param Title $title
* @return string
*/
- function transform( $message, $interface = false, $language = null, $title = null ) {
+ public function transform( $message, $interface = false, $language = null, $title = null ) {
// Avoid creating parser if nothing to transform
if ( strpos( $message, '{{' ) === false ) {
return $message;
/**
* @return Parser
*/
- function getParser() {
+ public function getParser() {
global $wgParser, $wgParserConf;
if ( !$this->mParser && isset( $wgParser ) ) {
return $res;
}
- function disable() {
+ public function disable() {
$this->mDisable = true;
}
- function enable() {
+ public function enable() {
$this->mDisable = false;
}
$this->replLogger = $logger;
}
- public function scaleLoads( array &$weightByServer, $domain ) {
+ final public function scaleLoads( array &$weightByServer, $domain ) {
$serverIndexes = array_keys( $weightByServer );
$states = $this->getServerStates( $serverIndexes, $domain );
- $coefficientsByServer = $states['weightScales'];
+ $newScalesByServer = $states['weightScales'];
foreach ( $weightByServer as $i => $weight ) {
- if ( isset( $coefficientsByServer[$i] ) ) {
- $weightByServer[$i] = $weight * $coefficientsByServer[$i];
+ if ( isset( $newScalesByServer[$i] ) ) {
+ $weightByServer[$i] = $weight * $newScalesByServer[$i];
} else { // server recently added to config?
$host = $this->parent->getServerName( $i );
$this->replLogger->error( __METHOD__ . ": host $host not in cache" );
}
}
- public function getLagTimes( array $serverIndexes, $domain ) {
- $states = $this->getServerStates( $serverIndexes, $domain );
-
- return $states['lagTimes'];
+ final public function getLagTimes( array $serverIndexes, $domain ) {
+ return $this->getServerStates( $serverIndexes, $domain )['lagTimes'];
}
protected function getServerStates( array $serverIndexes, $domain ) {
return $this->getMediaTransformError( $params, $errMsg );
}
+ if ( filesize( $params['srcPath'] ) === 0 ) {
+ $err = "Image file size seems to be zero.";
+ wfDebug( "$err\n" );
+ $errMsg = wfMessage( 'thumbnail_image-size-zero', $params['srcPath'] )->text();
+
+ return $this->getMediaTransformError( $params, $errMsg );
+ }
+
$src_image = call_user_func( $loader, $params['srcPath'] );
$rotation = function_exists( 'imagerotate' ) && !isset( $params['disableRotation'] ) ?
throw new MWException( "Failed to update page row to use new revision." );
}
+ $tags = $meta['tags'];
Hooks::run( 'NewRevisionFromEditComplete',
- [ $this, $revision, $meta['baseRevId'], $user ] );
+ [ $this, $revision, $meta['baseRevId'], $user, &$tags ] );
// Update recentchanges
if ( !( $flags & EDIT_SUPPRESS_RC ) ) {
$newsize,
$revisionId,
$patrolled,
- $meta['tags']
+ $tags
);
}
"thumbnail_dest_directory": "Unable to create destination directory",
"thumbnail_image-type": "Image type not supported",
"thumbnail_gd-library": "Incomplete GD library configuration: Missing function $1",
+ "thumbnail_image-size-zero": "Image file size seems to be zero.",
"thumbnail_image-missing": "File seems to be missing: $1",
"thumbnail_image-failure-limit": "There have been too many recent failed attempts ($1 or more) to render this thumbnail. Please try again later.",
"import": "Import pages",
"thumbnail_image-type": "This is the parameter 1 of the message {{msg-mw|thumbnail error}}",
"thumbnail_gd-library": "This is the parameter 1 of the message {{msg-mw|thumbnail error}}.\n*$1 is a function name of the GD library",
"thumbnail_image-missing": "This is the parameter 1 of the message {{msg-mw|thumbnail error}}.\n*$1 is the path incl. filename of the missing image",
+ "thumbnail_image-size-zero": "This is the parameter 1 of the message {{msg-mw|thumbnail error}}.\n*$1 is the path incl. filename of the image with zero size",
"thumbnail_image-failure-limit": "Used as <code>$1</code> in {{msg-mw|Thumbnail error}}.\n\nParameters:\n* $1 - the maximum allowed number of failed attempts",
"import": "The title of the special page [[Special:Import]];",
"import-summary": "{{doc-specialpagesummary|import}}",
* OO.compare( [ 1 ], [ 1 ] );
* } );
*
+ * Example of inline dependency obtained via `require()`:
+ *
+ * mw.loader.using( [ 'mediawiki.util' ], function ( require ) {
+ * var util = require( 'mediawiki.util' );
+ * } );
+ *
* Since MediaWiki 1.23 this also returns a promise.
*
* Since MediaWiki 1.28 the promise is resolved with a `require` function.
/**
* Get the exported value of a module.
*
- * Modules may provide this via their local `module.exports`.
+ * This static method is publicly exposed for debugging purposes
+ * only and must not be used in production code. In production code,
+ * please use the dynamically provided `require()` function instead.
*
- * @protected
+ * In case of lazy-loaded modules via mw.loader#using(), the returned
+ * Promise provides the function, see #using() for examples.
+ *
+ * @private
* @since 1.27
* @param {string} moduleName Module name
* @return {Mixed} Exported value