From: Siebrand Mazeland Date: Wed, 5 Feb 2014 11:02:29 +0000 (+0100) Subject: Update formatting X-Git-Tag: 1.31.0-rc.0~16996^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=f077c4b1d6fd38de065353eccaa60b6b25c3e302;p=lhc%2Fweb%2Fwiklou.git Update formatting Change-Id: I18aff576262479c9bb1c56eb8e1d1aaae200e4b1 --- diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index bab2f931b7..b753407e4a 100644 --- a/includes/actions/RawAction.php +++ b/includes/actions/RawAction.php @@ -165,7 +165,7 @@ class RawAction extends FormlessAction { } elseif ( !$content instanceof TextContent ) { // non-text content wfHttpError( 415, "Unsupported Media Type", "The requested page uses the content model `" - . $content->getModel() . "` which is not supported via this interface." ); + . $content->getModel() . "` which is not supported via this interface." ); die(); } else { // want a section? diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 900c7beb77..72b1f888bf 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1406,6 +1406,7 @@ abstract class ApiBase extends ContextSource { // Translate message to code, for backwards compatability $code = ApiBase::$messageMap[$code]['code']; } + return array( $code, $msg->inLanguage( 'en' )->useDatabase( false )->plain() ); } diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 4ecf029495..c71253982d 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -546,7 +546,7 @@ class ApiPageSet extends ApiBase { self::addValues( $result, $this->getSpecialTitles(), 'special', 'title' ); } if ( in_array( "missingIds", $invalidChecks ) ) { - self::addValues( $result, $this->getMissingPageIDs(), 'missing', 'pageid' ); + self::addValues( $result, $this->getMissingPageIDs(), 'missing', 'pageid' ); } if ( in_array( "missingRevIds", $invalidChecks ) ) { self::addValues( $result, $this->getMissingRevisionIDs(), 'missing', 'revid' ); @@ -557,6 +557,7 @@ class ApiPageSet extends ApiBase { if ( in_array( "interwikiTitles", $invalidChecks ) ) { self::addValues( $result, $this->getInterwikiTitlesAsResult() ); } + return $result; } diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index 80c76b30a7..644e97ee2a 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -92,10 +92,13 @@ class ApiProtect extends ApiBase { } $expiryarray[$p[0]] = $exp; } - $resultProtections[] = array( $p[0] => $protections[$p[0]], - 'expiry' => ( $expiryarray[$p[0]] == $db->getInfinity() ? - 'infinite' : - wfTimestamp( TS_ISO_8601, $expiryarray[$p[0]] ) ) ); + $resultProtections[] = array( + $p[0] => $protections[$p[0]], + 'expiry' => ( $expiryarray[$p[0]] == $db->getInfinity() + ? 'infinite' + : wfTimestamp( TS_ISO_8601, $expiryarray[$p[0]] ) + ) + ); } $cascade = $params['cascade']; diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index eb510953c7..9d9f7c3d09 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -501,6 +501,7 @@ abstract class ApiQueryBase extends ApiBase { // prefix. $this->dieUsageMsg( array( 'invalidtitle', $titlePart ) ); } + return substr( $t->getDbKey(), 0, -1 ); } diff --git a/includes/api/ApiQueryContributors.php b/includes/api/ApiQueryContributors.php index 6b896e3290..37fb489564 100644 --- a/includes/api/ApiQueryContributors.php +++ b/includes/api/ApiQueryContributors.php @@ -98,6 +98,7 @@ class ApiQueryContributors extends ApiQueryBase { $this->setContinueEnumParameter( 'continue', $params['continue'] !== null ? $params['continue'] : '0|0' ); + return; } } @@ -144,6 +145,7 @@ class ApiQueryContributors extends ApiQueryBase { // of anoncontributors $this->setContinueEnumParameter( 'continue', $continuePages ); } + return; } } elseif ( $params['excluderights'] ) { @@ -182,6 +184,7 @@ class ApiQueryContributors extends ApiQueryBase { // We've reached the one extra which shows that // there are additional pages to be had. Stop here... $this->setContinueEnumParameter( 'continue', $row->page . '|' . $row->user ); + return; } @@ -191,6 +194,7 @@ class ApiQueryContributors extends ApiQueryBase { ); if ( !$fit ) { $this->setContinueEnumParameter( 'continue', $row->page . '|' . $row->user ); + return; } } @@ -269,7 +273,6 @@ class ApiQueryContributors extends ApiQueryBase { ); } - public function getDescription() { return 'Get the list of logged-in contributors and ' . 'the count of anonymous contributors to a page'; diff --git a/includes/api/ApiQueryFileRepoInfo.php b/includes/api/ApiQueryFileRepoInfo.php index dffe3019cd..d9579a1016 100644 --- a/includes/api/ApiQueryFileRepoInfo.php +++ b/includes/api/ApiQueryFileRepoInfo.php @@ -36,6 +36,7 @@ class ApiQueryFileRepoInfo extends ApiQueryBase { protected function getInitialisedRepoGroup() { $repoGroup = RepoGroup::singleton(); $repoGroup->initialiseRepos(); + return $repoGroup; } diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index a9a5f5faa5..9cf3afd563 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -562,7 +562,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { $vcsVersion = $gitInfo->getHeadSHA1(); if ( $vcsVersion !== false ) { $ret['vcs-system'] = 'git'; - $ret['vcs-version'] = $vcsVersion; + $ret['vcs-version'] = $vcsVersion; $ret['vcs-url'] = $gitInfo->getHeadViewUrl(); $ret['vcs-date'] = wfTimestamp( TS_ISO_8601, $gitInfo->getHeadCommitDate() ); } else { diff --git a/includes/api/ApiRevisionDelete.php b/includes/api/ApiRevisionDelete.php index 9ba30d710d..05457b3d11 100644 --- a/includes/api/ApiRevisionDelete.php +++ b/includes/api/ApiRevisionDelete.php @@ -129,6 +129,7 @@ class ApiRevisionDelete extends ApiBase { $this->getResult()->setIndexedTagName( $warnings, 'w' ); $ret['warnings'] = $warnings; } + return $ret; } @@ -159,6 +160,7 @@ class ApiRevisionDelete extends ApiBase { $message['rendered'] = $msg->useDatabase( false )->inLanguage( 'en' )->plain(); $ret[] = $message; } + return $ret; } diff --git a/includes/api/ApiWatch.php b/includes/api/ApiWatch.php index d0049ffac7..100ee96270 100644 --- a/includes/api/ApiWatch.php +++ b/includes/api/ApiWatch.php @@ -134,12 +134,12 @@ class ApiWatch extends ApiBase { if ( $compatibilityMode ) { $this->dieStatus( $status ); } - $res['error'] = $this->getErrorFromStatus( $status ); + $res['error'] = $this->getErrorFromStatus( $status ); } + return $res; } - /** * Get a cached instance of an ApiPageSet object * @return ApiPageSet @@ -148,6 +148,7 @@ class ApiWatch extends ApiBase { if ( $this->mPageSet === null ) { $this->mPageSet = new ApiPageSet( $this ); } + return $this->mPageSet; } @@ -183,11 +184,13 @@ class ApiWatch extends ApiBase { if ( $flags ) { $result += $this->getPageSet()->getFinalParams( $flags ); } + return $result; } public function getParamDescription() { $psModule = $this->getPageSet(); + return $psModule->getParamDescription() + array( 'title' => 'The page to (un)watch. use titles instead', 'unwatch' => 'If set the page will be unwatched rather than watched', diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index 915a43e7e2..409160c5ec 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -559,6 +559,7 @@ class LocalisationCache { unset( $data[$key] ); } } + // The JSON format only supports messages, none of the other variables, so wrap the data return array( 'messages' => $data ); } diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index 470b150c6c..b996894088 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -248,6 +248,7 @@ class ChangesList extends ContextSource { public function endRecentChangesList() { $out = $this->rclistOpen ? "\n" : ''; $out .= ''; + return $out; } diff --git a/includes/changes/OldChangesList.php b/includes/changes/OldChangesList.php index 56630a64bf..9cb1146162 100644 --- a/includes/changes/OldChangesList.php +++ b/includes/changes/OldChangesList.php @@ -19,6 +19,7 @@ * * @file */ + class OldChangesList extends ChangesList { /** * Format a line using the old system (aka without any javascript). diff --git a/includes/changes/RCCacheEntry.php b/includes/changes/RCCacheEntry.php index 271dd4a57c..07a9409107 100644 --- a/includes/changes/RCCacheEntry.php +++ b/includes/changes/RCCacheEntry.php @@ -17,6 +17,7 @@ * * @file */ + class RCCacheEntry extends RecentChange { public $curlink; public $difflink; diff --git a/includes/config/Config.php b/includes/config/Config.php index 067b1e4527..04afddad14 100644 --- a/includes/config/Config.php +++ b/includes/config/Config.php @@ -25,9 +25,7 @@ * * @since 1.23 */ - abstract class Config { - /** * @param string $name configuration variable name without prefix * @param string $prefix of the variable name diff --git a/includes/config/GlobalConfig.php b/includes/config/GlobalConfig.php index 1b1cd8924a..e16a9ee728 100644 --- a/includes/config/GlobalConfig.php +++ b/includes/config/GlobalConfig.php @@ -39,6 +39,7 @@ class GlobalConfig extends Config { */ public function set( $name, $value, $prefix = 'wg' ) { $GLOBALS[$prefix . $name] = $value; + return Status::newGood(); } } diff --git a/includes/content/WikitextContent.php b/includes/content/WikitextContent.php index a92699ba8f..f495c56f5f 100644 --- a/includes/content/WikitextContent.php +++ b/includes/content/WikitextContent.php @@ -202,6 +202,7 @@ class WikitextContent extends TextContent { */ public function getRedirectTarget() { list( $title, ) = $this->getRedirectTargetAndText(); + return $title; } diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index 978ef03c3f..aabdd9da15 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -86,6 +86,7 @@ class RequestContext implements IContextSource { if ( $this->config === null ) { $this->config = Config::factory(); } + return $this->config; } diff --git a/includes/db/Database.php b/includes/db/Database.php index f94d5861d5..c6f261199a 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2758,7 +2758,7 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { * @param string $delTable The table to delete from. * @param string $joinTable The other table. * @param string $delVar The variable to join on, in the first table. - * @param string$joinVar The variable to join on, in the second table. + * @param string $joinVar The variable to join on, in the second table. * @param array $conds Condition array of field names mapped to variables, * ANDed together in the WHERE clause * @param string $fname Calling function name (use __METHOD__) for logs/profiling diff --git a/includes/db/DatabaseMysqli.php b/includes/db/DatabaseMysqli.php index d41f3e4c69..e202f8a926 100644 --- a/includes/db/DatabaseMysqli.php +++ b/includes/db/DatabaseMysqli.php @@ -244,6 +244,7 @@ class DatabaseMysqli extends DatabaseMysqlBase { */ protected function mysqlFieldType( $res, $n ) { $field = $res->fetch_field_direct( $n ); + return $field->type; } diff --git a/includes/deferred/LinksUpdate.php b/includes/deferred/LinksUpdate.php index 01555ffac4..79232e5d45 100644 --- a/includes/deferred/LinksUpdate.php +++ b/includes/deferred/LinksUpdate.php @@ -256,7 +256,7 @@ class LinksUpdate extends SqlDataUpdate { $job = new RefreshLinksJob( $title, array( - 'table' => $table, + 'table' => $table, 'recursive' => true, ) + Job::newRootJobParams( // "overall" refresh links job info "refreshlinks:{$table}:{$title->getPrefixedText()}" diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 47135a38e1..d6cf69494c 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -88,7 +88,7 @@ class DifferenceEngine extends ContextSource { */ protected $mReducedLineNumbers = false; - /** @var string Link to action=markpatrolled */ + /** @var string Link to action=markpatrolled */ protected $mMarkPatrolledLink = null; /** @var bool Show rev_deleted content if allowed */ @@ -965,7 +965,8 @@ class DifferenceEngine extends ContextSource { $limit = 100; // use diff-multi-manyusers if too many users $users = $this->mNewPage->getAuthorsBetween( $oldRev, $newRev, $limit ); $numUsers = count( $users ); - if( $numUsers == 1 && $users[0] == $newRev->getRawUserText() ) { + + if ( $numUsers == 1 && $users[0] == $newRev->getRawUserText() ) { $numUsers = 0; // special case to say "by the same user" instead of "by one other user" } diff --git a/includes/filebackend/FSFile.php b/includes/filebackend/FSFile.php index 047aefd973..34f6b51b8e 100644 --- a/includes/filebackend/FSFile.php +++ b/includes/filebackend/FSFile.php @@ -30,7 +30,7 @@ class FSFile { /** @var string Path to file */ protected $path; - /** @var string File SHA-1 in base 36 */ + /** @var string File SHA-1 in base 36 */ protected $sha1Base36; /** diff --git a/includes/filebackend/FileBackend.php b/includes/filebackend/FileBackend.php index f5d63b9df7..00a4d5e4e6 100644 --- a/includes/filebackend/FileBackend.php +++ b/includes/filebackend/FileBackend.php @@ -105,7 +105,7 @@ abstract class FileBackend { protected $fileJournal; /** Flags for supported features */ - const ATTR_HEADERS = 1; + const ATTR_HEADERS = 1; const ATTR_METADATA = 2; /** diff --git a/includes/filebackend/FileBackendMultiWrite.php b/includes/filebackend/FileBackendMultiWrite.php index 1b2860a201..81d088eb67 100644 --- a/includes/filebackend/FileBackendMultiWrite.php +++ b/includes/filebackend/FileBackendMultiWrite.php @@ -45,7 +45,7 @@ class FileBackendMultiWrite extends FileBackend { */ protected $backends = array(); - /** @var int Index of master backend */ + /** @var int Index of master backend */ protected $masterIndex = -1; /** @var int Bitfield */ @@ -569,6 +569,7 @@ class FileBackendMultiWrite extends FileBackend { public function getFileXAttributes( array $params ) { $realParams = $this->substOpPaths( $params, $this->backends[$this->masterIndex] ); + return $this->backends[$this->masterIndex]->getFileXAttributes( $realParams ); } diff --git a/includes/filebackend/FileBackendStore.php b/includes/filebackend/FileBackendStore.php index 13f6436a80..50371f859e 100644 --- a/includes/filebackend/FileBackendStore.php +++ b/includes/filebackend/FileBackendStore.php @@ -724,6 +724,7 @@ abstract class FileBackendStore extends FileBackend { wfProfileOut( __METHOD__ . '-miss-' . $this->name ); wfProfileOut( __METHOD__ . '-miss' ); $this->cheapCache->set( $path, 'xattr', array( 'map' => $fields, 'latest' => $latest ) ); + return $fields; } @@ -1681,12 +1682,15 @@ abstract class FileBackendStore extends FileBackend { */ final protected static function normalizeXAttributes( array $xattr ) { $newXAttr = array( 'headers' => array(), 'metadata' => array() ); + foreach ( $xattr['headers'] as $name => $value ) { $newXAttr['headers'][strtolower( $name )] = $value; } + foreach ( $xattr['metadata'] as $name => $value ) { $newXAttr['metadata'][strtolower( $name )] = $value; } + return $newXAttr; } diff --git a/includes/filebackend/FileOpBatch.php b/includes/filebackend/FileOpBatch.php index b42e140450..e90fcb7820 100644 --- a/includes/filebackend/FileOpBatch.php +++ b/includes/filebackend/FileOpBatch.php @@ -61,6 +61,7 @@ class FileOpBatch { $n = count( $performOps ); if ( $n > self::MAX_BATCH_SIZE ) { $status->fatal( 'backend-fail-batchsize', $n, self::MAX_BATCH_SIZE ); + return $status; } diff --git a/includes/filebackend/MemoryFileBackend.php b/includes/filebackend/MemoryFileBackend.php index 6f40957a6e..7c2f8256ca 100644 --- a/includes/filebackend/MemoryFileBackend.php +++ b/includes/filebackend/MemoryFileBackend.php @@ -45,11 +45,12 @@ class MemoryFileBackend extends FileBackendStore { $dst = $this->resolveHashKey( $params['dst'] ); if ( $dst === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); + return $status; } $this->files[$dst] = array( - 'data' => $params['content'], + 'data' => $params['content'], 'mtime' => wfTimestamp( TS_MW, time() ) ); @@ -62,6 +63,7 @@ class MemoryFileBackend extends FileBackendStore { $dst = $this->resolveHashKey( $params['dst'] ); if ( $dst === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); + return $status; } @@ -70,11 +72,12 @@ class MemoryFileBackend extends FileBackendStore { wfRestoreWarnings(); if ( $data === false ) { // source doesn't exist? $status->fatal( 'backend-fail-store', $params['src'], $params['dst'] ); + return $status; } $this->files[$dst] = array( - 'data' => $data, + 'data' => $data, 'mtime' => wfTimestamp( TS_MW, time() ) ); @@ -87,12 +90,14 @@ class MemoryFileBackend extends FileBackendStore { $src = $this->resolveHashKey( $params['src'] ); if ( $src === null ) { $status->fatal( 'backend-fail-invalidpath', $params['src'] ); + return $status; } $dst = $this->resolveHashKey( $params['dst'] ); if ( $dst === null ) { $status->fatal( 'backend-fail-invalidpath', $params['dst'] ); + return $status; } @@ -100,11 +105,12 @@ class MemoryFileBackend extends FileBackendStore { if ( empty( $params['ignoreMissingSource'] ) ) { $status->fatal( 'backend-fail-copy', $params['src'], $params['dst'] ); } + return $status; } $this->files[$dst] = array( - 'data' => $this->files[$src]['data'], + 'data' => $this->files[$src]['data'], 'mtime' => wfTimestamp( TS_MW, time() ) ); @@ -117,6 +123,7 @@ class MemoryFileBackend extends FileBackendStore { $src = $this->resolveHashKey( $params['src'] ); if ( $src === null ) { $status->fatal( 'backend-fail-invalidpath', $params['src'] ); + return $status; } @@ -124,6 +131,7 @@ class MemoryFileBackend extends FileBackendStore { if ( empty( $params['ignoreMissingSource'] ) ) { $status->fatal( 'backend-fail-delete', $params['src'] ); } + return $status; } @@ -141,7 +149,7 @@ class MemoryFileBackend extends FileBackendStore { if ( isset( $this->files[$src] ) ) { return array( 'mtime' => $this->files[$src]['mtime'], - 'size' => strlen( $this->files[$src]['data'] ), + 'size' => strlen( $this->files[$src]['data'] ), ); } @@ -167,6 +175,7 @@ class MemoryFileBackend extends FileBackendStore { } $tmpFiles[$srcPath] = $fsFile; } + return $tmpFiles; } @@ -176,6 +185,7 @@ class MemoryFileBackend extends FileBackendStore { $src = $this->resolveHashKey( $params['src'] ); if ( $src === null || !isset( $this->files[$src] ) ) { $status->fatal( 'backend-fail-stream', $params['src'] ); + return $status; } @@ -191,6 +201,7 @@ class MemoryFileBackend extends FileBackendStore { return true; } } + return false; } @@ -219,6 +230,7 @@ class MemoryFileBackend extends FileBackendStore { } } } + return array_keys( $dirs ); } @@ -237,6 +249,7 @@ class MemoryFileBackend extends FileBackendStore { $files[] = $relPath; } } + return $files; } @@ -255,6 +268,7 @@ class MemoryFileBackend extends FileBackendStore { if ( $relPath === null ) { return null; // invalid } + return ( $relPath !== '' ) ? "$fullCont/$relPath" : $fullCont; } } diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index c3d2de8bd1..d524cc2bc1 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -176,7 +176,7 @@ class SwiftFileBackend extends FileBackendStore { $headers = array(); // Normalize casing, and strip out illegal headers - if ( isset( $params['headers'] ) ) { + if ( isset( $params['headers'] ) ) { foreach ( $params['headers'] as $name => $value ) { $name = strtolower( $name ); if ( preg_match( '/^content-(type|length)$/', $name ) ) { @@ -220,20 +220,20 @@ class SwiftFileBackend extends FileBackendStore { $contentType = $this->getContentType( $params['dst'], $params['content'], null ); $reqs = array( array( - 'method' => 'PUT', - 'url' => array( $dstCont, $dstRel ), + 'method' => 'PUT', + 'url' => array( $dstCont, $dstRel ), 'headers' => array( - 'content-length' => strlen( $params['content'] ), - 'etag' => md5( $params['content'] ), - 'content-type' => $contentType, + 'content-length' => strlen( $params['content'] ), + 'etag' => md5( $params['content'] ), + 'content-type' => $contentType, 'x-object-meta-sha1base36' => $sha1Hash ) + $this->sanitizeHdrs( $params ), - 'body' => $params['content'] + 'body' => $params['content'] ) ); $be = $this; $method = __METHOD__; - $handler = function( array $request, Status $status ) use ( $be, $method, $params ) { + $handler = function ( array $request, Status $status ) use ( $be, $method, $params ) { list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $request['response']; if ( $rcode === 201 ) { // good @@ -283,20 +283,20 @@ class SwiftFileBackend extends FileBackendStore { } $reqs = array( array( - 'method' => 'PUT', - 'url' => array( $dstCont, $dstRel ), + 'method' => 'PUT', + 'url' => array( $dstCont, $dstRel ), 'headers' => array( - 'content-length' => filesize( $params['src'] ), - 'etag' => md5_file( $params['src'] ), - 'content-type' => $contentType, + 'content-length' => filesize( $params['src'] ), + 'etag' => md5_file( $params['src'] ), + 'content-type' => $contentType, 'x-object-meta-sha1base36' => $sha1Hash ) + $this->sanitizeHdrs( $params ), - 'body' => $handle // resource + 'body' => $handle // resource ) ); $be = $this; $method = __METHOD__; - $handler = function( array $request, Status $status ) use ( $be, $method, $params ) { + $handler = function ( array $request, Status $status ) use ( $be, $method, $params ) { list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $request['response']; if ( $rcode === 201 ) { // good @@ -335,8 +335,8 @@ class SwiftFileBackend extends FileBackendStore { } $reqs = array( array( - 'method' => 'PUT', - 'url' => array( $dstCont, $dstRel ), + 'method' => 'PUT', + 'url' => array( $dstCont, $dstRel ), 'headers' => array( 'x-copy-from' => '/' . rawurlencode( $srcCont ) . '/' . str_replace( "%2F", "/", rawurlencode( $srcRel ) ) @@ -345,7 +345,7 @@ class SwiftFileBackend extends FileBackendStore { $be = $this; $method = __METHOD__; - $handler = function( array $request, Status $status ) use ( $be, $method, $params ) { + $handler = function ( array $request, Status $status ) use ( $be, $method, $params ) { list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $request['response']; if ( $rcode === 201 ) { // good @@ -385,8 +385,8 @@ class SwiftFileBackend extends FileBackendStore { $reqs = array( array( - 'method' => 'PUT', - 'url' => array( $dstCont, $dstRel ), + 'method' => 'PUT', + 'url' => array( $dstCont, $dstRel ), 'headers' => array( 'x-copy-from' => '/' . rawurlencode( $srcCont ) . '/' . str_replace( "%2F", "/", rawurlencode( $srcRel ) ) @@ -395,15 +395,15 @@ class SwiftFileBackend extends FileBackendStore { ); if ( "{$srcCont}/{$srcRel}" !== "{$dstCont}/{$dstRel}" ) { $reqs[] = array( - 'method' => 'DELETE', - 'url' => array( $srcCont, $srcRel ), + 'method' => 'DELETE', + 'url' => array( $srcCont, $srcRel ), 'headers' => array() ); } $be = $this; $method = __METHOD__; - $handler = function( array $request, Status $status ) use ( $be, $method, $params ) { + $handler = function ( array $request, Status $status ) use ( $be, $method, $params ) { list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $request['response']; if ( $request['method'] === 'PUT' && $rcode === 201 ) { // good @@ -436,16 +436,15 @@ class SwiftFileBackend extends FileBackendStore { return $status; } - $reqs = array( - array( - 'method' => 'DELETE', - 'url' => array( $srcCont, $srcRel ), - 'headers' => array() + $reqs = array( array( + 'method' => 'DELETE', + 'url' => array( $srcCont, $srcRel ), + 'headers' => array() ) ); $be = $this; $method = __METHOD__; - $handler = function( array $request, Status $status ) use ( $be, $method, $params ) { + $handler = function ( array $request, Status $status ) use ( $be, $method, $params ) { list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $request['response']; if ( $rcode === 204 ) { // good @@ -497,14 +496,14 @@ class SwiftFileBackend extends FileBackendStore { $customHdrs = $this->sanitizeHdrs( $params ) + $stat['xattr']['headers']; $reqs = array( array( - 'method' => 'POST', - 'url' => array( $srcCont, $srcRel ), + 'method' => 'POST', + 'url' => array( $srcCont, $srcRel ), 'headers' => $metaHdrs + $customHdrs ) ); $be = $this; $method = __METHOD__; - $handler = function( array $request, Status $status ) use ( $be, $method, $params ) { + $handler = function ( array $request, Status $status ) use ( $be, $method, $params ) { list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $request['response']; if ( $rcode === 202 ) { // good @@ -534,6 +533,7 @@ class SwiftFileBackend extends FileBackendStore { return $status; // already there } elseif ( $stat === null ) { $status->fatal( 'backend-fail-internal', $this->name ); + return $status; } @@ -603,6 +603,7 @@ class SwiftFileBackend extends FileBackendStore { return $status; // ok, nothing to do } elseif ( !is_array( $stat ) ) { $status->fatal( 'backend-fail-internal', $this->name ); + return $status; } @@ -636,8 +637,8 @@ class SwiftFileBackend extends FileBackendStore { // (b) Check the file list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( array( - 'method' => 'HEAD', - 'url' => $this->storageUrl( $auth, $srcCont, $srcRel ), + 'method' => 'HEAD', + 'url' => $this->storageUrl( $auth, $srcCont, $srcRel ), 'headers' => $this->authTokenHeaders( $auth ) + $this->headersFromParams( $params ) ) ); if ( $rcode === 200 || $rcode === 204 ) { @@ -656,9 +657,9 @@ class SwiftFileBackend extends FileBackendStore { // Convert various random Swift dates to TS_MW 'mtime' => $this->convertSwiftDate( $rhdrs['last-modified'], TS_MW ), // Empty objects actually return no content-length header in Ceph - 'size' => isset( $rhdrs['content-length'] ) ? (int)$rhdrs['content-length'] : 0, - 'sha1' => $rhdrs[ 'x-object-meta-sha1base36'], - 'md5' => ctype_xdigit( $rhdrs['etag'] ) ? $rhdrs['etag'] : null, + 'size' => isset( $rhdrs['content-length'] ) ? (int)$rhdrs['content-length'] : 0, + 'sha1' => $rhdrs['x-object-meta-sha1base36'], + 'md5' => ctype_xdigit( $rhdrs['etag'] ) ? $rhdrs['etag'] : null, 'xattr' => array( 'metadata' => $metadata, 'headers' => $headers ) ); } elseif ( $rcode === 404 ) { @@ -684,6 +685,7 @@ class SwiftFileBackend extends FileBackendStore { protected function convertSwiftDate( $ts, $format = TS_MW ) { try { $timestamp = new MWTimestamp( $ts ); + return $timestamp->getTimestamp( $format ); } catch ( MWException $e ) { throw new FileBackendError( $e->getMessage() ); @@ -708,6 +710,7 @@ class SwiftFileBackend extends FileBackendStore { $auth = $this->getAuthentication(); if ( !$auth ) { $objHdrs['x-object-meta-sha1base36'] = false; + return $objHdrs; // failed } @@ -721,8 +724,8 @@ class SwiftFileBackend extends FileBackendStore { $objHdrs['x-object-meta-sha1base36'] = $hash; list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $path ); list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( array( - 'method' => 'POST', - 'url' => $this->storageUrl( $auth, $srcCont, $srcRel ), + 'method' => 'POST', + 'url' => $this->storageUrl( $auth, $srcCont, $srcRel ), 'headers' => $this->authTokenHeaders( $auth ) + $objHdrs ) ); if ( $rcode >= 200 && $rcode <= 299 ) { @@ -759,11 +762,11 @@ class SwiftFileBackend extends FileBackendStore { $handle = fopen( 'php://temp', 'wb' ); if ( $handle ) { $reqs[$path] = array( - 'method' => 'GET', - 'url' => $this->storageUrl( $auth, $srcCont, $srcRel ), + 'method' => 'GET', + 'url' => $this->storageUrl( $auth, $srcCont, $srcRel ), 'headers' => $this->authTokenHeaders( $auth ) + $this->headersFromParams( $params ), - 'stream' => $handle, + 'stream' => $handle, ); } else { $data = false; @@ -796,6 +799,7 @@ class SwiftFileBackend extends FileBackendStore { if ( $status->isOk() ) { return ( count( $status->value ) ); } + return null; // error } @@ -853,20 +857,25 @@ class SwiftFileBackend extends FileBackendStore { $dirs[] = $object; // directories end in '/' } } - // Recursive: list all dirs under $dir and its subdirs } else { - $getParentDir = function( $path ) { + // Recursive: list all dirs under $dir and its subdirs + $getParentDir = function ( $path ) { return ( strpos( $path, '/' ) !== false ) ? dirname( $path ) : false; }; + // Get directory from last item of prior page $lastDir = $getParentDir( $after ); // must be first page $status = $this->objectListing( $fullCont, 'names', $limit, $after, $prefix ); + if ( !$status->isOk() ) { return $dirs; // error } + $objects = $status->value; + foreach ( $objects as $object ) { // files $objectDir = $getParentDir( $object ); // directory of object + if ( $objectDir !== false && $objectDir !== $dir ) { // Swift stores paths in UTF-8, using binary sorting. // See function "create_container_table" in common/db.py. @@ -924,20 +933,23 @@ class SwiftFileBackend extends FileBackendStore { } else { $status = $this->objectListing( $fullCont, 'names', $limit, $after, $prefix, '/' ); } - // Recursive: list all files under $dir and its subdirs } else { + // Recursive: list all files under $dir and its subdirs if ( !empty( $params['adviseStat'] ) ) { $status = $this->objectListing( $fullCont, 'info', $limit, $after, $prefix ); } else { $status = $this->objectListing( $fullCont, 'names', $limit, $after, $prefix ); } } + // Reformat this list into a list of (name, stat array or null) entries if ( !$status->isOk() ) { return $files; // error } + $objects = $status->value; $files = $this->buildFileObjectListing( $params, $dir, $objects ); + // Page on the unfiltered object listing (what is returned may be filtered) if ( count( $objects ) < $limit ) { $after = INF; // avoid a second RTT @@ -967,9 +979,9 @@ class SwiftFileBackend extends FileBackendStore { } $stat = array( // Convert various random Swift dates to TS_MW - 'mtime' => $this->convertSwiftDate( $object->last_modified, TS_MW ), - 'size' => (int)$object->bytes, - 'md5' => ctype_xdigit( $object->hash ) ? $object->hash : null, + 'mtime' => $this->convertSwiftDate( $object->last_modified, TS_MW ), + 'size' => (int)$object->bytes, + 'md5' => ctype_xdigit( $object->hash ) ? $object->hash : null, 'latest' => false // eventually consistent ); $names[] = array( $object->name, $stat ); @@ -1000,6 +1012,7 @@ class SwiftFileBackend extends FileBackendStore { $this->clearCache( array( $params['src'] ) ); $stat = $this->getFileStat( $params ); } + return $stat['xattr']; } else { return false; @@ -1032,17 +1045,18 @@ class SwiftFileBackend extends FileBackendStore { $auth = $this->getAuthentication(); if ( !$auth || !is_array( $this->getContainerStat( $srcCont ) ) ) { $status->fatal( 'backend-fail-stream', $params['src'] ); + return $status; } $handle = fopen( 'php://output', 'wb' ); list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( array( - 'method' => 'GET', - 'url' => $this->storageUrl( $auth, $srcCont, $srcRel ), + 'method' => 'GET', + 'url' => $this->storageUrl( $auth, $srcCont, $srcRel ), 'headers' => $this->authTokenHeaders( $auth ) + $this->headersFromParams( $params ), - 'stream' => $handle, + 'stream' => $handle, ) ); if ( $rcode >= 200 && $rcode <= 299 ) { @@ -1082,11 +1096,11 @@ class SwiftFileBackend extends FileBackendStore { $handle = fopen( $tmpFile->getPath(), 'wb' ); if ( $handle ) { $reqs[$path] = array( - 'method' => 'GET', - 'url' => $this->storageUrl( $auth, $srcCont, $srcRel ), + 'method' => 'GET', + 'url' => $this->storageUrl( $auth, $srcCont, $srcRel ), 'headers' => $this->authTokenHeaders( $auth ) + $this->headersFromParams( $params ), - 'stream' => $handle, + 'stream' => $handle, ); } else { $tmpFile = null; @@ -1142,6 +1156,7 @@ class SwiftFileBackend extends FileBackendStore { "GET\n{$expires}\n{$contPath}/{$srcRel}", $this->swiftTempUrlKey ); + return "{$url}?temp_url_sig={$signature}&temp_url_expires={$expires}"; } else { // give S3 API URL for rgw // Path for signature starts with the bucket @@ -1199,6 +1214,7 @@ class SwiftFileBackend extends FileBackendStore { foreach ( $fileOpHandles as $index => $fileOpHandle ) { $statuses[$index] = Status::newFatal( 'backend-fail-connect', $this->name ); } + return $statuses; } @@ -1263,18 +1279,19 @@ class SwiftFileBackend extends FileBackendStore { */ protected function setContainerAccess( $container, array $readGrps, array $writeGrps ) { $status = Status::newGood(); - $auth = $this->getAuthentication(); + if ( !$auth ) { $status->fatal( 'backend-fail-connect', $this->name ); + return $status; } list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( array( - 'method' => 'POST', - 'url' => $this->storageUrl( $auth, $container ), + 'method' => 'POST', + 'url' => $this->storageUrl( $auth, $container ), 'headers' => $this->authTokenHeaders( $auth ) + array( - 'x-container-read' => implode( ',', $readGrps ), + 'x-container-read' => implode( ',', $readGrps ), 'x-container-write' => implode( ',', $writeGrps ) ) ) ); @@ -1307,8 +1324,8 @@ class SwiftFileBackend extends FileBackendStore { } list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( array( - 'method' => 'HEAD', - 'url' => $this->storageUrl( $auth, $container ), + 'method' => 'HEAD', + 'url' => $this->storageUrl( $auth, $container ), 'headers' => $this->authTokenHeaders( $auth ) ) ); @@ -1327,6 +1344,7 @@ class SwiftFileBackend extends FileBackendStore { } else { $this->onError( null, __METHOD__, array( 'cont' => $container ), $rerr, $rcode, $rdesc ); + return null; } } @@ -1347,6 +1365,7 @@ class SwiftFileBackend extends FileBackendStore { $auth = $this->getAuthentication(); if ( !$auth ) { $status->fatal( 'backend-fail-connect', $this->name ); + return $status; } @@ -1359,10 +1378,10 @@ class SwiftFileBackend extends FileBackendStore { $writeGrps = array( $this->swiftUser ); // sanity list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( array( - 'method' => 'PUT', - 'url' => $this->storageUrl( $auth, $container ), + 'method' => 'PUT', + 'url' => $this->storageUrl( $auth, $container ), 'headers' => $this->authTokenHeaders( $auth ) + array( - 'x-container-read' => implode( ',', $readGrps ), + 'x-container-read' => implode( ',', $readGrps ), 'x-container-write' => implode( ',', $writeGrps ) ) ) ); @@ -1391,12 +1410,13 @@ class SwiftFileBackend extends FileBackendStore { $auth = $this->getAuthentication(); if ( !$auth ) { $status->fatal( 'backend-fail-connect', $this->name ); + return $status; } list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( array( - 'method' => 'DELETE', - 'url' => $this->storageUrl( $auth, $container ), + 'method' => 'DELETE', + 'url' => $this->storageUrl( $auth, $container ), 'headers' => $this->authTokenHeaders( $auth ) ) ); @@ -1433,6 +1453,7 @@ class SwiftFileBackend extends FileBackendStore { $auth = $this->getAuthentication(); if ( !$auth ) { $status->fatal( 'backend-fail-connect', $this->name ); + return $status; } @@ -1451,9 +1472,9 @@ class SwiftFileBackend extends FileBackendStore { } list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( array( - 'method' => 'GET', - 'url' => $this->storageUrl( $auth, $fullCont ), - 'query' => $query, + 'method' => 'GET', + 'url' => $this->storageUrl( $auth, $fullCont ), + 'query' => $query, 'headers' => $this->authTokenHeaders( $auth ) ) ); @@ -1506,29 +1527,34 @@ class SwiftFileBackend extends FileBackendStore { $this->authSessionTimestamp = time() - ceil( $this->authTTL / 2 ); } else { // cache miss list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( array( - 'method' => 'GET', - 'url' => "{$this->swiftAuthUrl}/v1.0", + 'method' => 'GET', + 'url' => "{$this->swiftAuthUrl}/v1.0", 'headers' => array( - 'x-auth-user' => $this->swiftUser, 'x-auth-key' => $this->swiftKey ) + 'x-auth-user' => $this->swiftUser, + 'x-auth-key' => $this->swiftKey + ) ) ); if ( $rcode >= 200 && $rcode <= 299 ) { // OK $this->authCreds = array( - 'auth_token' => $rhdrs['x-auth-token'], + 'auth_token' => $rhdrs['x-auth-token'], 'storage_url' => $rhdrs['x-storage-url'] ); $this->authSessionTimestamp = time(); } elseif ( $rcode === 401 ) { $this->onError( null, __METHOD__, array(), "Authentication failed.", $rcode ); $this->authErrorTimestamp = time(); + return null; } else { $this->onError( null, __METHOD__, array(), "HTTP return code: $rcode", $rcode ); $this->authErrorTimestamp = time(); + return null; } } } + return $this->authCreds; } @@ -1546,6 +1572,7 @@ class SwiftFileBackend extends FileBackendStore { if ( strlen( $object ) ) { $parts[] = str_replace( "%2F", "/", rawurlencode( $object ) ); } + return implode( '/', $parts ); } diff --git a/includes/filebackend/lockmanager/QuorumLockManager.php b/includes/filebackend/lockmanager/QuorumLockManager.php index d17074e8bc..a692012d09 100644 --- a/includes/filebackend/lockmanager/QuorumLockManager.php +++ b/includes/filebackend/lockmanager/QuorumLockManager.php @@ -178,8 +178,8 @@ abstract class QuorumLockManager extends LockManager { foreach ( $this->srvsByBucket[$bucket] as $lockSrv ) { if ( !$this->isServerUp( $lockSrv ) ) { $status->warning( 'lockmanager-fail-svr-release', $lockSrv ); - // Attempt to release the lock on this peer } else { + // Attempt to release the lock on this peer $status->merge( $this->freeLocksOnServer( $lockSrv, $pathsByType ) ); ++$yesVotes; // success for this peer // Normally the first peers form the quorum, and the others are ignored. diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index ca8c219cf3..534d7f2212 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -55,7 +55,7 @@ class FileRepo { /** @var Array Map of zones to config */ protected $zones = array(); - /** @var string URL of thumb.php */ + /** @var string URL of thumb.php */ protected $thumbScriptUrl; /** @var bool Whether to skip media file transformation on parse and rely @@ -111,7 +111,7 @@ class FileRepo { */ protected $abbrvThreshold; - /** @var string The URL of the repo's favicon, if any */ + /** @var string The URL of the repo's favicon, if any */ protected $favicon; /** @@ -505,7 +505,7 @@ class FileRepo { $searchName = File::normalizeTitle( $title )->getDBkey(); // must be valid if ( $flags & self::NAME_AND_TIME_ONLY ) { $result[$searchName] = array( - 'title' => $file->getTitle()->getDBkey(), + 'title' => $file->getTitle()->getDBkey(), 'timestamp' => $file->getTimestamp() ); } else { diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index 8ae53de066..4e48932a19 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -59,10 +59,10 @@ class ForeignAPIRepo extends FileRepo { /** @var int Redownload thumbnail files after a month (86400*30) */ protected $fileCacheExpiry = 2592000; - /** @var array */ + /** @var array */ protected $mFileExists = array(); - /** @var array */ + /** @var array */ private $mQueryCache = array(); /** diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index bcccb71428..3f7adb0055 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -258,11 +258,12 @@ class LocalRepo extends FileRepo { } } - $fileMatchesSearch = function( File $file, array $search ) { + $fileMatchesSearch = function ( File $file, array $search ) { // Note: file name comparison done elsewhere (to handle redirects) $user = ( !empty( $search['private'] ) && $search['private'] instanceof User ) ? $search['private'] : null; + return ( $file->exists() && ( @@ -275,7 +276,7 @@ class LocalRepo extends FileRepo { }; $repo = $this; - $applyMatchingFiles = function( ResultWrapper $res, &$searchSet, &$finalFiles ) + $applyMatchingFiles = function ( ResultWrapper $res, &$searchSet, &$finalFiles ) use ( $repo, $fileMatchesSearch, $flags ) { global $wgContLang; @@ -290,7 +291,7 @@ class LocalRepo extends FileRepo { $dbKeysLook[] = $wgContLang->lcfirst( $file->getName() ); } foreach ( $dbKeysLook as $dbKey ) { - if ( isset( $searchSet[$dbKey]) + if ( isset( $searchSet[$dbKey] ) && $fileMatchesSearch( $file, $searchSet[$dbKey] ) ) { $finalFiles[$dbKey] = ( $flags & FileRepo::NAME_AND_TIME_ONLY ) @@ -309,6 +310,7 @@ class LocalRepo extends FileRepo { foreach ( array_keys( $searchSet ) as $dbKey ) { $imgNames[] = $this->getNameFromTitle( File::normalizeTitle( $dbKey ) ); } + if ( count( $imgNames ) ) { $res = $dbr->select( 'image', LocalFile::selectFields(), array( 'img_name' => $imgNames ), __METHOD__ ); @@ -328,6 +330,7 @@ class LocalRepo extends FileRepo { ); } } + if ( count( $oiConds ) ) { $res = $dbr->select( 'oldimage', OldLocalFile::selectFields(), $dbr->makeList( $oiConds, LIST_OR ), __METHOD__ ); @@ -339,15 +342,17 @@ class LocalRepo extends FileRepo { if ( !empty( $search['ignoreRedirect'] ) ) { continue; } + $title = File::normalizeTitle( $dbKey ); $redir = $this->checkRedirect( $title ); // hopefully hits memcached + if ( $redir && $redir->getNamespace() == NS_FILE ) { $file = $this->newFile( $redir ); if ( $file && $fileMatchesSearch( $file, $search ) ) { $file->redirectedFrom( $title->getDBkey() ); if ( $flags & FileRepo::NAME_AND_TIME_ONLY ) { $finalFiles[$dbKey] = array( - 'title' => $file->getTitle()->getDBkey(), + 'title' => $file->getTitle()->getDBkey(), 'timestamp' => $file->getTimestamp() ); } else { @@ -503,6 +508,7 @@ class LocalRepo extends FileRepo { */ function getInfo() { global $wgFavicon; + return array_merge( parent::getInfo(), array( 'favicon' => wfExpandUrl( $wgFavicon ), ) ); diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php index 33ab8ae343..18432a1572 100644 --- a/includes/filerepo/RepoGroup.php +++ b/includes/filerepo/RepoGroup.php @@ -42,7 +42,7 @@ class RepoGroup { /** @var array */ protected $foreignInfo; - /** @var ProcessCacheLRU */ + /** @var ProcessCacheLRU */ protected $cache; /** @var RepoGroup */ diff --git a/includes/filerepo/file/ArchivedFile.php b/includes/filerepo/file/ArchivedFile.php index 26699c4260..439c25f016 100644 --- a/includes/filerepo/file/ArchivedFile.php +++ b/includes/filerepo/file/ArchivedFile.php @@ -470,7 +470,6 @@ class ArchivedFile { } throw new MWException( "Unknown type '$type'." ); - } /** diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index c9e435e5a1..950baea11b 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -97,10 +97,10 @@ abstract class File { /** @var Title|string|bool */ protected $title; - /** @var string Text of last error */ + /** @var string Text of last error */ protected $lastError; - /** @var string Main part of the title, with underscores (Title::getDBkey) */ + /** @var string Main part of the title, with underscores (Title::getDBkey) */ protected $redirected; /** @var Title */ @@ -586,6 +586,7 @@ abstract class File { if ( !$handler ) { return false; } + return $handler->getCommonMetaArray( $this ); } @@ -1328,7 +1329,7 @@ abstract class File { $this->assertRepoDefined(); return $this->repo->getZonePath( 'thumb' ) . '/' . - $this->getArchiveThumbRel( $archiveName, $suffix ); + $this->getArchiveThumbRel( $archiveName, $suffix ); } /** diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 687c5498dd..c7b257a6ba 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -2249,10 +2249,10 @@ class LocalFileRestoreBatch { /** @var array List of file IDs to restore */ private $ids; - /** @var bool Add all revisions of the file */ + /** @var bool Add all revisions of the file */ private $all; - /** @var bool Wether to remove all settings for suppressed fields */ + /** @var bool Wether to remove all settings for suppressed fields */ private $unsuppress = false; /** @@ -2620,16 +2620,12 @@ class LocalFileMoveBatch { /** @var Title */ protected $target; - /** @var */ protected $cur; - /** @var */ protected $olds; - /** @var */ protected $oldCount; - /** @var */ protected $archive; /** @var DatabaseBase */ diff --git a/includes/filerepo/file/UnregisteredLocalFile.php b/includes/filerepo/file/UnregisteredLocalFile.php index 782e23ac5b..5a3e4e9c77 100644 --- a/includes/filerepo/file/UnregisteredLocalFile.php +++ b/includes/filerepo/file/UnregisteredLocalFile.php @@ -34,7 +34,7 @@ * @ingroup FileAbstraction */ class UnregisteredLocalFile extends File { - /** @var Title */ + /** @var Title */ protected $title; /** @var string */ diff --git a/includes/gallery/ImageGalleryBase.php b/includes/gallery/ImageGalleryBase.php index a34160189a..d2e4689f98 100644 --- a/includes/gallery/ImageGalleryBase.php +++ b/includes/gallery/ImageGalleryBase.php @@ -28,10 +28,10 @@ * @ingroup Media */ abstract class ImageGalleryBase extends ContextSource { - /** @var array Gallery images */ + /** @var array Gallery images */ protected $mImages; - /** @var bool Whether to show the filesize in bytes in categories */ + /** @var bool Whether to show the filesize in bytes in categories */ protected $mShowBytes; /** @var bool Whether to show the filename. Default: true */ @@ -242,7 +242,7 @@ abstract class ImageGalleryBase extends ContextSource { * @param string $html Additional HTML text to be shown. The name and size * of the image are always shown. * @param string $alt Alt text for the image - * @param string $link Override image link (optional) + * @param string $link Override image link (optional) * @param array $handlerOpts Array of options for image handler (aka page number) */ function insert( $title, $html = '', $alt = '', $link = '', $handlerOpts = array() ) { diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 622dd9410b..dcdba1ef18 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -495,7 +495,7 @@ abstract class HTMLFormField { $ret = array(); - foreach( $list as $key ) { + foreach ( $list as $key ) { if ( in_array( $key, $boolAttribs ) ) { if ( !empty( $this->mParams[$key] ) ) { $ret[$key] = ''; diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 79a42baf45..edc0feba95 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -641,15 +641,19 @@ abstract class Installer { if ( !$status->isOK() ) { return $status; } - $status->value->insert( 'site_stats', array( - 'ss_row_id' => 1, - 'ss_total_views' => 0, - 'ss_total_edits' => 0, - 'ss_good_articles' => 0, - 'ss_total_pages' => 0, - 'ss_users' => 0, - 'ss_images' => 0 ), - __METHOD__, 'IGNORE' ); + $status->value->insert( + 'site_stats', + array( + 'ss_row_id' => 1, + 'ss_total_views' => 0, + 'ss_total_edits' => 0, + 'ss_good_articles' => 0, + 'ss_total_pages' => 0, + 'ss_users' => 0, + 'ss_images' => 0 + ), + __METHOD__, 'IGNORE' + ); return Status::newGood(); } diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index 68664c955c..77c35b85ad 100644 --- a/includes/installer/LocalSettingsGenerator.php +++ b/includes/installer/LocalSettingsGenerator.php @@ -223,7 +223,8 @@ class LocalSettingsGenerator { } if ( $this->groupPermissions['*']['edit'] === false && $this->groupPermissions['*']['createaccount'] === false - && $this->groupPermissions['*']['read'] !== false ) { + && $this->groupPermissions['*']['read'] !== false + ) { $noFollow = "\n# Set \$wgNoFollowLinks to true if you open up your wiki to editing by\n" . "# the general public and wish to apply nofollow to external links as a\n" . "# deterrent to spammers. Nofollow is not a comprehensive anti-spam solution\n" diff --git a/includes/installer/OracleUpdater.php b/includes/installer/OracleUpdater.php index 88e5fbd59d..6c56b3a345 100644 --- a/includes/installer/OracleUpdater.php +++ b/includes/installer/OracleUpdater.php @@ -94,8 +94,8 @@ class OracleUpdater extends DatabaseUpdater { 'patch-ufg_group-length-increase-255.sql' ), //1.23 - array( 'addIndex', 'logging', 'i06', 'patch-logging_user_text_type_time_index.sql' ), - array( 'addIndex', 'logging', 'i07', 'patch-logging_user_text_time_index.sql' ), + array( 'addIndex', 'logging', 'i06', 'patch-logging_user_text_type_time_index.sql' ), + array( 'addIndex', 'logging', 'i07', 'patch-logging_user_text_time_index.sql' ), // KEEP THIS AT THE BOTTOM!! array( 'doRebuildDuplicateFunction' ), diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index 7841fca993..1e0651c143 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -27,7 +27,6 @@ * @ingroup Deployment * @since 1.17 */ - class PostgresUpdater extends DatabaseUpdater { /** diff --git a/includes/installer/SqliteUpdater.php b/includes/installer/SqliteUpdater.php index 5d4f6de6db..2869d1f5a0 100644 --- a/includes/installer/SqliteUpdater.php +++ b/includes/installer/SqliteUpdater.php @@ -125,7 +125,7 @@ class SqliteUpdater extends DatabaseUpdater { array( 'addField', 'recentchanges', 'rc_source', 'patch-rc_source.sql' ), array( 'addIndex', 'logging', 'log_user_text_type_time', 'patch-logging_user_text_type_time_index.sql' ), - array( 'addIndex', 'logging', 'log_user_text_time', 'patch-logging_user_text_time_index.sql' ), + array( 'addIndex', 'logging', 'log_user_text_time', 'patch-logging_user_text_time_index.sql' ), array( 'addField', 'page', 'page_links_updated', 'patch-page_links_updated.sql' ), ); } diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 67236e566c..131431a223 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -1291,7 +1291,7 @@ class WebInstaller_Complete extends WebInstallerPage { ) { // JS appears to be the only method that works consistently with IE7+ $this->addHtml( "\n\n" ); + Xml::encodeJsVar( $lsUrl ) . "; } );\n" ); } else { $this->parent->request->response()->header( "Refresh: 0;url=$lsUrl" ); }