summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-09-04 05:51:59 +0200
committerPierre Schmitz <pierre@archlinux.de>2013-09-04 05:51:59 +0200
commit91e194556c52d2f354344f930419eef2dd6267f0 (patch)
tree0cd12490d3cd3499274017c9b799d0f738d3719e /includes
parent08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (diff)
Update to MediaWiki 1.21.2
Diffstat (limited to 'includes')
-rw-r--r--includes/DefaultSettings.php2
-rw-r--r--includes/api/ApiBlock.php15
-rw-r--r--includes/api/ApiCreateAccount.php4
-rw-r--r--includes/api/ApiLogin.php9
-rw-r--r--includes/api/ApiMain.php10
-rw-r--r--includes/api/ApiQueryDeletedrevs.php5
-rw-r--r--includes/api/ApiTokens.php5
-rw-r--r--includes/api/ApiUnblock.php15
-rw-r--r--includes/filerepo/file/LocalFile.php16
-rw-r--r--includes/installer/Installer.php29
-rw-r--r--includes/installer/MysqlUpdater.php2
-rw-r--r--includes/installer/WebInstallerPage.php2
-rw-r--r--includes/libs/IEUrlExtension.php2
-rw-r--r--includes/resourceloader/ResourceLoader.php26
-rw-r--r--includes/revisiondelete/RevisionDelete.php11
-rw-r--r--includes/zhtable/trad2simp_supp_unset.manual0
16 files changed, 96 insertions, 57 deletions
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 9d024c86..0e493eb0 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -63,7 +63,7 @@ $wgConf = new SiteConfiguration;
* MediaWiki version number
* @since 1.2
*/
-$wgVersion = '1.21.1';
+$wgVersion = '1.21.2';
/**
* Name of the site. It must be changed in LocalSettings.php
diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php
index 90432b95..6f3d1e4f 100644
--- a/includes/api/ApiBlock.php
+++ b/includes/api/ApiBlock.php
@@ -42,12 +42,6 @@ class ApiBlock extends ApiBase {
$user = $this->getUser();
$params = $this->extractRequestParams();
- if ( $params['gettoken'] ) {
- $res['blocktoken'] = $user->getEditToken();
- $this->getResult()->addValue( null, $this->getModuleName(), $res );
- return;
- }
-
if ( !$user->isAllowed( 'block' ) ) {
$this->dieUsageMsg( 'cantblock' );
}
@@ -156,10 +150,6 @@ class ApiBlock extends ApiBase {
ApiBase::PARAM_REQUIRED => true
),
'token' => null,
- 'gettoken' => array(
- ApiBase::PARAM_DFLT => false,
- ApiBase::PARAM_DEPRECATED => true,
- ),
'expiry' => 'never',
'reason' => '',
'anononly' => false,
@@ -177,7 +167,6 @@ class ApiBlock extends ApiBase {
return array(
'user' => 'Username, IP address or IP range you want to block',
'token' => 'A block token previously obtained through prop=info',
- 'gettoken' => 'If set, a block token will be returned, and no other action will be taken',
'expiry' => 'Relative expiry time, e.g. \'5 months\' or \'2 weeks\'. If set to \'infinite\', \'indefinite\' or \'never\', the block will never expire.',
'reason' => 'Reason for block',
'anononly' => 'Block anonymous users only (i.e. disable anonymous edits for this IP)',
@@ -194,10 +183,6 @@ class ApiBlock extends ApiBase {
public function getResultProperties() {
return array(
'' => array(
- 'blocktoken' => array(
- ApiBase::PROP_TYPE => 'string',
- ApiBase::PROP_NULLABLE => true
- ),
'user' => array(
ApiBase::PROP_TYPE => 'string',
ApiBase::PROP_NULLABLE => true
diff --git a/includes/api/ApiCreateAccount.php b/includes/api/ApiCreateAccount.php
index 55c60cce..69748c93 100644
--- a/includes/api/ApiCreateAccount.php
+++ b/includes/api/ApiCreateAccount.php
@@ -29,6 +29,10 @@
*/
class ApiCreateAccount extends ApiBase {
public function execute() {
+ // If we're in JSON callback mode, no tokens can be obtained
+ if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
+ $this->dieUsage( 'Cannot create account when using a callback', 'aborted' );
+ }
// $loginForm->addNewaccountInternal will throw exceptions
// if wiki is read only (already handled by api), user is blocked or does not have rights.
diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php
index b936d3be..b51d441d 100644
--- a/includes/api/ApiLogin.php
+++ b/includes/api/ApiLogin.php
@@ -46,6 +46,15 @@ class ApiLogin extends ApiBase {
* is reached. The expiry is $this->mLoginThrottle.
*/
public function execute() {
+ // If we're in JSON callback mode, no tokens can be obtained
+ if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
+ $this->getResult()->addValue( null, 'login', array(
+ 'result' => 'Aborted',
+ 'reason' => 'Cannot log in when using a callback',
+ ) );
+ return;
+ }
+
$params = $this->extractRequestParams();
$result = array();
diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index 80bca2f6..7b2fd914 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -714,15 +714,9 @@ class ApiMain extends ApiBase {
}
$moduleParams = $module->extractRequestParams();
- // Die if token required, but not provided (unless there is a gettoken parameter)
- if ( isset( $moduleParams['gettoken'] ) ) {
- $gettoken = $moduleParams['gettoken'];
- } else {
- $gettoken = false;
- }
-
+ // Die if token required, but not provided
$salt = $module->getTokenSalt();
- if ( $salt !== false && !$gettoken ) {
+ if ( $salt !== false ) {
if ( !isset( $moduleParams['token'] ) ) {
$this->dieUsageMsg( array( 'missingparam', 'token' ) );
} else {
diff --git a/includes/api/ApiQueryDeletedrevs.php b/includes/api/ApiQueryDeletedrevs.php
index 31ca1ef5..890e4ecf 100644
--- a/includes/api/ApiQueryDeletedrevs.php
+++ b/includes/api/ApiQueryDeletedrevs.php
@@ -57,6 +57,11 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
$fld_content = isset( $prop['content'] );
$fld_token = isset( $prop['token'] );
+ // If we're in JSON callback mode, no tokens can be obtained
+ if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
+ $fld_token = false;
+ }
+
$result = $this->getResult();
$pageSet = $this->getPageSet();
$titles = $pageSet->getTitles();
diff --git a/includes/api/ApiTokens.php b/includes/api/ApiTokens.php
index 7080f547..d220a5e6 100644
--- a/includes/api/ApiTokens.php
+++ b/includes/api/ApiTokens.php
@@ -48,6 +48,11 @@ class ApiTokens extends ApiBase {
}
private function getTokenTypes() {
+ // If we're in JSON callback mode, no tokens can be obtained
+ if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
+ return array();
+ }
+
static $types = null;
if ( $types ) {
return $types;
diff --git a/includes/api/ApiUnblock.php b/includes/api/ApiUnblock.php
index 55e7331d..6a739a2f 100644
--- a/includes/api/ApiUnblock.php
+++ b/includes/api/ApiUnblock.php
@@ -39,12 +39,6 @@ class ApiUnblock extends ApiBase {
$user = $this->getUser();
$params = $this->extractRequestParams();
- if ( $params['gettoken'] ) {
- $res['unblocktoken'] = $user->getEditToken();
- $this->getResult()->addValue( null, $this->getModuleName(), $res );
- return;
- }
-
if ( is_null( $params['id'] ) && is_null( $params['user'] ) ) {
$this->dieUsageMsg( 'unblock-notarget' );
}
@@ -96,10 +90,6 @@ class ApiUnblock extends ApiBase {
),
'user' => null,
'token' => null,
- 'gettoken' => array(
- ApiBase::PARAM_DFLT => false,
- ApiBase::PARAM_DEPRECATED => true,
- ),
'reason' => '',
);
}
@@ -110,7 +100,6 @@ class ApiUnblock extends ApiBase {
'id' => "ID of the block you want to unblock (obtained through list=blocks). Cannot be used together with {$p}user",
'user' => "Username, IP address or IP range you want to unblock. Cannot be used together with {$p}id",
'token' => "An unblock token previously obtained through prop=info",
- 'gettoken' => 'If set, an unblock token will be returned, and no other action will be taken',
'reason' => 'Reason for unblock',
);
}
@@ -118,10 +107,6 @@ class ApiUnblock extends ApiBase {
public function getResultProperties() {
return array(
'' => array(
- 'unblocktoken' => array(
- ApiBase::PROP_TYPE => 'string',
- ApiBase::PROP_NULLABLE => true
- ),
'id' => array(
ApiBase::PROP_TYPE => 'integer',
ApiBase::PROP_NULLABLE => true
diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php
index 639228b9..4f50bfaa 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -1484,6 +1484,7 @@ class LocalFile extends File {
* @return FileRepoStatus object.
*/
function delete( $reason, $suppress = false ) {
+ global $wgUseSquid;
if ( $this->getRepo()->getReadOnlyReason() !== false ) {
return $this->readOnlyFatalStatus();
}
@@ -1506,6 +1507,15 @@ class LocalFile extends File {
$this->purgeOldThumbnails( $archiveName );
}
+ if ( $wgUseSquid ) {
+ // Purge the squid
+ $purgeUrls = array();
+ foreach ($archiveNames as $archiveName ) {
+ $purgeUrls[] = $this->getArchiveUrl( $archiveName );
+ }
+ SquidUpdate::purge( $purgeUrls );
+ }
+
return $status;
}
@@ -1524,6 +1534,7 @@ class LocalFile extends File {
* @return FileRepoStatus object.
*/
function deleteOld( $archiveName, $reason, $suppress = false ) {
+ global $wgUseSquid;
if ( $this->getRepo()->getReadOnlyReason() !== false ) {
return $this->readOnlyFatalStatus();
}
@@ -1541,6 +1552,11 @@ class LocalFile extends File {
$this->purgeHistory();
}
+ if ( $wgUseSquid ) {
+ // Purge the squid
+ SquidUpdate::purge( array( $this->getArchiveUrl( $archiveName ) ) );
+ }
+
return $status;
}
diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php
index 4d8e5f0d..9fd67c93 100644
--- a/includes/installer/Installer.php
+++ b/includes/installer/Installer.php
@@ -46,6 +46,14 @@ abstract class Installer {
*/
protected $settings;
+
+ /**
+ * List of detected DBs, access using getCompiledDBs().
+ *
+ * @var array
+ */
+ protected $compiledDBs;
+
/**
* Cached DB installer instances, access using getDBInstaller().
*
@@ -173,7 +181,6 @@ abstract class Installer {
protected $internalDefaults = array(
'_UserLang' => 'en',
'_Environment' => false,
- '_CompiledDBs' => array(),
'_SafeMode' => false,
'_RaiseMemory' => false,
'_UpgradeDone' => false,
@@ -368,7 +375,7 @@ abstract class Installer {
}
}
}
- $this->setVar( '_CompiledDBs', $compiledDBs );
+ $this->compiledDBs = $compiledDBs;
$this->parserTitle = Title::newFromText( 'Installer' );
$this->parserOptions = new ParserOptions; // language will be wrong :(
@@ -450,6 +457,15 @@ abstract class Installer {
}
/**
+ * Get a list of DBs supported by current PHP setup
+ *
+ * @return array
+ */
+ public function getCompiledDBs() {
+ return $this->compiledDBs;
+ }
+
+ /**
* Get an instance of DatabaseInstaller for the specified DB type.
*
* @param $type Mixed: DB installer for which is needed, false to use default.
@@ -647,13 +663,7 @@ abstract class Installer {
$allNames[] = wfMessage( "config-type-$name" )->text();
}
- // cache initially available databases to make sure that everything will be displayed correctly
- // after a refresh on env checks page
- $databases = $this->getVar( '_CompiledDBs-preFilter' );
- if ( !$databases ) {
- $databases = $this->getVar( '_CompiledDBs' );
- $this->setVar( '_CompiledDBs-preFilter', $databases );
- }
+ $databases = $this->getCompiledDBs();
$databases = array_flip ( $databases );
foreach ( array_keys( $databases ) as $db ) {
@@ -672,7 +682,6 @@ abstract class Installer {
// @todo FIXME: This only works for the web installer!
return false;
}
- $this->setVar( '_CompiledDBs', $databases );
return true;
}
diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php
index 9d73e629..030c57fc 100644
--- a/includes/installer/MysqlUpdater.php
+++ b/includes/installer/MysqlUpdater.php
@@ -200,9 +200,9 @@ class MysqlUpdater extends DatabaseUpdater {
// 1.19
array( 'addIndex', 'logging', 'type_action', 'patch-logging-type-action-index.sql'),
+ array( 'addField', 'revision', 'rev_sha1', 'patch-rev_sha1.sql' ),
array( 'doMigrateUserOptions' ),
array( 'dropField', 'user', 'user_options', 'patch-drop-user_options.sql' ),
- array( 'addField', 'revision', 'rev_sha1', 'patch-rev_sha1.sql' ),
array( 'addField', 'archive', 'ar_sha1', 'patch-ar_sha1.sql' ),
array( 'addIndex', 'page', 'page_redirect_namespace_len', 'patch-page_redirect_namespace_len.sql' ),
array( 'addField', 'uploadstash', 'us_chunk_inx', 'patch-uploadstash_chunk.sql' ),
diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php
index 78830293..06d16a5a 100644
--- a/includes/installer/WebInstallerPage.php
+++ b/includes/installer/WebInstallerPage.php
@@ -462,7 +462,7 @@ class WebInstaller_DBConnect extends WebInstallerPage {
// It's possible that the library for the default DB type is not compiled in.
// In that case, instead select the first supported DB type in the list.
- $compiledDBs = $this->parent->getVar( '_CompiledDBs' );
+ $compiledDBs = $this->parent->getCompiledDBs();
if ( !in_array( $defaultType, $compiledDBs ) ) {
$defaultType = $compiledDBs[0];
}
diff --git a/includes/libs/IEUrlExtension.php b/includes/libs/IEUrlExtension.php
index 79387e63..49d05d4b 100644
--- a/includes/libs/IEUrlExtension.php
+++ b/includes/libs/IEUrlExtension.php
@@ -232,7 +232,7 @@ class IEUrlExtension {
}
// We found an illegal character or another dot
// Skip to that character and continue the loop
- $pos = $nextPos + 1;
+ $pos = $nextPos;
$remainingLength = $urlLength - $pos;
}
return false;
diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php
index 27f682c2..4e047be4 100644
--- a/includes/resourceloader/ResourceLoader.php
+++ b/includes/resourceloader/ResourceLoader.php
@@ -175,7 +175,7 @@ class ResourceLoader {
$cache->set( $key, $result );
} catch ( Exception $exception ) {
// Return exception as a comment
- $result = $this->makeComment( $exception->__toString() );
+ $result = $this->formatException( $exception );
$this->hasErrors = true;
}
@@ -461,7 +461,7 @@ class ResourceLoader {
$this->preloadModuleInfo( array_keys( $modules ), $context );
} catch( Exception $e ) {
// Add exception to the output as a comment
- $errors .= $this->makeComment( $e->__toString() );
+ $errors .= $this->formatException( $e );
$this->hasErrors = true;
}
@@ -479,7 +479,7 @@ class ResourceLoader {
$mtime = max( $mtime, $module->getModifiedTime( $context ) );
} catch ( Exception $e ) {
// Add exception to the output as a comment
- $errors .= $this->makeComment( $e->__toString() );
+ $errors .= $this->formatException( $e );
$this->hasErrors = true;
}
}
@@ -663,6 +663,22 @@ class ResourceLoader {
}
/**
+ * Handle exception display
+ *
+ * @param Exception $e to be shown to the user
+ * @return string sanitized text that can be returned to the user
+ */
+ protected function formatException( $e ) {
+ global $wgShowExceptionDetails;
+
+ if ( $wgShowExceptionDetails ) {
+ return $this->makeComment( $e->__toString() );
+ } else {
+ return $this->makeComment( wfMessage( 'internalerror' )->text() );
+ }
+ }
+
+ /**
* Generates code for a response
*
* @param $context ResourceLoaderContext: Context in which to generate a response
@@ -686,7 +702,7 @@ class ResourceLoader {
$blobs = MessageBlobStore::get( $this, $modules, $context->getLanguage() );
} catch ( Exception $e ) {
// Add exception to the output as a comment
- $exceptions .= $this->makeComment( $e->__toString() );
+ $exceptions .= $this->formatException( $e );
$this->hasErrors = true;
}
} else {
@@ -792,7 +808,7 @@ class ResourceLoader {
}
} catch ( Exception $e ) {
// Add exception to the output as a comment
- $exceptions .= $this->makeComment( $e->__toString() );
+ $exceptions .= $this->formatException( $e );
$this->hasErrors = true;
// Register module as missing
diff --git a/includes/revisiondelete/RevisionDelete.php b/includes/revisiondelete/RevisionDelete.php
index 1ace3836..f4c07968 100644
--- a/includes/revisiondelete/RevisionDelete.php
+++ b/includes/revisiondelete/RevisionDelete.php
@@ -499,9 +499,20 @@ class RevDel_FileList extends RevDel_List {
}
public function doPostCommitUpdates() {
+ global $wgUseSquid;
$file = wfLocalFile( $this->title );
$file->purgeCache();
$file->purgeDescription();
+ $purgeUrls = array();
+ foreach ( $this->ids as $timestamp ) {
+ $archiveName = $timestamp . '!' . $this->title->getDBkey();
+ $file->purgeOldThumbnails( $archiveName );
+ $purgeUrls[] = $file->getArchiveUrl( $archiveName );
+ }
+ if ( $wgUseSquid ) {
+ // purge full images from cache
+ SquidUpdate::purge( $purgeUrls );
+ }
return Status::newGood();
}
diff --git a/includes/zhtable/trad2simp_supp_unset.manual b/includes/zhtable/trad2simp_supp_unset.manual
deleted file mode 100644
index e69de29b..00000000
--- a/includes/zhtable/trad2simp_supp_unset.manual
+++ /dev/null