summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-08-16 08:22:05 +0200
committerPierre Schmitz <pierre@archlinux.de>2015-08-16 08:22:05 +0200
commit1a365e77dfb8825136626202b1df462731b42060 (patch)
tree1dc4468eaabf070e051e790a9e67a9a9a2c63d99 /includes
parenta72fd280f7acb4d2a1ba579a0f1b2b2ae8958530 (diff)
Update to MediaWiki 1.25.2
Diffstat (limited to 'includes')
-rw-r--r--includes/DefaultSettings.php2
-rw-r--r--includes/GlobalFunctions.php2
-rw-r--r--includes/Setup.php4
-rw-r--r--includes/User.php37
-rw-r--r--includes/api/ApiBase.php2
-rw-r--r--includes/api/ApiOpenSearch.php14
-rw-r--r--includes/api/ApiQueryImageInfo.php5
-rw-r--r--includes/exception/MWExceptionHandler.php7
-rw-r--r--includes/filerepo/ForeignAPIRepo.php1
-rw-r--r--includes/installer/DatabaseUpdater.php23
-rw-r--r--includes/registration/ExtensionProcessor.php1
-rw-r--r--includes/registration/ExtensionRegistry.php20
-rw-r--r--includes/specials/SpecialDeletedContributions.php2
-rw-r--r--includes/specials/SpecialVersion.php4
14 files changed, 75 insertions, 49 deletions
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 010c471c..75ed529e 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -75,7 +75,7 @@ $wgConfigRegistry = array(
* MediaWiki version number
* @since 1.2
*/
-$wgVersion = '1.25.1';
+$wgVersion = '1.25.2';
/**
* Name of the site. It must be changed in LocalSettings.php
diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 240cb97b..45cd7ea5 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -3342,7 +3342,7 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad = 1,
// Removing leading zeros works around broken base detection code in
// some PHP versions (see <https://bugs.php.net/bug.php?id=50175> and
// <https://bugs.php.net/bug.php?id=55398>).
- $result = gmp_strval( gmp_init( ltrim( $input, '0' ), $sourceBase ), $destBase );
+ $result = gmp_strval( gmp_init( ltrim( $input, '0' ) ?: '0', $sourceBase ), $destBase );
} elseif ( extension_loaded( 'bcmath' ) && ( $engine == 'auto' || $engine == 'bcmath' ) ) {
$decimal = '0';
foreach ( str_split( strtolower( $input ) ) as $char ) {
diff --git a/includes/Setup.php b/includes/Setup.php
index dd8fbf8a..b3bf0fca 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -232,9 +232,7 @@ if ( $wgUseInstantCommons ) {
$wgForeignFileRepos[] = array(
'class' => 'ForeignAPIRepo',
'name' => 'wikimediacommons',
- 'apibase' => WebRequest::detectProtocol() === 'https' ?
- 'https://commons.wikimedia.org/w/api.php' :
- 'http://commons.wikimedia.org/w/api.php',
+ 'apibase' => 'https://commons.wikimedia.org/w/api.php',
'hashLevels' => 2,
'fetchDescription' => true,
'descriptionCacheExpiry' => 43200,
diff --git a/includes/User.php b/includes/User.php
index 3cd69fdc..8ea491ce 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -2204,6 +2204,8 @@ class User implements IDBAccessObject {
* page. Ignored if null or !$val.
*/
public function setNewtalk( $val, $curRev = null ) {
+ global $wgMemc;
+
if ( wfReadOnly() ) {
return;
}
@@ -2218,7 +2220,6 @@ class User implements IDBAccessObject {
$field = 'user_id';
$id = $this->getId();
}
- global $wgMemc;
if ( $val ) {
$changed = $this->updateNewtalk( $field, $id, $curRev );
@@ -2270,37 +2271,13 @@ class User implements IDBAccessObject {
}
/**
- * Immediately touch the user data cache for this account.
- * Updates user_touched field, and removes account data from memcached
- * for reload on the next hit.
+ * Immediately touch the user data cache for this account
+ *
+ * Calls touch() and removes account data from memcached
*/
public function invalidateCache() {
- if ( wfReadOnly() ) {
- return;
- }
- $this->load();
- if ( $this->mId ) {
- $this->mTouched = $this->newTouchedTimestamp();
-
- $dbw = wfGetDB( DB_MASTER );
- $userid = $this->mId;
- $touched = $this->mTouched;
- $method = __METHOD__;
- $dbw->onTransactionIdle( function () use ( $dbw, $userid, $touched, $method ) {
- // Prevent contention slams by checking user_touched first
- $encTouched = $dbw->addQuotes( $dbw->timestamp( $touched ) );
- $needsPurge = $dbw->selectField( 'user', '1',
- array( 'user_id' => $userid, 'user_touched < ' . $encTouched ) );
- if ( $needsPurge ) {
- $dbw->update( 'user',
- array( 'user_touched' => $dbw->timestamp( $touched ) ),
- array( 'user_id' => $userid, 'user_touched < ' . $encTouched ),
- $method
- );
- }
- } );
- $this->clearSharedCache();
- }
+ $this->touch();
+ $this->clearSharedCache();
}
/**
diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index 5a1eb995..6c33da57 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -1192,7 +1192,7 @@ abstract class ApiBase extends ContextSource {
$this->dieUsage( 'Specified user does not exist', 'bad_wlowner' );
}
$token = $user->getOption( 'watchlisttoken' );
- if ( $token == '' || $token != $params['token'] ) {
+ if ( $token == '' || !hash_equals( $token, $params['token'] ) ) {
$this->dieUsage(
'Incorrect watchlist token provided -- please set a correct token in Special:Preferences',
'bad_wltoken'
diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php
index a93b7cc6..0adb464d 100644
--- a/includes/api/ApiOpenSearch.php
+++ b/includes/api/ApiOpenSearch.php
@@ -384,13 +384,25 @@ class ApiOpenSearchFormatJson extends ApiFormatJson {
public function execute() {
if ( !$this->getResult()->getResultData( 'error' ) ) {
- $warnings = $this->getResult()->removeValue( 'warnings', null );
+ $result = $this->getResult();
+
+ // Ignore warnings or treat as errors, as requested
+ $warnings = $result->removeValue( 'warnings', null );
if ( $this->warningsAsError && $warnings ) {
$this->dieUsage(
'Warnings cannot be represented in OpenSearch JSON format', 'warnings', 0,
array( 'warnings' => $warnings )
);
}
+
+ // Ignore any other unexpected keys (e.g. from $wgDebugToolbar)
+ $remove = array_keys( array_diff_key(
+ $result->getResultData(),
+ array( 0 => 'search', 1 => 'terms', 2 => 'descriptions', 3 => 'urls' )
+ ) );
+ foreach ( $remove as $key ) {
+ $result->removeValue( $key, null );
+ }
}
parent::execute();
diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php
index 94b4bbdb..095e5dda 100644
--- a/includes/api/ApiQueryImageInfo.php
+++ b/includes/api/ApiQueryImageInfo.php
@@ -592,7 +592,10 @@ class ApiQueryImageInfo extends ApiQueryBase {
$retval = array();
if ( is_array( $metadata ) ) {
foreach ( $metadata as $key => $value ) {
- $r = array( 'name' => $key );
+ $r = array(
+ 'name' => $key,
+ ApiResult::META_BC_BOOLS => array( 'value' ),
+ );
if ( is_array( $value ) ) {
$r['value'] = self::processMetaData( $value, $result );
} else {
diff --git a/includes/exception/MWExceptionHandler.php b/includes/exception/MWExceptionHandler.php
index c50b6c8c..a58705f6 100644
--- a/includes/exception/MWExceptionHandler.php
+++ b/includes/exception/MWExceptionHandler.php
@@ -486,6 +486,8 @@ TXT;
if ( $json !== false ) {
wfDebugLog( 'exception-json', $json, 'private' );
}
+
+ Hooks::run( 'LogException', array( $e, false ) );
}
}
@@ -501,7 +503,8 @@ TXT;
// The set_error_handler callback is independent from error_reporting.
// Filter out unwanted errors manually (e.g. when wfSuppressWarnings is active).
- if ( ( error_reporting() & $e->getSeverity() ) !== 0 ) {
+ $suppressed = ( error_reporting() & $e->getSeverity() ) === 0;
+ if ( !$suppressed ) {
$log = self::getLogMessage( $e );
if ( $wgLogExceptionBacktrace ) {
wfDebugLog( $channel, $log . "\n" . $e->getTraceAsString() );
@@ -515,5 +518,7 @@ TXT;
if ( $json !== false ) {
wfDebugLog( "$channel-json", $json, 'private' );
}
+
+ Hooks::run( 'LogException', array( $e, $suppressed ) );
}
}
diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php
index 7ead968f..3c031921 100644
--- a/includes/filerepo/ForeignAPIRepo.php
+++ b/includes/filerepo/ForeignAPIRepo.php
@@ -521,6 +521,7 @@ class ForeignAPIRepo extends FileRepo {
if ( $status->isOK() ) {
return $req->getContent();
} else {
+ wfDebug( "ForeignAPIRepo: ERROR on GET: " . $status->getWikiText() );
return false;
}
}
diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php
index 702f850c..70707901 100644
--- a/includes/installer/DatabaseUpdater.php
+++ b/includes/installer/DatabaseUpdater.php
@@ -145,15 +145,26 @@ abstract class DatabaseUpdater {
return; // already loaded
}
$vars = Installer::getExistingLocalSettings();
- if ( !$vars ) {
- return; // no LocalSettings found
+
+ $registry = ExtensionRegistry::getInstance();
+ $queue = $registry->getQueue();
+ // Don't accidentally load extensions in the future
+ $registry->clearQueue();
+
+ // This will automatically add "AutoloadClasses" to $wgAutoloadClasses
+ $data = $registry->readFromQueue( $queue );
+ $hooks = array( 'wgHooks' => array( 'LoadExtensionSchemaUpdates' => array() ) );
+ if ( isset( $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
+ $hooks = $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'];
}
- if ( !isset( $vars['wgHooks'] ) || !isset( $vars['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
- return;
+ if ( $vars && isset( $vars['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
+ $hooks = array_merge_recursive( $hooks, $vars['wgHooks']['LoadExtensionSchemaUpdates'] );
}
global $wgHooks, $wgAutoloadClasses;
- $wgHooks['LoadExtensionSchemaUpdates'] = $vars['wgHooks']['LoadExtensionSchemaUpdates'];
- $wgAutoloadClasses = $wgAutoloadClasses + $vars['wgAutoloadClasses'];
+ $wgHooks['LoadExtensionSchemaUpdates'] = $hooks;
+ if ( $vars && isset( $vars['wgAutoloadClasses'] ) ) {
+ $wgAutoloadClasses += $vars['wgAutoloadClasses'];
+ }
}
/**
diff --git a/includes/registration/ExtensionProcessor.php b/includes/registration/ExtensionProcessor.php
index 7f738661..bb8fb329 100644
--- a/includes/registration/ExtensionProcessor.php
+++ b/includes/registration/ExtensionProcessor.php
@@ -81,6 +81,7 @@ class ExtensionProcessor implements Processor {
'config',
'ParserTestFiles',
'AutoloadClasses',
+ 'manifest_version',
);
/**
diff --git a/includes/registration/ExtensionRegistry.php b/includes/registration/ExtensionRegistry.php
index 2558f7e2..4e690aa8 100644
--- a/includes/registration/ExtensionRegistry.php
+++ b/includes/registration/ExtensionRegistry.php
@@ -109,6 +109,24 @@ class ExtensionRegistry {
}
/**
+ * Get the current load queue. Not intended to be used
+ * outside of the installer.
+ *
+ * @return array
+ */
+ public function getQueue() {
+ return $this->queued;
+ }
+
+ /**
+ * Clear the current load queue. Not intended to be used
+ * outside of the installer.
+ */
+ public function clearQueue() {
+ $this->queued = array();
+ }
+
+ /**
* Process a queue of extensions and return their extracted data
*
* @param array $queue keys are filenames, values are ignored
@@ -143,7 +161,7 @@ class ExtensionRegistry {
protected function exportExtractedData( array $info ) {
foreach ( $info['globals'] as $key => $val ) {
- if ( !isset( $GLOBALS[$key] ) || !$GLOBALS[$key] ) {
+ if ( !isset( $GLOBALS[$key] ) || ( is_array( $GLOBALS[$key] ) && !$GLOBALS[$key] ) ) {
$GLOBALS[$key] = $val;
} elseif ( $key === 'wgHooks' || $key === 'wgExtensionCredits' ) {
// Special case $wgHooks and $wgExtensionCredits, which require a recursive merge.
diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php
index 9e4bbbe5..fb85942d 100644
--- a/includes/specials/SpecialDeletedContributions.php
+++ b/includes/specials/SpecialDeletedContributions.php
@@ -479,7 +479,7 @@ class DeletedContributionsPage extends SpecialPage {
if ( ( $id !== null ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) {
# Block / Change block / Unblock links
if ( $this->getUser()->isAllowed( 'block' ) ) {
- if ( $userObj->isBlocked() ) {
+ if ( $userObj->isBlocked() && $userObj->getBlock()->getType() !== Block::TYPE_AUTO ) {
$tools[] = Linker::linkKnown( # Change block link
SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ),
$this->msg( 'change-blocklink' )->escaped()
diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php
index c1a95939..9a1c5e5d 100644
--- a/includes/specials/SpecialVersion.php
+++ b/includes/specials/SpecialVersion.php
@@ -265,8 +265,8 @@ class SpecialVersion extends SpecialPage {
$version = $wgVersion . ' ' .
wfMessage(
'version-svn-revision',
- isset( $info['directory-rev'] ) ? $info['directory-rev'] : '',
- $info['checkout-rev']
+ isset( $svnInfo['directory-rev'] ) ? $svnInfo['directory-rev'] : '',
+ isset( $svnInfo['checkout-rev'] ) ? $svnInfo['checkout-rev'] : ''
)->text();
}