From 15abcf71ca7ec185b475e47ef0fe43884e764239 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 13 Apr 2013 13:36:24 +0200 Subject: [PATCH] Added/Removed spaces around string concatenation And added/removed spaces around some other tokens, like +, -, *, /, <, >, =, ! Fixed windows newline style Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8 --- includes/ChangesFeed.php | 6 +-- includes/ChangesList.php | 4 +- includes/Collation.php | 2 +- includes/ConfEditor.php | 4 +- includes/Defines.php | 2 +- includes/Exception.php | 2 +- includes/FeedUtils.php | 4 +- includes/GlobalFunctions.php | 2 +- includes/Html.php | 10 ++--- includes/ImageGallery.php | 2 +- includes/Import.php | 4 +- includes/MimeMagic.php | 6 +-- includes/Preferences.php | 2 +- includes/ProtectionForm.php | 2 +- includes/SiteStats.php | 12 +++--- includes/SkinTemplate.php | 4 +- includes/Status.php | 2 +- includes/StringUtils.php | 8 ++-- includes/UIDGenerator.php | 2 +- includes/User.php | 8 ++-- includes/WikiMap.php | 4 +- includes/WikiPage.php | 2 +- includes/Xml.php | 14 +++---- includes/XmlTypeCheck.php | 2 +- includes/ZipDirectoryReader.php | 2 +- includes/actions/HistoryAction.php | 2 +- includes/api/ApiEditPage.php | 2 +- includes/api/ApiMain.php | 2 +- includes/api/ApiQueryRevisions.php | 4 +- includes/cache/FileCacheBase.php | 2 +- includes/clientpool/RedisConnectionPool.php | 4 +- includes/db/DatabaseError.php | 2 +- includes/db/DatabaseOracle.php | 2 +- includes/db/DatabasePostgres.php | 12 +++--- includes/externalstore/ExternalStoreDB.php | 2 +- includes/filebackend/FileBackendStore.php | 4 +- includes/filebackend/SwiftFileBackend.php | 6 +-- .../filebackend/lockmanager/LockManager.php | 4 +- .../lockmanager/MemcLockManager.php | 4 +- .../lockmanager/QuorumLockManager.php | 2 +- includes/filerepo/FileRepo.php | 14 +++---- includes/filerepo/LocalRepo.php | 20 ++++----- includes/filerepo/file/File.php | 2 +- includes/filerepo/file/LocalFile.php | 2 +- includes/installer/Installer.php | 2 +- includes/installer/OracleInstaller.php | 4 +- includes/installer/OracleUpdater.php | 14 +++++-- includes/installer/PostgresUpdater.php | 4 +- includes/installer/WebInstaller.php | 2 +- includes/installer/WebInstallerOutput.php | 2 +- includes/installer/WebInstallerPage.php | 4 +- includes/job/JobQueueAggregatorMemc.php | 2 +- includes/job/jobs/DoubleRedirectJob.php | 10 ++--- includes/job/jobs/HTMLCacheUpdateJob.php | 6 +-- includes/logging/DeleteLogFormatter.php | 4 +- includes/logging/LogEventsList.php | 4 +- includes/logging/LogPage.php | 2 +- includes/media/DjVu.php | 6 +-- includes/media/DjVuImage.php | 2 +- includes/media/GIFMetadataExtractor.php | 2 +- includes/media/IPTC.php | 2 +- includes/media/ImageHandler.php | 2 +- includes/media/MediaTransformOutput.php | 2 +- includes/media/SVGMetadataExtractor.php | 6 +-- includes/media/XMPValidate.php | 6 +-- includes/objectcache/BagOStuff.php | 2 +- .../objectcache/MemcachedPeclBagOStuff.php | 4 +- includes/objectcache/MultiWriteBagOStuff.php | 2 +- includes/parser/DateFormatter.php | 2 +- includes/parser/Parser.php | 42 +++++++++---------- includes/parser/Preprocessor_DOM.php | 7 ++-- includes/parser/Preprocessor_Hash.php | 4 +- includes/profiler/ProfilerSimple.php | 4 +- includes/profiler/ProfilerSimpleText.php | 12 +++--- includes/resourceloader/ResourceLoader.php | 4 +- includes/revisiondelete/RevisionDelete.php | 2 +- includes/search/SearchEngine.php | 2 +- includes/search/SearchMySQL.php | 2 +- includes/search/SearchPostgres.php | 8 ++-- includes/search/SearchSqlite.php | 2 +- includes/specials/SpecialImport.php | 10 ++--- includes/specials/SpecialLinkSearch.php | 2 +- includes/specials/SpecialMovepage.php | 4 +- includes/specials/SpecialRecentchanges.php | 2 +- includes/specials/SpecialSearch.php | 2 +- includes/specials/SpecialSpecialpages.php | 2 +- includes/specials/SpecialStatistics.php | 2 +- includes/specials/SpecialUserrights.php | 4 +- includes/specials/SpecialVersion.php | 4 +- includes/upload/UploadBase.php | 4 +- includes/upload/UploadStash.php | 2 +- languages/Language.php | 6 +-- languages/classes/LanguageKsh.php | 14 +++---- languages/classes/LanguageTyv.php | 2 +- languages/classes/LanguageWa.php | 8 ++-- maintenance/Maintenance.php | 2 +- maintenance/backupTextPass.inc | 2 +- maintenance/benchmarks/Benchmarker.php | 8 ++-- maintenance/dumpIterator.php | 4 +- maintenance/formatInstallDoc.php | 2 +- maintenance/importDump.php | 2 +- maintenance/importImages.php | 4 +- maintenance/install.php | 2 +- maintenance/language/checkLanguage.inc | 2 +- .../language/generateCollationData.php | 6 +-- maintenance/language/writeMessagesArray.inc | 4 +- maintenance/parse.php | 2 +- maintenance/purgeList.php | 2 +- maintenance/rebuildrecentchanges.php | 4 +- maintenance/storage/compressOld.php | 4 +- skins/CologneBlue.php | 6 +-- tests/phpunit/includes/BlockTest.php | 10 ++--- 112 files changed, 266 insertions(+), 259 deletions(-) diff --git a/includes/ChangesFeed.php b/includes/ChangesFeed.php index 8b8b94e807..e900e34913 100644 --- a/includes/ChangesFeed.php +++ b/includes/ChangesFeed.php @@ -176,9 +176,9 @@ class ChangesFeed { if( $n > 0 && $obj->rc_type == RC_EDIT && $obj->rc_namespace >= 0 && - $obj->rc_cur_id == $sorted[$n-1]->rc_cur_id && - $obj->rc_user_text == $sorted[$n-1]->rc_user_text ) { - $sorted[$n-1]->rc_last_oldid = $obj->rc_last_oldid; + $obj->rc_cur_id == $sorted[$n - 1]->rc_cur_id && + $obj->rc_user_text == $sorted[$n - 1]->rc_user_text ) { + $sorted[$n - 1]->rc_last_oldid = $obj->rc_last_oldid; } else { $sorted[$n] = $obj; $n++; diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 0c4d69e691..79e2d0bebd 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -543,7 +543,7 @@ class ChangesList extends ContextSource { 'user_text' => $rc->mAttribs['rc_user_text'], 'deleted' => $rc->mAttribs['rc_deleted'] ) ); - $s .= ' '.Linker::generateRollback( $rev, $this->getContext() ); + $s .= ' ' . Linker::generateRollback( $rev, $this->getContext() ); } } } @@ -1046,7 +1046,7 @@ class EnhancedChangesList extends ChangesList { if( $chardiff == '' ) { $r .= ' '; } else { - $r .= ' ' . $chardiff. ' . . '; + $r .= ' ' . $chardiff . ' . . '; } } diff --git a/includes/Collation.php b/includes/Collation.php index 21448f7a70..723b38e4b8 100644 --- a/includes/Collation.php +++ b/includes/Collation.php @@ -62,7 +62,7 @@ abstract class Collation { } // If all else fails... - throw new MWException( __METHOD__.": unknown collation type \"$collationName\"" ); + throw new MWException( __METHOD__ . ": unknown collation type \"$collationName\"" ); } } diff --git a/includes/ConfEditor.php b/includes/ConfEditor.php index 1d9ca92120..293d53d779 100644 --- a/includes/ConfEditor.php +++ b/includes/ConfEditor.php @@ -537,7 +537,7 @@ class ConfEditor { */ function getIndent( $pos, $key = false, $arrowPos = false ) { $arrowIndent = ' '; - if ( $pos == 0 || $this->text[$pos-1] == "\n" ) { + if ( $pos == 0 || $this->text[$pos - 1] == "\n" ) { $indentLength = strspn( $this->text, " \t", $pos ); $indent = substr( $this->text, $pos, $indentLength ); } else { @@ -1056,7 +1056,7 @@ class ConfEditorParseError extends MWException { $lines = StringUtils::explode( "\n", $text ); foreach ( $lines as $lineNum => $line ) { if ( $lineNum == $this->lineNum - 1 ) { - return "$line\n" .str_repeat( ' ', $this->colNum - 1 ) . "^\n"; + return "$line\n" . str_repeat( ' ', $this->colNum - 1 ) . "^\n"; } } return ''; diff --git a/includes/Defines.php b/includes/Defines.php index 28847db474..cd6b1589eb 100644 --- a/includes/Defines.php +++ b/includes/Defines.php @@ -204,7 +204,7 @@ define( 'LIST_OR', 4 ); /** * Unicode and normalisation related */ -require_once __DIR__.'/normal/UtfNormalDefines.php'; +require_once __DIR__ . '/normal/UtfNormalDefines.php'; /**@{ * Hook support constants diff --git a/includes/Exception.php b/includes/Exception.php index 661d03dce8..93fddac346 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -617,7 +617,7 @@ class HttpError extends MWException { $content = htmlspecialchars( $this->content ); } - return "\n". + return "\n" . "$header\n" . "

$header

$content

\n"; } diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index 57d8c0bd8f..4842c38e1b 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -127,7 +127,7 @@ class FeedUtils { } if( $oldid ) { - wfProfileIn( __METHOD__."-dodiff" ); + wfProfileIn( __METHOD__ . "-dodiff" ); #$diffText = $de->getDiff( wfMessage( 'revisionasof', # $wgLang->timeanddate( $timestamp ), @@ -168,7 +168,7 @@ class FeedUtils { $diffText = UtfNormal::cleanUp( $diffText ); $diffText = self::applyDiffStyle( $diffText ); } - wfProfileOut( __METHOD__."-dodiff" ); + wfProfileOut( __METHOD__ . "-dodiff" ); } else { $rev = Revision::newFromId( $newid ); if( $wgFeedDiffCutoff <= 0 || is_null( $rev ) ) { diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 751f4af56b..af19b8e00c 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -3874,7 +3874,7 @@ function wfRunHooks( $event, $args = array() ) { * @throws MWException if $data not long enough, or if unpack fails * @return array Associative array of the extracted data */ -function wfUnpack( $format, $data, $length=false ) { +function wfUnpack( $format, $data, $length = false ) { if ( $length !== false ) { $realLen = strlen( $data ); if ( $realLen < $length ) { diff --git a/includes/Html.php b/includes/Html.php index af4b4bbf4d..07bb42bcfd 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -926,22 +926,22 @@ class Html { global $wgStylePath; if ( $useStylePath ) { - $icon = $wgStylePath.'/common/images/'.$icon; + $icon = $wgStylePath . '/common/images/' . $icon; } $s = Html::openElement( 'div', array( 'class' => "mw-infobox $class" ) ); - $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ). + $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ) . Html::element( 'img', array( 'src' => $icon, 'alt' => $alt, ) - ). + ) . Html::closeElement( 'div' ); - $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-right' ) ). - $text. + $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-right' ) ) . + $text . Html::closeElement( 'div' ); $s .= Html::element( 'div', array( 'style' => 'clear: left;' ), ' ' ); diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index 1556ad9442..8f8022f3d1 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -302,7 +302,7 @@ class ImageGallery { $thumbhtml = "\n\t\t\t" . '
' . htmlspecialchars( $img->getLastError() ) . '
'; } else { - $vpad = ( self::THUMB_PADDING + $this->mHeights - $thumb->height ) /2; + $vpad = ( self::THUMB_PADDING + $this->mHeights - $thumb->height ) / 2; $imageParameters = array( 'desc-link' => true, diff --git a/includes/Import.php b/includes/Import.php index 04d99e17fd..03a1cfe184 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -432,7 +432,7 @@ class WikiImporter { $lookup[$this->reader->nodeType], $this->reader->name, $this->reader->value - )."\n\n" ); + ) . "\n\n" ); } /** @@ -444,7 +444,7 @@ class WikiImporter { $this->reader->read(); if ( $this->reader->name != 'mediawiki' ) { - throw new MWException( "Expected tag, got ". + throw new MWException( "Expected tag, got " . $this->reader->name ); } $this->debug( " tag is correct." ); diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index 759253098b..11fc574147 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -231,7 +231,7 @@ class MimeMagic { } $mime = substr( $s, 0, $i ); - $ext = trim( substr( $s, $i+1 ) ); + $ext = trim( substr( $s, $i + 1 ) ); if ( empty( $ext ) ) { continue; @@ -628,7 +628,7 @@ class MimeMagic { $doctype = strpos( $head, "\x42\x82" ); if ( $doctype ) { // Next byte is datasize, then data (sizes larger than 1 byte are very stupid muxers) - $data = substr( $head, $doctype+3, 8 ); + $data = substr( $head, $doctype + 3, 8 ); if ( strncmp( $data, "matroska", 8 ) == 0 ) { wfDebug( __METHOD__ . ": recognized file as video/x-matroska\n" ); return "video/x-matroska"; @@ -897,7 +897,7 @@ class MimeMagic { $m = finfo_file( $mime_magic_resource, $file ); finfo_close( $mime_magic_resource ); } else { - wfDebug( __METHOD__ . ": finfo_open failed on ".FILEINFO_MIME."!\n" ); + wfDebug( __METHOD__ . ": finfo_open failed on " . FILEINFO_MIME . "!\n" ); } } elseif ( function_exists( "mime_content_type" ) ) { diff --git a/includes/Preferences.php b/includes/Preferences.php index 6d6e58158a..79c3dd3e66 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -432,7 +432,7 @@ class Preferences { SpecialPage::getTitleFor( 'Confirmemail' ), $context->msg( 'emailconfirmlink' )->escaped() ) . '
'; - $emailauthenticationclass="mw-email-not-authenticated"; + $emailauthenticationclass = "mw-email-not-authenticated"; } } else { $disableEmailPrefs = true; diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 7ebefec3a6..de5e9db8e7 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -371,7 +371,7 @@ class ProtectionForm { foreach( $this->mRestrictions as $action => $selected ) { /* Not all languages have V_x <-> N_x relation */ $msg = wfMessage( 'restriction-' . $action ); - $out .= "". + $out .= "" . Xml::openElement( 'fieldset' ) . Xml::element( 'legend', null, $msg->exists() ? $msg->text() : $action ) . Xml::openElement( 'table', array( 'id' => "mw-protect-table-$action" ) ) . diff --git a/includes/SiteStats.php b/includes/SiteStats.php index b7be29d634..4de7333195 100644 --- a/includes/SiteStats.php +++ b/includes/SiteStats.php @@ -306,12 +306,12 @@ class SiteStatsUpdate implements DeferrableUpdate { } $pd = $this->getPendingDeltas(); // Piggy-back the async deltas onto those of this stats update.... - $this->views += ( $pd['ss_total_views']['+'] - $pd['ss_total_views']['-'] ); - $this->edits += ( $pd['ss_total_edits']['+'] - $pd['ss_total_edits']['-'] ); + $this->views += ( $pd['ss_total_views']['+'] - $pd['ss_total_views']['-'] ); + $this->edits += ( $pd['ss_total_edits']['+'] - $pd['ss_total_edits']['-'] ); $this->articles += ( $pd['ss_good_articles']['+'] - $pd['ss_good_articles']['-'] ); - $this->pages += ( $pd['ss_total_pages']['+'] - $pd['ss_total_pages']['-'] ); - $this->users += ( $pd['ss_users']['+'] - $pd['ss_users']['-'] ); - $this->images += ( $pd['ss_images']['+'] - $pd['ss_images']['-'] ); + $this->pages += ( $pd['ss_total_pages']['+'] - $pd['ss_total_pages']['-'] ); + $this->users += ( $pd['ss_users']['+'] - $pd['ss_users']['-'] ); + $this->images += ( $pd['ss_images']['+'] - $pd['ss_images']['-'] ); } // Need a separate transaction because this a global lock @@ -356,7 +356,7 @@ class SiteStatsUpdate implements DeferrableUpdate { 'rc_user != 0', 'rc_bot' => 0, 'rc_log_type != ' . $dbr->addQuotes( 'newusers' ) . ' OR rc_log_type IS NULL', - 'rc_timestamp >= ' . $dbr->addQuotes( $dbr->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays*24*3600 ) ), + 'rc_timestamp >= ' . $dbr->addQuotes( $dbr->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays * 24 * 3600 ) ), ), __METHOD__ ); diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index fee3058ac1..9014c7fe75 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -127,7 +127,7 @@ class SkinTemplate extends Skin { * * @param $out OutputPage */ - function outputPage( OutputPage $out=null ) { + function outputPage( OutputPage $out = null ) { global $wgContLang; global $wgScript, $wgStylePath; global $wgMimeType, $wgJsMimeType; @@ -761,7 +761,7 @@ class SkinTemplate extends Skin { function makeArticleUrlDetails( $name, $urlaction = '' ) { $title = Title::newFromText( $name ); - $title= $title->getSubjectPage(); + $title = $title->getSubjectPage(); self::checkTitle( $title, $name ); return array( 'href' => $title->getLocalURL( $urlaction ), diff --git a/includes/Status.php b/includes/Status.php index 5d6236f7c0..d8ea24ae1b 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -190,7 +190,7 @@ class Status { $s = wfMessage( $longContext, "* $s\n" )->plain(); } } else { - $s = '* '. implode( "\n* ", + $s = '* ' . implode( "\n* ", $this->getErrorMessageArray( $this->errors ) ) . "\n"; if ( $longContext ) { $s = wfMessage( $longContext, $s )->plain(); diff --git a/includes/StringUtils.php b/includes/StringUtils.php index f4c98f1d54..21a392a856 100644 --- a/includes/StringUtils.php +++ b/includes/StringUtils.php @@ -452,16 +452,16 @@ class ReplacementArray { */ function replace( $subject ) { if ( function_exists( 'fss_prep_replace' ) ) { - wfProfileIn( __METHOD__.'-fss' ); + wfProfileIn( __METHOD__ . '-fss' ); if ( $this->fss === false ) { $this->fss = fss_prep_replace( $this->data ); } $result = fss_exec_replace( $this->fss, $subject ); - wfProfileOut( __METHOD__.'-fss' ); + wfProfileOut( __METHOD__ . '-fss' ); } else { - wfProfileIn( __METHOD__.'-strtr' ); + wfProfileIn( __METHOD__ . '-strtr' ); $result = strtr( $subject, $this->data ); - wfProfileOut( __METHOD__.'-strtr' ); + wfProfileOut( __METHOD__ . '-strtr' ); } return $result; } diff --git a/includes/UIDGenerator.php b/includes/UIDGenerator.php index b042d8c718..6219b3dc8e 100644 --- a/includes/UIDGenerator.php +++ b/includes/UIDGenerator.php @@ -304,7 +304,7 @@ class UIDGenerator { if ( $ct >= $time ) { // http://php.net/manual/en/language.operators.comparison.php return $ct; // current timestamp is higher than $time } - } while ( ( ( $time[0] - $ct[0] )*1000 + ( $time[1] - $ct[1] ) ) <= 10 ); + } while ( ( ( $time[0] - $ct[0] ) * 1000 + ( $time[1] - $ct[1] ) ) <= 10 ); return false; } diff --git a/includes/User.php b/includes/User.php index 5b7cbf2e9c..ed97deb2e7 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1229,7 +1229,7 @@ class User { $defOpt['variant'] = $wgContLang->getCode(); $defOpt['language'] = $wgContLang->getCode(); foreach( SearchEngine::searchableNamespaces() as $nsnum => $nsname ) { - $defOpt['searchNs'.$nsnum] = !empty( $wgNamespacesToBeSearchedDefault[$nsnum] ); + $defOpt['searchNs' . $nsnum] = !empty( $wgNamespacesToBeSearchedDefault[$nsnum] ); } $defOpt['skin'] = $wgDefaultSkin; @@ -1268,7 +1268,7 @@ class User { } wfProfileIn( __METHOD__ ); - wfDebug( __METHOD__.": checking...\n" ); + wfDebug( __METHOD__ . ": checking...\n" ); // Initialize data... // Otherwise something ends up stomping on $this->mBlockedby when @@ -3244,7 +3244,7 @@ class User { } } if ( !$loaded ) { - throw new MWException( __METHOD__. ": hit a key conflict attempting " . + throw new MWException( __METHOD__ . ": hit a key conflict attempting " . "to insert a user row, but then it doesn't exist when we select it!" ); } return Status::newFatal( 'userexists' ); @@ -4254,7 +4254,7 @@ class User { } elseif ( $type == ':B:' ) { # Salted list( $salt, $realHash ) = explode( ':', substr( $hash, 3 ), 2 ); - return md5( $salt.'-'.md5( $password ) ) === $realHash; + return md5( $salt . '-' . md5( $password ) ) === $realHash; } else { # Old-style return self::oldCrypt( $password, $userId ) === $hash; diff --git a/includes/WikiMap.php b/includes/WikiMap.php index a1dbbfc098..ab3d68d634 100644 --- a/includes/WikiMap.php +++ b/includes/WikiMap.php @@ -73,7 +73,7 @@ class WikiMap { * @param string $text link's text; optional, default to "User:$user" * @return String: HTML link or false if the wiki was not found */ - public static function foreignUserLink( $wikiID, $user, $text=null ) { + public static function foreignUserLink( $wikiID, $user, $text = null ) { return self::makeForeignLink( $wikiID, "User:$user", $text ); } @@ -85,7 +85,7 @@ class WikiMap { * @param string $text link's text; optional, default to $page * @return String: HTML link or false if the wiki was not found */ - public static function makeForeignLink( $wikiID, $page, $text=null ) { + public static function makeForeignLink( $wikiID, $page, $text = null ) { if ( !$text ) { $text = $page; } diff --git a/includes/WikiPage.php b/includes/WikiPage.php index c016b18cf3..228f295b31 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -797,7 +797,7 @@ class WikiPage implements Page, IDBAccessObject { public function setCachedLastEditTime( $timestamp ) { global $wgMemc; $key = wfMemcKey( 'page-lastedit', md5( $this->mTitle->getPrefixedDBkey() ) ); - $wgMemc->set( $key, wfTimestamp( TS_MW, $timestamp ), 60*15 ); + $wgMemc->set( $key, wfTimestamp( TS_MW, $timestamp ), 60 * 15 ); } /** diff --git a/includes/Xml.php b/includes/Xml.php index 7cecf3af2e..29c240eb1d 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -200,9 +200,9 @@ class Xml { $encYear = ''; } $inputAttribs = array( 'id' => 'year', 'maxlength' => 4, 'size' => 7 ); - return self::label( wfMessage( 'year' )->text(), 'year' ) . ' '. - Html::input( 'year', $encYear, 'number', $inputAttribs ) . ' '. - self::label( wfMessage( 'month' )->text(), 'month' ) . ' '. + return self::label( wfMessage( 'year' )->text(), 'year' ) . ' ' . + Html::input( 'year', $encYear, 'number', $inputAttribs ) . ' ' . + self::label( wfMessage( 'month' )->text(), 'month' ) . ' ' . self::monthSelector( $encMonth, -1 ); } @@ -330,7 +330,7 @@ class Xml { * @param array $attribs other attributes * @return string HTML */ - public static function check( $name, $checked = false, $attribs=array() ) { + public static function check( $name, $checked = false, $attribs = array() ) { return self::element( 'input', array_merge( array( 'name' => $name, @@ -389,7 +389,7 @@ class Xml { * @param array $attribs other attributes * @return string HTML */ - public static function inputLabel( $label, $name, $id, $size=false, $value=false, $attribs = array() ) { + public static function inputLabel( $label, $name, $id, $size = false, $value = false, $attribs = array() ) { list( $label, $input ) = self::inputLabelSep( $label, $name, $id, $size, $value, $attribs ); return $label . ' ' . $input; } @@ -466,7 +466,7 @@ class Xml { * @param array $attribs optional additional HTML attributes * @return string HTML */ - public static function option( $text, $value=null, $selected = false, + public static function option( $text, $value = null, $selected = false, $attribs = array() ) { if( !is_null( $value ) ) { $attribs['value'] = $value; @@ -488,7 +488,7 @@ class Xml { * @param $tabindex Mixed: Value of the tabindex attribute * @return string */ - public static function listDropDown( $name= '', $list = '', $other = '', $selected = '', $class = '', $tabindex = null ) { + public static function listDropDown( $name = '', $list = '', $other = '', $selected = '', $class = '', $tabindex = null ) { $optgroup = false; $options = self::option( $other, 'other', $selected === 'other' ); diff --git a/includes/XmlTypeCheck.php b/includes/XmlTypeCheck.php index 2e184606da..5e4f1189cc 100644 --- a/includes/XmlTypeCheck.php +++ b/includes/XmlTypeCheck.php @@ -47,7 +47,7 @@ class XmlTypeCheck { * namespace, name, and attributes, but not to text contents. * Filter should return 'true' to toggle on $this->filterMatch */ - function __construct( $file, $filterCallback=null ) { + function __construct( $file, $filterCallback = null ) { $this->filterCallback = $filterCallback; $this->run( $file ); } diff --git a/includes/ZipDirectoryReader.php b/includes/ZipDirectoryReader.php index 646180d2f1..307efcea8d 100644 --- a/includes/ZipDirectoryReader.php +++ b/includes/ZipDirectoryReader.php @@ -162,7 +162,7 @@ class ZipDirectoryReader { || $this->eocdr['CD entries total'] == 0xffff ) { $this->error( 'zip-unsupported', 'Central directory header indicates ZIP64, ' . - 'but we are in legacy mode. Rejecting this upload is necessary to avoid '. + 'but we are in legacy mode. Rejecting this upload is necessary to avoid ' . 'opening vulnerabilities on clients using OpenJDK 7 or later.' ); } diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 87294261f9..72961264a5 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -661,7 +661,7 @@ class HistoryPager extends ReverseChronologicalPager { wfRunHooks( 'HistoryRevisionTools', array( $rev, &$tools ) ); if ( $tools ) { - $s2 .= ' '. $this->msg( 'parentheses' )->rawParams( $lang->pipeList( $tools ) )->escaped(); + $s2 .= ' ' . $this->msg( 'parentheses' )->rawParams( $lang->pipeList( $tools ) )->escaped(); } # Tags diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 4916145bc1..ab60008153 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -100,7 +100,7 @@ class ApiEditPage extends ApiBase { $name = $titleObj->getPrefixedDBkey(); $model = $contentHandler->getModelID(); - $this->dieUsage( "The requested format $contentFormat is not supported for content model ". + $this->dieUsage( "The requested format $contentFormat is not supported for content model " . " $model used by $name", 'badformat' ); } diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index abd47b20eb..76f9b4201a 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -863,7 +863,7 @@ class ApiMain extends ApiBase { ' ' . $request->getMethod() . ' ' . wfUrlencode( str_replace( ' ', '_', $this->getUser()->getName() ) ) . ' ' . $request->getIP() . - ' T=' . $milliseconds .'ms'; + ' T=' . $milliseconds . 'ms'; foreach ( $this->getParamsUsed() as $name ) { $value = $request->getVal( $name ); if ( $value === null ) { diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 192fe873f4..317b7ba57c 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -550,7 +550,7 @@ class ApiQueryRevisions extends ApiQueryBase { if ( !$content->isSupportedFormat( $format ) ) { $name = $title->getPrefixedDBkey(); - $this->dieUsage( "The requested format {$this->contentFormat} is not supported ". + $this->dieUsage( "The requested format {$this->contentFormat} is not supported " . "for content model $model used by $name", 'badformat' ); } @@ -593,7 +593,7 @@ class ApiQueryRevisions extends ApiQueryBase { $name = $title->getPrefixedDBkey(); - $this->dieUsage( "The requested format {$this->contentFormat} is not supported for ". + $this->dieUsage( "The requested format {$this->contentFormat} is not supported for " . "content model $model used by $name", 'badformat' ); } diff --git a/includes/cache/FileCacheBase.php b/includes/cache/FileCacheBase.php index 30a72174b0..74feffb123 100644 --- a/includes/cache/FileCacheBase.php +++ b/includes/cache/FileCacheBase.php @@ -163,7 +163,7 @@ abstract class FileCacheBase { $this->checkCacheDirs(); // build parent dir if ( !file_put_contents( $this->cachePath(), $text, LOCK_EX ) ) { - wfDebug( __METHOD__ . "() failed saving ". $this->cachePath() . "\n" ); + wfDebug( __METHOD__ . "() failed saving " . $this->cachePath() . "\n" ); $this->mCached = null; return false; } diff --git a/includes/clientpool/RedisConnectionPool.php b/includes/clientpool/RedisConnectionPool.php index a15e80ba80..7a291540ca 100644 --- a/includes/clientpool/RedisConnectionPool.php +++ b/includes/clientpool/RedisConnectionPool.php @@ -59,7 +59,7 @@ class RedisConnectionPool { */ protected function __construct( array $options ) { if ( !extension_loaded( 'redis' ) ) { - throw new MWException( __CLASS__. ' requires the phpredis extension: ' . + throw new MWException( __CLASS__ . ' requires the phpredis extension: ' . 'https://github.com/nicolasff/phpredis' ); } $this->connectTimeout = $options['connectTimeout']; @@ -164,7 +164,7 @@ class RedisConnectionPool { // TCP connection $hostPort = IP::splitHostAndPort( $server ); if ( !$hostPort ) { - throw new MWException( __CLASS__.": invalid configured server \"$server\"" ); + throw new MWException( __CLASS__ . ": invalid configured server \"$server\"" ); } list( $host, $port ) = $hostPort; if ( $port === false ) { diff --git a/includes/db/DatabaseError.php b/includes/db/DatabaseError.php index 628a2afca5..55095c3829 100644 --- a/includes/db/DatabaseError.php +++ b/includes/db/DatabaseError.php @@ -188,7 +188,7 @@ class DBConnectionError extends DBError { # Hack: extend the body for error messages $cache = str_replace( array( '', '' ), '', $cache ); # Add cache notice... - $cache .= '
'. + $cache .= '
' . htmlspecialchars( $this->msg( 'dberr-cachederror', 'This is a cached copy of the requested page, and may not be up to date. ' ) ) . '
'; diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index e59ca957a2..a57b24b7b4 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -919,7 +919,7 @@ class DatabaseOracle extends DatabaseBase { if ( isset( $this->mFieldInfoCache["$table.$field"] ) ) { return $this->mFieldInfoCache["$table.$field"]; } - $tableWhere = '= \''.$table.'\''; + $tableWhere = '= \'' . $table . '\''; } $fieldInfoStmt = oci_parse( $this->mConn, 'SELECT * FROM wiki_field_info_full WHERE table_name ' . $tableWhere . ' and column_name = \'' . $field . '\'' ); diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index 52fab138f6..bb35dc3fc4 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -320,7 +320,7 @@ class DatabasePostgres extends DatabaseBase { function hasConstraint( $name ) { $SQL = "SELECT 1 FROM pg_catalog.pg_constraint c, pg_catalog.pg_namespace n WHERE c.connamespace = n.oid AND conname = '" . - pg_escape_string( $this->mConn, $name ) . "' AND n.nspname = '" . pg_escape_string( $this->mConn, $this->getCoreSchema() ) ."'"; + pg_escape_string( $this->mConn, $name ) . "' AND n.nspname = '" . pg_escape_string( $this->mConn, $this->getCoreSchema() ) . "'"; $res = $this->doQuery( $SQL ); return $this->numRows( $res ); } @@ -705,7 +705,7 @@ __INDEXATTR__; } function indexUnique( $table, $index, $fname = 'DatabasePostgres::indexUnique' ) { - $sql = "SELECT indexname FROM pg_indexes WHERE tablename='{$table}'". + $sql = "SELECT indexname FROM pg_indexes WHERE tablename='{$table}'" . " AND indexdef LIKE 'CREATE UNIQUE%(" . $this->strencode( $this->indexName( $index ) ) . ")'"; @@ -960,7 +960,7 @@ __INDEXATTR__; FROM pg_class c, pg_attribute a, pg_type t WHERE relname='$table' AND a.attrelid=c.oid AND a.atttypid=t.oid and a.attname='$field'"; - $res =$this->query( $sql ); + $res = $this->query( $sql ); $row = $this->fetchObject( $res ); if ( $row->ftype == 'varchar' ) { $size = $row->size - 4; @@ -1024,7 +1024,7 @@ __INDEXATTR__; */ function pg_array_parse( $text, &$output, $limit = false, $offset = 1 ) { if( false === $limit ) { - $limit = strlen( $text )-1; + $limit = strlen( $text ) - 1; $output = array(); } if( '{}' == $text ) { @@ -1042,7 +1042,7 @@ __INDEXATTR__; return $output; } } else { - $offset = $this->pg_array_parse( $text, $output, $limit, $offset+1 ); + $offset = $this->pg_array_parse( $text, $output, $limit, $offset + 1 ); } } while ( $limit > $offset ); return $output; @@ -1476,7 +1476,7 @@ SQL; sleep( 1 ); } } - wfDebug( __METHOD__." failed to acquire lock\n" ); + wfDebug( __METHOD__ . " failed to acquire lock\n" ); return false; } diff --git a/includes/externalstore/ExternalStoreDB.php b/includes/externalstore/ExternalStoreDB.php index 196e7f2c18..46a863f88b 100644 --- a/includes/externalstore/ExternalStoreDB.php +++ b/includes/externalstore/ExternalStoreDB.php @@ -64,7 +64,7 @@ class ExternalStoreDB extends ExternalStoreMedium { __METHOD__ ); $id = $dbw->insertId(); if ( !$id ) { - throw new MWException( __METHOD__.': no insert ID' ); + throw new MWException( __METHOD__ . ': no insert ID' ); } if ( $dbw->getFlag( DBO_TRX ) ) { $dbw->commit( __METHOD__ ); diff --git a/includes/filebackend/FileBackendStore.php b/includes/filebackend/FileBackendStore.php index 18a59fa420..5a91f9e8f5 100644 --- a/includes/filebackend/FileBackendStore.php +++ b/includes/filebackend/FileBackendStore.php @@ -1578,7 +1578,7 @@ abstract class FileBackendStore extends FileBackend { * @param $val mixed Information to cache */ final protected function setContainerCache( $container, $val ) { - $this->memCache->add( $this->containerCacheKey( $container ), $val, 14*86400 ); + $this->memCache->add( $this->containerCacheKey( $container ), $val, 14 * 86400 ); } /** @@ -1673,7 +1673,7 @@ abstract class FileBackendStore extends FileBackend { if ( $path === null ) { return; // invalid storage path } - $this->memCache->add( $this->fileCacheKey( $path ), $val, 7*86400 ); + $this->memCache->add( $this->fileCacheKey( $path ), $val, 7 * 86400 ); } /** diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index 2f7e256710..00c0ff825c 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -132,7 +132,7 @@ class SwiftFileBackend extends FileBackendStore { : false; $this->swiftCDNExpiry = isset( $config['swiftCDNExpiry'] ) ? $config['swiftCDNExpiry'] - : 12*3600; // 12 hours is safe (tokens last 24 hours per http://docs.openstack.org) + : 12 * 3600; // 12 hours is safe (tokens last 24 hours per http://docs.openstack.org) $this->swiftCDNPurgable = isset( $config['swiftCDNPurgable'] ) ? $config['swiftCDNPurgable'] : true; @@ -1397,12 +1397,12 @@ class SwiftFileBackend extends FileBackendStore { if ( is_array( $creds ) ) { // cache hit $this->auth->load_cached_credentials( $creds['auth_token'], $creds['storage_url'], $creds['cdnm_url'] ); - $this->sessionStarted = time() - ceil( $this->authTTL/2 ); // skew for worst case + $this->sessionStarted = time() - ceil( $this->authTTL / 2 ); // skew for worst case } else { // cache miss try { $this->auth->authenticate(); $creds = $this->auth->export_credentials(); - $this->srvCache->add( $cacheKey, $creds, ceil( $this->authTTL/2 ) ); // cache + $this->srvCache->add( $cacheKey, $creds, ceil( $this->authTTL / 2 ) ); // cache $this->sessionStarted = time(); } catch ( CloudFilesException $e ) { $this->connException = $e; // don't keep re-trying diff --git a/includes/filebackend/lockmanager/LockManager.php b/includes/filebackend/lockmanager/LockManager.php index f534eff38b..9b7a7ff6c7 100644 --- a/includes/filebackend/lockmanager/LockManager.php +++ b/includes/filebackend/lockmanager/LockManager.php @@ -76,10 +76,10 @@ abstract class LockManager { if ( isset( $config['lockTTL'] ) ) { $this->lockTTL = max( 1, $config['lockTTL'] ); } elseif ( PHP_SAPI === 'cli' ) { - $this->lockTTL = 2*3600; + $this->lockTTL = 2 * 3600; } else { $met = ini_get( 'max_execution_time' ); // this is 0 in CLI mode - $this->lockTTL = max( 5*60, 2*(int)$met ); + $this->lockTTL = max( 5 * 60, 2 * (int)$met ); } } diff --git a/includes/filebackend/lockmanager/MemcLockManager.php b/includes/filebackend/lockmanager/MemcLockManager.php index fafc588a9e..757aeee1fa 100644 --- a/includes/filebackend/lockmanager/MemcLockManager.php +++ b/includes/filebackend/lockmanager/MemcLockManager.php @@ -145,7 +145,7 @@ class MemcLockManager extends QuorumLockManager { foreach ( $paths as $path ) { $locksKey = $this->recordKeyForPath( $path ); $locksHeld = $lockRecords[$locksKey]; - $ok = $memc->set( $locksKey, $locksHeld, 7*86400 ); + $ok = $memc->set( $locksKey, $locksHeld, 7 * 86400 ); if ( !$ok ) { $status->fatal( 'lockmanager-fail-acquirelock', $path ); } else { @@ -297,7 +297,7 @@ class MemcLockManager extends QuorumLockManager { $start = microtime( true ); do { if ( ( ++$rounds % 4 ) == 0 ) { - usleep( 1000*50 ); // 50 ms + usleep( 1000 * 50 ); // 50 ms } foreach ( array_diff( $keys, $lockedKeys ) as $key ) { if ( $memc->add( "$key:mutex", 1, 180 ) ) { // lock record diff --git a/includes/filebackend/lockmanager/QuorumLockManager.php b/includes/filebackend/lockmanager/QuorumLockManager.php index b331b540fc..3b96ad6906 100644 --- a/includes/filebackend/lockmanager/QuorumLockManager.php +++ b/includes/filebackend/lockmanager/QuorumLockManager.php @@ -125,7 +125,7 @@ abstract class QuorumLockManager extends LockManager { $yesVotes = 0; // locks made on trustable servers $votesLeft = count( $this->srvsByBucket[$bucket] ); // remaining peers - $quorum = floor( $votesLeft/2 + 1 ); // simple majority + $quorum = floor( $votesLeft / 2 + 1 ); // simple majority // Get votes for each peer, in order, until we have enough... foreach ( $this->srvsByBucket[$bucket] as $lockSrv ) { if ( !$this->isServerUp( $lockSrv ) ) { diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index 366dd8a5d8..0e30017581 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -259,19 +259,19 @@ class FileRepo { */ public function resolveVirtualUrl( $url ) { if ( substr( $url, 0, 9 ) != 'mwrepo://' ) { - throw new MWException( __METHOD__.': unknown protocol' ); + throw new MWException( __METHOD__ . ': unknown protocol' ); } $bits = explode( '/', substr( $url, 9 ), 3 ); if ( count( $bits ) != 3 ) { - throw new MWException( __METHOD__.": invalid mwrepo URL: $url" ); + throw new MWException( __METHOD__ . ": invalid mwrepo URL: $url" ); } list( $repo, $zone, $rel ) = $bits; if ( $repo !== $this->name ) { - throw new MWException( __METHOD__.": fetching from a foreign repo is not supported" ); + throw new MWException( __METHOD__ . ": fetching from a foreign repo is not supported" ); } $base = $this->getZonePath( $zone ); if ( !$base ) { - throw new MWException( __METHOD__.": invalid zone: $zone" ); + throw new MWException( __METHOD__ . ": invalid zone: $zone" ); } return $base . '/' . rawurldecode( $rel ); } @@ -987,7 +987,7 @@ class FileRepo { $temp = $this->getVirtualUrl( 'temp' ); if ( substr( $virtualUrl, 0, strlen( $temp ) ) != $temp ) { - wfDebug( __METHOD__.": Invalid temp virtual URL\n" ); + wfDebug( __METHOD__ . ": Invalid temp virtual URL\n" ); return false; } @@ -1306,9 +1306,9 @@ class FileRepo { foreach ( $sourceDestPairs as $pair ) { list( $srcRel, $archiveRel ) = $pair; if ( !$this->validateFilename( $srcRel ) ) { - throw new MWException( __METHOD__.':Validation error in $srcRel' ); + throw new MWException( __METHOD__ . ':Validation error in $srcRel' ); } elseif ( !$this->validateFilename( $archiveRel ) ) { - throw new MWException( __METHOD__.':Validation error in $archiveRel' ); + throw new MWException( __METHOD__ . ':Validation error in $archiveRel' ); } $publicRoot = $this->getZonePath( 'public' ); diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index be11b23353..d017e1351c 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -47,7 +47,7 @@ class LocalRepo extends FileRepo { } elseif ( isset( $row->oi_name ) ) { return call_user_func( $this->oldFileFromRowFactory, $row, $this ); } else { - throw new MWException( __METHOD__.': invalid row' ); + throw new MWException( __METHOD__ . ': invalid row' ); } } @@ -281,17 +281,17 @@ class LocalRepo extends FileRepo { return $result; } - /** - * Return an array of files where the name starts with $prefix. - * - * @param string $prefix The prefix to search for - * @param int $limit The maximum amount of files to return - * @return array - */ + /** + * Return an array of files where the name starts with $prefix. + * + * @param string $prefix The prefix to search for + * @param int $limit The maximum amount of files to return + * @return array + */ public function findFilesByPrefix( $prefix, $limit ) { $selectOptions = array( 'ORDER BY' => 'img_name', 'LIMIT' => intval( $limit ) ); - // Query database + // Query database $dbr = $this->getSlaveDB(); $res = $dbr->select( 'image', @@ -306,7 +306,7 @@ class LocalRepo extends FileRepo { foreach ( $res as $row ) { $files[] = $this->newFileFromRow( $row ); } - return $files; + return $files; } /** diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 64155e600f..255da179ce 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -1096,7 +1096,7 @@ abstract class File { * * @return array */ - function getHistory( $limit = null, $start = null, $end = null, $inc=true ) { + function getHistory( $limit = null, $start = null, $end = null, $inc = true ) { return array(); } diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index f8887cc349..b481e83b0d 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1406,7 +1406,7 @@ class LocalFile extends File { $this->lock(); // begin - $archiveName = wfTimestamp( TS_MW ) . '!'. $this->getName(); + $archiveName = wfTimestamp( TS_MW ) . '!' . $this->getName(); $archiveRel = 'archive/' . $this->getHashPath() . $archiveName; $flags = $flags & File::DELETE_SOURCE ? LocalRepo::DELETE_SOURCE : 0; $status = $this->repo->publish( $srcPath, $dstRel, $archiveRel, $flags, $options ); diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index daac558a70..0dca23d766 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -464,7 +464,7 @@ abstract class Installer { $type = strtolower( $type ); if ( !isset( $this->dbInstallers[$type] ) ) { - $class = ucfirst( $type ). 'Installer'; + $class = ucfirst( $type ) . 'Installer'; $this->dbInstallers[$type] = new $class( $this ); } diff --git a/includes/installer/OracleInstaller.php b/includes/installer/OracleInstaller.php index 632015f572..e85d07f2bf 100644 --- a/includes/installer/OracleInstaller.php +++ b/includes/installer/OracleInstaller.php @@ -66,8 +66,8 @@ class OracleInstaller extends DatabaseInstaller { $this->getTextBox( '_OracleDefTS', 'config-oracle-def-ts' ) . $this->getTextBox( '_OracleTempTS', 'config-oracle-temp-ts', array(), $this->parent->getHelpBox( 'config-db-oracle-help' ) ) . Html::closeElement( 'fieldset' ) . - $this->parent->getWarningBox( wfMessage( 'config-db-account-oracle-warn' )->text() ). - $this->getInstallUserBox(). + $this->parent->getWarningBox( wfMessage( 'config-db-account-oracle-warn' )->text() ) . + $this->getInstallUserBox() . $this->getWebUserBox(); } diff --git a/includes/installer/OracleUpdater.php b/includes/installer/OracleUpdater.php index cafe8cd78e..56d9f21b1e 100644 --- a/includes/installer/OracleUpdater.php +++ b/includes/installer/OracleUpdater.php @@ -183,7 +183,12 @@ class OracleUpdater extends DatabaseUpdater { * cascading taken in account in the deleting function */ protected function doRecentchangesFK2Cascade() { - $meta = $this->db->query( 'SELECT 1 FROM all_constraints WHERE owner = \''.strtoupper($this->db->getDBname()).'\' AND constraint_name = \''.$this->db->tablePrefix().'RECENTCHANGES_FK2\' AND delete_rule = \'CASCADE\'' ); + $meta = $this->db->query( 'SELECT 1 FROM all_constraints WHERE owner = \'' . + strtoupper( $this->db->getDBname() ) . + '\' AND constraint_name = \'' . + $this->db->tablePrefix() . + 'RECENTCHANGES_FK2\' AND delete_rule = \'CASCADE\'' + ); $row = $meta->fetchRow(); if ( $row ) { return; @@ -198,7 +203,10 @@ class OracleUpdater extends DatabaseUpdater { protected function doPageRestrictionsPKUKFix() { $this->output( "Altering PAGE_RESTRICTIONS keys ... " ); - $meta = $this->db->query( 'SELECT column_name FROM all_cons_columns WHERE owner = \''.strtoupper($this->db->getDBname()).'\' AND constraint_name = \'MW_PAGE_RESTRICTIONS_PK\' AND rownum = 1' ); + $meta = $this->db->query( 'SELECT column_name FROM all_cons_columns WHERE owner = \'' . + strtoupper( $this->db->getDBname() ) . + '\' AND constraint_name = \'MW_PAGE_RESTRICTIONS_PK\' AND rownum = 1' + ); $row = $meta->fetchRow(); if ( $row['column_name'] == 'PR_ID' ) { $this->output( "seems to be up to date.\n" ); @@ -234,7 +242,7 @@ class OracleUpdater extends DatabaseUpdater { # We can't guarantee that the user will be able to use TRUNCATE, # but we know that DELETE is available to us $this->output( "Purging caches..." ); - $this->db->delete( '/*Q*/'.$this->db->tableName( 'objectcache' ), '*', __METHOD__ ); + $this->db->delete( '/*Q*/' . $this->db->tableName( 'objectcache' ), '*', __METHOD__ ); $this->output( "done.\n" ); } diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index 08797b2b64..2615fc656d 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -744,7 +744,7 @@ END; protected function dropIndex( $table, $index, $patch = '', $fullpath = false ) { if ( $this->db->indexExists( $table, $index ) ) { $this->output( "Dropping obsolete index '$index'\n" ); - $this->db->query( "DROP INDEX \"". $index ."\"" ); + $this->db->query( "DROP INDEX \"" . $index . "\"" ); } } @@ -752,7 +752,7 @@ END; $pu = $this->db->indexAttributes( $index ); if ( !empty( $pu ) && $pu != $should_be ) { $this->output( "Dropping obsolete version of index '$index'\n" ); - $this->db->query( "DROP INDEX \"". $index ."\"" ); + $this->db->query( "DROP INDEX \"" . $index . "\"" ); $pu = array(); } else { $this->output( "...no need to drop index '$index'\n" ); diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index ac66cd9971..30aa9568a8 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -640,7 +640,7 @@ class WebInstaller extends Installer { */ public function getInfoBox( $text, $icon = false, $class = false ) { $text = $this->parse( $text, true ); - $icon = ( $icon == false ) ? '../skins/common/images/info-32.png' : '../skins/common/images/'.$icon; + $icon = ( $icon == false ) ? '../skins/common/images/info-32.png' : '../skins/common/images/' . $icon; $alt = wfMessage( 'config-information' )->text(); return Html::infoBox( $text, $icon, $alt, $class, false ); } diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php index d61d843f74..a6a8667f68 100644 --- a/includes/installer/WebInstallerOutput.php +++ b/includes/installer/WebInstallerOutput.php @@ -223,7 +223,7 @@ class WebInstallerOutput { $this->parent->request->response()->header( 'X-Frame-Options: DENY' ); } if ( $this->redirectTarget ) { - $this->parent->request->response()->header( 'Location: '.$this->redirectTarget ); + $this->parent->request->response()->header( 'Location: ' . $this->redirectTarget ); return; } diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 8aec28916d..3f3e50a8ef 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -336,7 +336,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage { protected function showKeyForm() { $this->startForm(); $this->addHTML( - $this->parent->getInfoBox( wfMessage( 'config-localsettings-upgrade' )->plain() ). + $this->parent->getInfoBox( wfMessage( 'config-localsettings-upgrade' )->plain() ) . '
' . $this->parent->getTextBox( array( 'var' => 'wgUpgradeKey', @@ -1066,7 +1066,7 @@ class WebInstaller_Options extends WebInstallerPage { // If you change this height, also change it in config.css $expandJs = str_replace( '$1', '54em', $js ); $reduceJs = str_replace( '$1', '70px', $js ); - return '

'. + return '

' . Html::element( 'img', array( 'src' => $this->getVar( 'wgRightsIcon' ) ) ) . '  ' . htmlspecialchars( $this->getVar( 'wgRightsText' ) ) . diff --git a/includes/job/JobQueueAggregatorMemc.php b/includes/job/JobQueueAggregatorMemc.php index 15bb833208..c364209541 100644 --- a/includes/job/JobQueueAggregatorMemc.php +++ b/includes/job/JobQueueAggregatorMemc.php @@ -93,7 +93,7 @@ class JobQueueAggregatorMemc extends JobQueueAggregator { 'pendingDBs' => $this->findPendingWikiQueues(), 'timestamp' => time() ); - for ( $attempts=1; $attempts <= 25; ++$attempts ) { + for ( $attempts = 1; $attempts <= 25; ++$attempts ) { if ( $this->cache->add( "$key:lock", 1, 60 ) ) { // lock $this->cache->set( $key, $pendingDbInfo ); $this->cache->delete( "$key:lock" ); // unlock diff --git a/includes/job/jobs/DoubleRedirectJob.php b/includes/job/jobs/DoubleRedirectJob.php index 05abeeefb6..0be03b3264 100644 --- a/includes/job/jobs/DoubleRedirectJob.php +++ b/includes/job/jobs/DoubleRedirectJob.php @@ -90,33 +90,33 @@ class DoubleRedirectJob extends Job { $targetRev = Revision::newFromTitle( $this->title, false, Revision::READ_LATEST ); if ( !$targetRev ) { - wfDebug( __METHOD__.": target redirect already deleted, ignoring\n" ); + wfDebug( __METHOD__ . ": target redirect already deleted, ignoring\n" ); return true; } $content = $targetRev->getContent(); $currentDest = $content ? $content->getRedirectTarget() : null; if ( !$currentDest || !$currentDest->equals( $this->redirTitle ) ) { - wfDebug( __METHOD__.": Redirect has changed since the job was queued\n" ); + wfDebug( __METHOD__ . ": Redirect has changed since the job was queued\n" ); return true; } # Check for a suppression tag (used e.g. in periodically archived discussions) $mw = MagicWord::get( 'staticredirect' ); if ( $content->matchMagicWord( $mw ) ) { - wfDebug( __METHOD__.": skipping: suppressed with __STATICREDIRECT__\n" ); + wfDebug( __METHOD__ . ": skipping: suppressed with __STATICREDIRECT__\n" ); return true; } # Find the current final destination $newTitle = self::getFinalDestination( $this->redirTitle ); if ( !$newTitle ) { - wfDebug( __METHOD__.": skipping: single redirect, circular redirect or invalid redirect destination\n" ); + wfDebug( __METHOD__ . ": skipping: single redirect, circular redirect or invalid redirect destination\n" ); return true; } if ( $newTitle->equals( $this->redirTitle ) ) { # The redirect is already right, no need to change it # This can happen if the page was moved back (say after vandalism) - wfDebug( __METHOD__.": skipping, already good\n" ); + wfDebug( __METHOD__ . " : skipping, already good\n" ); } # Preserve fragment (bug 14904) diff --git a/includes/job/jobs/HTMLCacheUpdateJob.php b/includes/job/jobs/HTMLCacheUpdateJob.php index d4a2024159..1a2143e315 100644 --- a/includes/job/jobs/HTMLCacheUpdateJob.php +++ b/includes/job/jobs/HTMLCacheUpdateJob.php @@ -97,7 +97,7 @@ class HTMLCacheUpdateJob extends Job { # Check if the row count estimate was correct if ( $titleArray->count() > $this->rowsPerJob * 2 ) { # Not correct, do accurate partition - wfDebug( __METHOD__.": row count estimate was incorrect, repartitioning\n" ); + wfDebug( __METHOD__ . ": row count estimate was incorrect, repartitioning\n" ); $this->insertJobsFromTitles( $titleArray ); } else { $this->invalidateTitles( $titleArray ); // just do the query @@ -169,13 +169,13 @@ class HTMLCacheUpdateJob extends Job { 'end' => $this->params['end'] ) + $rootJobParams // carry over information for de-duplication ); - wfDebug( __METHOD__.": repartitioning into " . count( $jobs ) . " jobs\n" ); + wfDebug( __METHOD__ . ": repartitioning into " . count( $jobs ) . " jobs\n" ); if ( count( $jobs ) < 2 ) { # I don't think this is possible at present, but handling this case # makes the code a bit more robust against future code updates and # avoids a potential infinite loop of repartitioning - wfDebug( __METHOD__.": repartitioning failed!\n" ); + wfDebug( __METHOD__ . ": repartitioning failed!\n" ); $this->invalidateTitles( $titleArray ); } else { JobQueueGroup::singleton()->push( $jobs ); diff --git a/includes/logging/DeleteLogFormatter.php b/includes/logging/DeleteLogFormatter.php index 8a9e6dbc88..1e0e54fced 100644 --- a/includes/logging/DeleteLogFormatter.php +++ b/includes/logging/DeleteLogFormatter.php @@ -55,8 +55,8 @@ class DeleteLogFormatter extends LogFormatter { ) { $paramStart = $subtype === 'revision' ? 4 : 3; - $old = $this->parseBitField( $params[$paramStart+1] ); - $new = $this->parseBitField( $params[$paramStart+2] ); + $old = $this->parseBitField( $params[$paramStart + 1] ); + $new = $this->parseBitField( $params[$paramStart + 2] ); list( $hid, $unhid, $extra ) = RevisionDeleter::getChanges( $new, $old ); $changes = array(); foreach ( $hid as $v ) { diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index 501af7d650..fd598dff87 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -97,7 +97,7 @@ class LogEventsList extends ContextSource { * @param $filter: array * @param $tagFilter: array? */ - public function showOptions( $types=array(), $user = '', $page = '', $pattern = '', $year = '', + public function showOptions( $types = array(), $user = '', $page = '', $pattern = '', $year = '', $month = '', $filter = null, $tagFilter = '' ) { global $wgScript, $wgMiserMode; @@ -467,7 +467,7 @@ class LogEventsList extends ContextSource { * @return Integer Number of total log items (not limited by $lim) */ public static function showLogExtract( - &$out, $types=array(), $page = '', $user = '', $param = array() + &$out, $types = array(), $page = '', $user = '', $param = array() ) { $defaultParameters = array( 'lim' => 25, diff --git a/includes/logging/LogPage.php b/includes/logging/LogPage.php index 4191c577a5..36ba200961 100644 --- a/includes/logging/LogPage.php +++ b/includes/logging/LogPage.php @@ -262,7 +262,7 @@ class LogPage { // User suppression if ( preg_match( '/^(block|suppress)\/(block|reblock)$/', $key ) ) { if ( $skin ) { - $params[1] = '' . + $params[1] = '' . $wgLang->translateBlockExpiry( $params[1] ) . ''; } else { $params[1] = $wgContLang->translateBlockExpiry( $params[1] ); diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php index 0a39a2cf3e..a41521db6f 100644 --- a/includes/media/DjVu.php +++ b/includes/media/DjVu.php @@ -185,7 +185,7 @@ class DjVuHandler extends ImageHandler { } $cmd .= ' > ' . wfEscapeShellArg( $dstPath ) . ') 2>&1'; wfProfileIn( 'ddjvu' ); - wfDebug( __METHOD__.": $cmd\n" ); + wfDebug( __METHOD__ . ": $cmd\n" ); $retval = ''; $err = wfShellExec( $cmd, $retval ); wfProfileOut( 'ddjvu' ); @@ -311,7 +311,7 @@ class DjVuHandler extends ImageHandler { return false; } - $o = $tree->BODY[0]->OBJECT[$page-1]; + $o = $tree->BODY[0]->OBJECT[$page - 1]; if ( $o ) { return array( 'width' => intval( $o['width'] ), @@ -328,7 +328,7 @@ class DjVuHandler extends ImageHandler { return false; } - $o = $tree->BODY[0]->PAGE[$page-1]; + $o = $tree->BODY[0]->PAGE[$page - 1]; if ( $o ) { $txt = $o['value']; return $txt; diff --git a/includes/media/DjVuImage.php b/includes/media/DjVuImage.php index 0831e68ce2..5d3189851d 100644 --- a/includes/media/DjVuImage.php +++ b/includes/media/DjVuImage.php @@ -280,7 +280,7 @@ EOR; $txt = preg_replace_callback( $reg, array( $this, 'pageTextCallback' ), $txt ); $txt = "\n\n\n" . $txt . "\n\n"; $xml = preg_replace( "//", "", $xml, 1 ); - $xml = $xml . $txt. ''; + $xml = $xml . $txt . ''; } } wfProfileOut( __METHOD__ ); diff --git a/includes/media/GIFMetadataExtractor.php b/includes/media/GIFMetadataExtractor.php index 6a4e753da0..6a46cc02d4 100644 --- a/includes/media/GIFMetadataExtractor.php +++ b/includes/media/GIFMetadataExtractor.php @@ -157,7 +157,7 @@ class GIFMetadataExtractor { $commentCount = count( $comment ); if ( $commentCount === 0 - || $comment[$commentCount-1] !== $data ) + || $comment[$commentCount - 1] !== $data ) { // Some applications repeat the same comment on each // frame of an animated GIF image, so if this comment diff --git a/includes/media/IPTC.php b/includes/media/IPTC.php index a1b3fd813c..6e04b3dbff 100644 --- a/includes/media/IPTC.php +++ b/includes/media/IPTC.php @@ -396,7 +396,7 @@ class IPTC { return null; } - $tz = ( intval( substr( $time, 7, 2 ) ) *60*60 ) + $tz = ( intval( substr( $time, 7, 2 ) ) * 60 * 60 ) + ( intval( substr( $time, 9, 2 ) ) * 60 ); if ( substr( $time, 6, 1 ) === '-' ) { diff --git a/includes/media/ImageHandler.php b/includes/media/ImageHandler.php index 6ee0399b04..d2bf1f35fa 100644 --- a/includes/media/ImageHandler.php +++ b/includes/media/ImageHandler.php @@ -58,7 +58,7 @@ abstract class ImageHandler extends MediaHandler { } elseif ( isset( $params['width'] ) ) { $width = $params['width']; } else { - throw new MWException( 'No width specified to '.__METHOD__ ); + throw new MWException( 'No width specified to ' . __METHOD__ ); } # Removed for ProofreadPage #$width = intval( $width ); diff --git a/includes/media/MediaTransformOutput.php b/includes/media/MediaTransformOutput.php index 1c2dfdd22b..2616edbbe1 100644 --- a/includes/media/MediaTransformOutput.php +++ b/includes/media/MediaTransformOutput.php @@ -301,7 +301,7 @@ class ThumbnailImage extends MediaTransformOutput { */ function toHtml( $options = array() ) { if ( count( func_get_args() ) == 2 ) { - throw new MWException( __METHOD__ .' called in the old style' ); + throw new MWException( __METHOD__ . ' called in the old style' ); } $alt = empty( $options['alt'] ) ? '' : $options['alt']; diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index f21d6b0847..128bba36b1 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -126,7 +126,7 @@ class SVGReader { } if ( $this->reader->localName != 'svg' || $this->reader->namespaceURI != self::NS_SVG ) { - throw new MWException( "Expected tag, got ". + throw new MWException( "Expected tag, got " . $this->reader->localName . " in NS " . $this->reader->namespaceURI ); } $this->debug( " tag is correct." ); @@ -178,7 +178,7 @@ class SVGReader { * @param string $name of the element that we are reading from * @param string $metafield that we will fill with the result */ - private function readField( $name, $metafield=null ) { + private function readField( $name, $metafield = null ) { $this->debug( "Read field $metafield" ); if( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) { return; @@ -200,7 +200,7 @@ class SVGReader { * @param string $metafield that we will fill with the result * @throws MWException */ - private function readXml( $metafield=null ) { + private function readXml( $metafield = null ) { $this->debug( "Read top level metadata" ); if( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) { return; diff --git a/includes/media/XMPValidate.php b/includes/media/XMPValidate.php index f7274005ae..3e29c12b24 100644 --- a/includes/media/XMPValidate.php +++ b/includes/media/XMPValidate.php @@ -346,8 +346,8 @@ class XMPValidate { $val, $m ) ) { $coord = intval( $m[1] ); - $coord += intval( $m[2] ) * (1/60); - $coord += intval( $m[3] ) * (1/3600); + $coord += intval( $m[2] ) * ( 1 / 60 ); + $coord += intval( $m[3] ) * ( 1 / 3600 ); if ( $m[4] === 'S' || $m[4] === 'W' ) { $coord = -$coord; } @@ -358,7 +358,7 @@ class XMPValidate { $val, $m ) ) { $coord = intval( $m[1] ); - $coord += floatval( $m[2] ) * (1/60); + $coord += floatval( $m[2] ) * ( 1 / 60 ); if ( $m[3] === 'S' || $m[3] === 'W' ) { $coord = -$coord; } diff --git a/includes/objectcache/BagOStuff.php b/includes/objectcache/BagOStuff.php index dd7446724e..fbde251ff6 100644 --- a/includes/objectcache/BagOStuff.php +++ b/includes/objectcache/BagOStuff.php @@ -175,7 +175,7 @@ abstract class BagOStuff { } $uRTT = ceil( 1e6 * ( microtime( true ) - $timestamp ) ); // estimate RTT (us) - $sleep = 2*$uRTT; // rough time to do get()+set() + $sleep = 2 * $uRTT; // rough time to do get()+set() $locked = false; // lock acquired $attempts = 0; // failed attempts diff --git a/includes/objectcache/MemcachedPeclBagOStuff.php b/includes/objectcache/MemcachedPeclBagOStuff.php index 31924293fb..748c4235bb 100644 --- a/includes/objectcache/MemcachedPeclBagOStuff.php +++ b/includes/objectcache/MemcachedPeclBagOStuff.php @@ -87,13 +87,13 @@ class MemcachedPeclBagOStuff extends MemcachedBagOStuff { break; case 'igbinary': if ( !Memcached::HAVE_IGBINARY ) { - throw new MWException( __CLASS__.': the igbinary extension is not available ' . + throw new MWException( __CLASS__ . ': the igbinary extension is not available ' . 'but igbinary serialization was requested.' ); } $this->client->setOption( Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_IGBINARY ); break; default: - throw new MWException( __CLASS__.': invalid value for serializer parameter' ); + throw new MWException( __CLASS__ . ': invalid value for serializer parameter' ); } $servers = array(); foreach ( $params['servers'] as $host ) { diff --git a/includes/objectcache/MultiWriteBagOStuff.php b/includes/objectcache/MultiWriteBagOStuff.php index 92afaacd2d..e550c0d0e4 100644 --- a/includes/objectcache/MultiWriteBagOStuff.php +++ b/includes/objectcache/MultiWriteBagOStuff.php @@ -43,7 +43,7 @@ class MultiWriteBagOStuff extends BagOStuff { */ public function __construct( $params ) { if ( !isset( $params['caches'] ) ) { - throw new MWException( __METHOD__.': the caches parameter is required' ); + throw new MWException( __METHOD__ . ': the caches parameter is required' ); } $this->caches = array(); diff --git a/includes/parser/DateFormatter.php b/includes/parser/DateFormatter.php index 08b1f3e63f..8103b60529 100644 --- a/includes/parser/DateFormatter.php +++ b/includes/parser/DateFormatter.php @@ -205,7 +205,7 @@ class DateFormatter { $key = $this->keys[$this->mSource]; for ( $p = 0; $p < strlen( $key ); $p++ ) { if ( $key[$p] != ' ' ) { - $bits[$key[$p]] = $matches[$p+1]; + $bits[$key[$p]] = $matches[$p + 1]; } } diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 611eb02a4b..0247d3e143 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -531,7 +531,7 @@ class Parser { * * @return string */ - function recursiveTagParse( $text, $frame=false ) { + function recursiveTagParse( $text, $frame = false ) { wfProfileIn( __METHOD__ ); wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) ); wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) ); @@ -1374,12 +1374,12 @@ class Parser { # If there are ever four apostrophes, assume the first is supposed to # be text, and the remaining three constitute mark-up for bold text. if ( strlen( $arr[$i] ) == 4 ) { - $arr[$i-1] .= "'"; + $arr[$i - 1] .= "'"; $arr[$i] = "'''"; } elseif ( strlen( $arr[$i] ) > 5 ) { # If there are more than 5 apostrophes in a row, assume they're all # text except for the last 5. - $arr[$i-1] .= str_repeat( "'", strlen( $arr[$i] ) - 5 ); + $arr[$i - 1] .= str_repeat( "'", strlen( $arr[$i] ) - 5 ); $arr[$i] = "'''''"; } # Count the number of occurrences of bold and italics mark-ups. @@ -1406,8 +1406,8 @@ class Parser { $firstspace = -1; foreach ( $arr as $r ) { if ( ( $i % 2 == 1 ) and ( strlen( $r ) == 3 ) ) { - $x1 = substr( $arr[$i-1], -1 ); - $x2 = substr( $arr[$i-1], -2, 1 ); + $x1 = substr( $arr[$i - 1], -1 ); + $x2 = substr( $arr[$i - 1], -2, 1 ); if ( $x1 === ' ' ) { if ( $firstspace == -1 ) { $firstspace = $i; @@ -1428,17 +1428,17 @@ class Parser { # If there is a single-letter word, use it! if ( $firstsingleletterword > -1 ) { $arr[$firstsingleletterword] = "''"; - $arr[$firstsingleletterword-1] .= "'"; + $arr[$firstsingleletterword - 1] .= "'"; } elseif ( $firstmultiletterword > -1 ) { # If not, but there's a multi-letter word, use that one. $arr[$firstmultiletterword] = "''"; - $arr[$firstmultiletterword-1] .= "'"; + $arr[$firstmultiletterword - 1] .= "'"; } elseif ( $firstspace > -1 ) { # ... otherwise use the first one that has neither. # (notice that it is possible for all three to be -1 if, for example, # there is only one pentuple-apostrophe in the line) $arr[$firstspace] = "''"; - $arr[$firstspace-1] .= "'"; + $arr[$firstspace - 1] .= "'"; } } @@ -1539,7 +1539,7 @@ class Parser { $s = array_shift( $bits ); $i = 0; - while ( $imLastSection != '' ) { - $result = 'mLastSection . ">\n"; + $result = 'mLastSection . ">\n"; } $this->mInPre = false; $this->mLastSection = ''; @@ -2350,13 +2350,13 @@ class Parser { # Close all the prefixes which aren't shared. while ( $commonPrefixLength < $lastPrefixLength ) { - $output .= $this->closeList( $lastPrefix[$lastPrefixLength-1] ); + $output .= $this->closeList( $lastPrefix[$lastPrefixLength - 1] ); --$lastPrefixLength; } # Continue the current prefix if appropriate. if ( $prefixLength <= $commonPrefixLength && $commonPrefixLength > 0 ) { - $output .= $this->nextItem( $prefix[$commonPrefixLength-1] ); + $output .= $this->nextItem( $prefix[$commonPrefixLength - 1] ); } # Open prefixes where appropriate. @@ -2383,8 +2383,8 @@ class Parser { # XXX: use a stack for nestable elements like span, table and div $openmatch = preg_match( '/(?:mUniqPrefix . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', $t ); + '/(?:<\\/table|<\\/blockquote|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|' . + 'mUniqPrefix . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', $t ); if ( $openmatch or $closematch ) { $paragraphStack = false; # TODO bug 5718: paragraph closed @@ -2441,7 +2441,7 @@ class Parser { } } while ( $prefixLength ) { - $output .= $this->closeList( $prefix2[$prefixLength-1] ); + $output .= $this->closeList( $prefix2[$prefixLength - 1] ); --$prefixLength; } if ( $this->mLastSection != '' ) { @@ -2477,7 +2477,7 @@ class Parser { if ( $lt === false || $lt > $pos ) { # Easy; no tag nesting to worry about $before = substr( $str, 0, $pos ); - $after = substr( $str, $pos+1 ); + $after = substr( $str, $pos + 1 ); wfProfileOut( __METHOD__ ); return $pos; } @@ -3089,7 +3089,7 @@ class Parser { $assocArgs[$index++] = $arg; } else { $name = trim( substr( $arg, 0, $eqpos ) ); - $value = trim( substr( $arg, $eqpos+1 ) ); + $value = trim( substr( $arg, $eqpos + 1 ) ); if ( $value === false ) { $value = ''; } @@ -4094,7 +4094,7 @@ class Parser { * @return mixed|string * @private */ - function formatHeadings( $text, $origText, $isMain=true ) { + function formatHeadings( $text, $origText, $isMain = true ) { global $wgMaxTocLevel, $wgHtml5, $wgExperimentalHtmlIds; # Inhibit editsection links if requested in the page @@ -4111,7 +4111,7 @@ class Parser { # Get all headlines for numbering them and adding funky stuff like [edit] # links - this is for later, but we need the number of headlines right now $matches = array(); - $numMatches = preg_match_all( '/[1-6])(?P.*?'.'>)\s*(?P
[\s\S]*?)\s*<\/H[1-6] *>/i', $text, $matches ); + $numMatches = preg_match_all( '/[1-6])(?P.*?' . '>)\s*(?P
[\s\S]*?)\s*<\/H[1-6] *>/i', $text, $matches ); # if there are fewer than 4 headlines in the article, do not show TOC # unless it's been explicitly enabled. @@ -4260,14 +4260,14 @@ class Parser { # We strip any parameter from accepted tags (second regex), except dir="rtl|ltr" from
, # to allow setting directionality in toc items. $tocline = preg_replace( - array( '#<(?!/?(span|sup|sub|i|b)(?: [^>]*)?>).*?'.'>#', '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|i|b))(?: .*?)?'.'>#' ), + array( '#<(?!/?(span|sup|sub|i|b)(?: [^>]*)?>).*?' . '>#', '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|i|b))(?: .*?)?' . '>#' ), array( '', '<$1>' ), $safeHeadline ); $tocline = trim( $tocline ); # For the anchor, strip out HTML-y stuff period - $safeHeadline = preg_replace( '/<.*?'.'>/', '', $safeHeadline ); + $safeHeadline = preg_replace( '/<.*?' . '>/', '', $safeHeadline ); $safeHeadline = Sanitizer::normalizeSectionNameWhitespace( $safeHeadline ); # Save headline for section edit hint before it's escaped diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 7cb91da588..1e9092855d 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -72,9 +72,8 @@ class Preprocessor_DOM implements Preprocessor { $xml = ""; foreach ( $values as $k => $val ) { - if ( is_int( $k ) ) { - $xml .= "" . htmlspecialchars( $val ) .""; + $xml .= "" . htmlspecialchars( $val ) . ""; } else { $xml .= "" . htmlspecialchars( $k ) . "=" . htmlspecialchars( $val ) . ""; } @@ -441,7 +440,7 @@ class Preprocessor_DOM implements Preprocessor { } $tagStartPos = $i; - if ( $text[$tagEndPos-1] == '/' ) { + if ( $text[$tagEndPos - 1] == '/' ) { $attrEnd = $tagEndPos - 1; $inner = null; $i = $tagEndPos + 1; @@ -578,7 +577,7 @@ class Preprocessor_DOM implements Preprocessor { 'open' => $curChar, 'close' => $rule['end'], 'count' => $count, - 'lineStart' => ($i > 0 && $text[$i-1] == "\n"), + 'lineStart' => ($i > 0 && $text[$i - 1] == "\n"), ); $stack->push( $piece ); diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 469ce807d8..465c5a6cfe 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -367,7 +367,7 @@ class Preprocessor_Hash implements Preprocessor { } $tagStartPos = $i; - if ( $text[$tagEndPos-1] == '/' ) { + if ( $text[$tagEndPos - 1] == '/' ) { // Short end tag $attrEnd = $tagEndPos - 1; $inner = null; @@ -515,7 +515,7 @@ class Preprocessor_Hash implements Preprocessor { 'open' => $curChar, 'close' => $rule['end'], 'count' => $count, - 'lineStart' => ($i > 0 && $text[$i-1] == "\n"), + 'lineStart' => ($i > 0 && $text[$i - 1] == "\n"), ); $stack->push( $piece ); diff --git a/includes/profiler/ProfilerSimple.php b/includes/profiler/ProfilerSimple.php index 1d4873c628..b59c528004 100644 --- a/includes/profiler/ProfilerSimple.php +++ b/includes/profiler/ProfilerSimple.php @@ -96,9 +96,9 @@ class ProfilerSimple extends Profiler { $this->mCollated[$functionname] =& $entry; } $entry['cpu'] += $elapsedcpu; - $entry['cpu_sq'] += $elapsedcpu*$elapsedcpu; + $entry['cpu_sq'] += $elapsedcpu * $elapsedcpu; $entry['real'] += $elapsedreal; - $entry['real_sq'] += $elapsedreal*$elapsedreal; + $entry['real_sq'] += $elapsedreal * $elapsedreal; $entry['count']++; } diff --git a/includes/profiler/ProfilerSimpleText.php b/includes/profiler/ProfilerSimpleText.php index 37350bf35c..1d57ea8d97 100644 --- a/includes/profiler/ProfilerSimpleText.php +++ b/includes/profiler/ProfilerSimpleText.php @@ -51,17 +51,17 @@ class ProfilerSimpleText extends ProfilerSimple { uasort( $this->mCollated, array( 'self', 'sort' ) ); array_walk( $this->mCollated, array( 'self', 'format' ), $totalReal ); if ( PHP_SAPI === 'cli' ) { - print "\n"; + print "\n"; } elseif ( $this->getContentType() === 'text/html' ) { if ( $this->visible ) { - print '

'.self::$out.'
'; + print '
' . self::$out . '
'; } else { - print "\n"; + print "\n"; } } elseif ( $this->getContentType() === 'text/javascript' ) { - print "\n/*\n".self::$out."*/\n"; + print "\n/*\n" . self::$out . "*/\n"; } elseif ( $this->getContentType() === 'text/css' ) { - print "\n/*\n".self::$out."*/\n"; + print "\n/*\n" . self::$out . "*/\n"; } } } @@ -71,7 +71,7 @@ class ProfilerSimpleText extends ProfilerSimple { } static function format( $item, $key, $totalReal ) { - $perc = $totalReal ? $item['real']/$totalReal*100 : 0; + $perc = $totalReal ? $item['real'] / $totalReal * 100 : 0; self::$out .= sprintf( "%6.2f%% %3.6f %6d - %s\n", $perc, $item['real'], $item['count'], $key ); } diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 5d335b02b2..6743619f93 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -472,7 +472,7 @@ class ResourceLoader { $this->hasErrors = true; } - wfProfileIn( __METHOD__.'-getModifiedTime' ); + wfProfileIn( __METHOD__ . '-getModifiedTime' ); // To send Last-Modified and support If-Modified-Since, we need to detect // the last modified time @@ -491,7 +491,7 @@ class ResourceLoader { } } - wfProfileOut( __METHOD__.'-getModifiedTime' ); + wfProfileOut( __METHOD__ . '-getModifiedTime' ); // If there's an If-Modified-Since header, respond with a 304 appropriately if ( $this->tryRespondLastModified( $context, $mtime ) ) { diff --git a/includes/revisiondelete/RevisionDelete.php b/includes/revisiondelete/RevisionDelete.php index ae5d934138..d2ce0b7bd8 100644 --- a/includes/revisiondelete/RevisionDelete.php +++ b/includes/revisiondelete/RevisionDelete.php @@ -673,7 +673,7 @@ class RevDel_FileItem extends RevDel_Item { ' (' . $this->list->msg( 'nbytes' )->numParams( $this->file->getSize() )->text() . ')'; return '
  • ' . $this->getLink() . ' ' . $this->getUserTools() . ' ' . - $data . ' ' . $this->getComment(). '
  • '; + $data . ' ' . $this->getComment() . ''; } } diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 6b3e62b160..c0fb278d67 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -1006,7 +1006,7 @@ class SearchHighlighter { $len = strlen( $endMatches[2][0] ); $off = $endMatches[2][1]; $this->splitAndAdd( $otherExt, $count, - substr( $text, $start, $off + $len - $start ) ); + substr( $text, $start, $off + $len - $start ) ); $start = $off + $len; $found = true; break; diff --git a/includes/search/SearchMySQL.php b/includes/search/SearchMySQL.php index 605a71b69c..ddfd1b3049 100644 --- a/includes/search/SearchMySQL.php +++ b/includes/search/SearchMySQL.php @@ -449,7 +449,7 @@ class SearchMySQL extends SearchEngine { * @ingroup Search */ class MySQLSearchResultSet extends SqlSearchResultSet { - function __construct( $resultSet, $terms, $totalHits=null ) { + function __construct( $resultSet, $terms, $totalHits = null ) { parent::__construct( $resultSet, $terms ); $this->mTotalHits = $totalHits; } diff --git a/includes/search/SearchPostgres.php b/includes/search/SearchPostgres.php index b8d5dc19ca..148a657492 100644 --- a/includes/search/SearchPostgres.php +++ b/includes/search/SearchPostgres.php @@ -163,7 +163,7 @@ class SearchPostgres extends SearchEngine { $top = $top[0]; if ( $top === "" ) { ## e.g. if only stopwords are used XXX return something better - $query = "SELECT page_id, page_namespace, page_title, 0 AS score ". + $query = "SELECT page_id, page_namespace, page_title, 0 AS score " . "FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " . "AND r.rev_text_id = c.old_id AND 1=0"; } @@ -175,8 +175,8 @@ class SearchPostgres extends SearchEngine { } } - $query = "SELECT page_id, page_namespace, page_title, ". - "ts_rank($fulltext, to_tsquery($searchstring), 5) AS score ". + $query = "SELECT page_id, page_namespace, page_title, " . + "ts_rank($fulltext, to_tsquery($searchstring), 5) AS score " . "FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " . "AND r.rev_text_id = c.old_id AND $fulltext @@ to_tsquery($searchstring)"; } @@ -208,7 +208,7 @@ class SearchPostgres extends SearchEngine { function update( $pageid, $title, $text ) { ## We don't want to index older revisions - $SQL = "UPDATE pagecontent SET textvector = NULL WHERE old_id IN ". + $SQL = "UPDATE pagecontent SET textvector = NULL WHERE old_id IN " . "(SELECT rev_text_id FROM revision WHERE rev_page = " . intval( $pageid ) . " ORDER BY rev_text_id DESC OFFSET 1)"; $this->db->query( $SQL ); diff --git a/includes/search/SearchSqlite.php b/includes/search/SearchSqlite.php index ee30d9b773..5b0b7f7e76 100644 --- a/includes/search/SearchSqlite.php +++ b/includes/search/SearchSqlite.php @@ -333,7 +333,7 @@ class SearchSqlite extends SearchEngine { * @ingroup Search */ class SqliteSearchResultSet extends SqlSearchResultSet { - function __construct( $resultSet, $terms, $totalHits=null ) { + function __construct( $resultSet, $terms, $totalHits = null ) { parent::__construct( $resultSet, $terms ); $this->mTotalHits = $totalHits; } diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index fc6172ff26..68b002466a 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -35,7 +35,7 @@ class SpecialImport extends SpecialPage { private $namespace; private $rootpage = ''; private $frompage = ''; - private $logcomment= false; + private $logcomment = false; private $history = true; private $includeTemplates = false; private $pageLinkDepth; @@ -188,7 +188,7 @@ class SpecialImport extends SpecialPage { if( $user->isAllowed( 'importupload' ) ) { $out->addHTML( - Xml::fieldset( $this->msg( 'import-upload' )->text() ). + Xml::fieldset( $this->msg( 'import-upload' )->text() ) . Xml::openElement( 'form', array( 'enctype' => 'multipart/form-data', 'method' => 'post', 'action' => $action, 'id' => 'mw-import-upload-form' ) ) . $this->msg( 'importtext' )->parseAsBlock() . @@ -228,7 +228,7 @@ class SpecialImport extends SpecialPage { Xml::submitButton( $this->msg( 'uploadbtn' )->text() ) . " " . - Xml::closeElement( 'table' ). + Xml::closeElement( 'table' ) . Html::hidden( 'editToken', $user->getEditToken() ) . Xml::closeElement( 'form' ) . Xml::closeElement( 'fieldset' ) @@ -335,7 +335,7 @@ class SpecialImport extends SpecialPage { Xml::submitButton( $this->msg( 'import-interwiki-submit' )->text(), Linker::tooltipAndAccesskeyAttribs( 'import' ) ) . " " . - Xml::closeElement( 'table' ). + Xml::closeElement( 'table' ) . Xml::closeElement( 'form' ) . Xml::closeElement( 'fieldset' ) ); @@ -352,7 +352,7 @@ class SpecialImport extends SpecialPage { * @ingroup SpecialPage */ class ImportReporter extends ContextSource { - private $reason=false; + private $reason = false; private $mOriginalLogCallback = null; private $mOriginalPageOutCallback = null; private $mLogItemCount = 0; diff --git a/includes/specials/SpecialLinkSearch.php b/includes/specials/SpecialLinkSearch.php index 1bd33df954..af5b0a1bff 100644 --- a/includes/specials/SpecialLinkSearch.php +++ b/includes/specials/SpecialLinkSearch.php @@ -72,7 +72,7 @@ class LinkSearchPage extends QueryPage { } elseif ( !$pr_sl && $pr_cl ) { // For protocols without '//' like 'mailto:' $protocol = substr( $target2, 0, $pr_cl + 1 ); - $target2 = substr( $target2, $pr_cl+1 ); + $target2 = substr( $target2, $pr_cl + 1 ); } elseif ( $protocol == '' && $target2 != '' ) { // default $protocol = 'http://'; diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 4adb037164..c35c44e5ea 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -532,7 +532,7 @@ class MovePageForm extends UnlistedSpecialPage { ) ) { $conds = array( 'page_title' . $dbr->buildLike( $ot->getDBkey() . '/', $dbr->anyString() ) - .' OR page_title = ' . $dbr->addQuotes( $ot->getDBkey() ) + . ' OR page_title = ' . $dbr->addQuotes( $ot->getDBkey() ) ); $conds['page_namespace'] = array(); if( MWNamespace::hasSubpages( $nt->getNamespace() ) ) { @@ -571,7 +571,7 @@ class MovePageForm extends UnlistedSpecialPage { } $newPageName = preg_replace( - '#^'.preg_quote( $ot->getDBkey(), '#' ).'#', + '#^' . preg_quote( $ot->getDBkey(), '#' ) . '#', StringUtils::escapeRegexReplacement( $nt->getDBkey() ), # bug 21234 $oldSubpage->getDBkey() ); diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index d9145b89bc..6772cb5540 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -887,7 +887,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { $links = array(); foreach ( $filters as $key => $msg ) { $link = $this->makeOptionsLink( $showhide[1 - $options[$key]], - array( $key => 1-$options[$key] ), $nondefaults ); + array( $key => 1 - $options[$key] ), $nondefaults ); $links[] = $this->msg( $msg )->rawParams( $link )->escaped(); } diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index a4ab7a8027..1bf5601441 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -733,7 +733,7 @@ class SpecialSearch extends SpecialPage { wfProfileIn( __METHOD__ ); $terms = $wgContLang->convertForSearchResult( $matches->termMatches() ); - $out = "
    ". + $out = "
    " . $this->msg( 'search-interwiki-caption' )->text() . "
    \n"; $out .= "
      \n"; diff --git a/includes/specials/SpecialSpecialpages.php b/includes/specials/SpecialSpecialpages.php index 57fffb8494..b763322457 100644 --- a/includes/specials/SpecialSpecialpages.php +++ b/includes/specials/SpecialSpecialpages.php @@ -104,7 +104,7 @@ class SpecialSpecialpages extends UnlistedSpecialPage { $out->wrapWikiMsg( "

      $1

      \n", "specialpages-group-$group" ); $out->addHTML( - Html::openElement( 'table', array( 'style' => 'width:100%;', 'class' => 'mw-specialpages-table' ) ) ."\n" . + Html::openElement( 'table', array( 'style' => 'width:100%;', 'class' => 'mw-specialpages-table' ) ) . "\n" . Html::openElement( 'tr' ) . "\n" . Html::openElement( 'td', array( 'style' => 'width:30%;vertical-align:top' ) ) . "\n" . Html::openElement( 'ul' ) . "\n" diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index 199460eef8..e1d6e20f35 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -64,7 +64,7 @@ class SpecialStatistics extends SpecialPage { if( !$wgMemc->get( $key ) ) { $dbw = wfGetDB( DB_MASTER ); SiteStatsUpdate::cacheUpdate( $dbw ); - $wgMemc->set( $key, '1', 24*3600 ); // don't update for 1 day + $wgMemc->set( $key, '1', 24 * 3600 ); // don't update for 1 day } } diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index 336363d59d..7935d13c32 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -448,12 +448,12 @@ class UserrightsPage extends SpecialPage { $count = count( $list ); if ( $count > 0 ) { $grouplist = $this->msg( 'userrights-groupsmember', $count, $user->getName() )->parse(); - $grouplist = '

      ' . $grouplist . ' ' . $displayedList . "

      \n"; + $grouplist = '

      ' . $grouplist . ' ' . $displayedList . "

      \n"; } $count = count( $autoList ); if ( $count > 0 ) { $autogrouplistintro = $this->msg( 'userrights-groupsmember-auto', $count, $user->getName() )->parse(); - $grouplist .= '

      ' . $autogrouplistintro . ' ' . $displayedAutolist . "

      \n"; + $grouplist .= '

      ' . $autogrouplistintro . ' ' . $displayedAutolist . "

      \n"; } $userToolLinks = Linker::userToolLinks( diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 8dd38d4eb8..581727de77 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -113,7 +113,7 @@ class SpecialVersion extends SpecialPage { global $wgLang; if ( defined( 'MEDIAWIKI_INSTALL' ) ) { - $othersLink = '[http://www.mediawiki.org/wiki/Special:Version/Credits ' . wfMessage( 'version-poweredby-others' )->text() . ']'; + $othersLink = '[http://www.mediawiki.org/wiki/Special:Version/Credits ' . wfMessage( 'version-poweredby-others' )->text() . ']'; } else { $othersLink = '[[Special:Version/Credits|' . wfMessage( 'version-poweredby-others' )->text() . ']]'; } @@ -395,7 +395,7 @@ class SpecialVersion extends SpecialPage { $tags[$i] = "<{$tags[$i]}>"; } $out .= $this->openExtType( $this->msg( 'version-parser-extensiontags' )->text(), 'parser-tags' ); - $out .= '' . $this->listToText( $tags ). "\n"; + $out .= '' . $this->listToText( $tags ) . "\n"; } $fhooks = $wgParser->getFunctionHooks(); diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index bf809a13b3..c98c4450a3 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -900,7 +900,7 @@ abstract class UploadBase { "unrecognized extension '$extension', can't verify\n" ); return true; } else { - wfDebug( __METHOD__ . ": rejecting file with unknown detected mime type; ". + wfDebug( __METHOD__ . ": rejecting file with unknown detected mime type; " . "recognized extension '$extension', so probably invalid file\n" ); return false; } @@ -1454,7 +1454,7 @@ abstract class UploadBase { // Remove additional comments after a prefix $comment = strpos( $line, '#' ); if ( $comment > 0 ) { - $line = substr( $line, 0, $comment-1 ); + $line = substr( $line, 0, $comment - 1 ); } $blacklist[] = trim( $line ); } diff --git a/includes/upload/UploadStash.php b/includes/upload/UploadStash.php index 326d91df89..a90fecf162 100644 --- a/includes/upload/UploadStash.php +++ b/includes/upload/UploadStash.php @@ -209,7 +209,7 @@ class UploadStash { list( $usec, $sec ) = explode( ' ', microtime() ); $usec = substr( $usec, 2 ); $key = wfBaseConvert( $sec . $usec, 10, 36 ) . '.' . - wfBaseConvert( mt_rand(), 10, 36 ) . '.'. + wfBaseConvert( mt_rand(), 10, 36 ) . '.' . $this->userId . '.' . $extension; diff --git a/languages/Language.php b/languages/Language.php index b653f9975a..416b1cfb34 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1637,7 +1637,7 @@ class Language { private static function hebrewYearStart( $year ) { $a = intval( ( 12 * ( $year - 1 ) + 17 ) % 19 ); $b = intval( ( $year - 1 ) % 4 ); - $m = 32.044093161144 + 1.5542417966212 * $a + $b / 4.0 - 0.0031777940220923 * ( $year - 1 ); + $m = 32.044093161144 + 1.5542417966212 * $a + $b / 4.0 - 0.0031777940220923 * ( $year - 1 ); if ( $m < 0 ) { $m--; } @@ -3022,7 +3022,7 @@ class Language { $sign = ""; if ( intval( $number ) < 0 ) { // For negative numbers apply the algorithm like positive number and add sign. - $sign = "-"; + $sign = "-"; $number = substr( $number, 1 ); } $integerPart = array(); @@ -3031,7 +3031,7 @@ class Language { preg_match( "/\d+/", $number, $integerPart ); preg_match( "/\.\d*/", $number, $decimalPart ); $groupedNumber = ( count( $decimalPart ) > 0 ) ? $decimalPart[0]:""; - if ( $groupedNumber === $number ) { + if ( $groupedNumber === $number ) { // the string does not have any number part. Eg: .12345 return $sign . $groupedNumber; } diff --git a/languages/classes/LanguageKsh.php b/languages/classes/LanguageKsh.php index 074ad139c4..9398899fb4 100644 --- a/languages/classes/LanguageKsh.php +++ b/languages/classes/LanguageKsh.php @@ -104,17 +104,17 @@ class LanguageKsh extends Language { # däm WikiMaatplaz sing, dä Wikipeedija ier, däm Wikiwööterbooch sing # dem/em WikiMaatplaz sing, de Wikipeedija ier, dem/em Wikiwööterbooch sing $word = ( preg_match( '/ b/', $case ) - ? ( $gender=='f' ? 'dä' : 'däm' ) - : ( $gender=='f' ? 'de' : 'dem' ) + ? ( $gender == 'f' ? 'dä' : 'däm' ) + : ( $gender == 'f' ? 'de' : 'dem' ) ) . ' ' . $word . ' ' . - ( $gender=='f' ? 'ier' : 'sing' ) . + ( $gender == 'f' ? 'ier' : 'sing' ) . ( preg_match( '/ m/', $case ) ? 'e' : '' ); } elseif ( preg_match( '/ e/', $case ) ) { # en dämm WikiMaatPlaz, en dä Wikipeedija, en dämm Wikiwööterbooch # em WikiMaatplaz, en de Wikipeedija, em Wikiwööterbooch if ( preg_match( '/ b/', $case ) ) { - $word = 'en '.( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word; + $word = 'en ' . ( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word; } else { $word = ( $gender == 'f' ? 'en de' : 'em' ) . ' ' . $word; } @@ -124,13 +124,13 @@ class LanguageKsh extends Language { if ( preg_match( '/ b/', $case ) ) { $word = 'vun ' . ( $gender == 'f' ? 'dä' : 'däm' ) . ' ' . $word; } else { - $word = ( $gender== 'f' ? 'vun de' : 'vum' ) . ' ' . $word; + $word = ( $gender == 'f' ? 'vun de' : 'vum' ) . ' ' . $word; } } elseif ( preg_match( '/ [3d]/', $case ) ) { # dämm WikiMaatPlaz, dä Wikipeedija, dämm Wikiwööterbooch # dem/em WikiMaatplaz, de Wikipeedija, dem/em Wikiwööterbooch if ( preg_match( '/ b/', $case ) ) { - $word = ( $gender == 'f' ? 'dää' : 'dämm' ) .' ' . $word; + $word = ( $gender == 'f' ? 'dää' : 'dämm' ) . ' ' . $word; } else { $word = ( $gender == 'f' ? 'de' : 'dem' ) . ' ' . $word; } @@ -160,7 +160,7 @@ class LanguageKsh extends Language { $lord = 'et'; } } - $word = $lord.' '.$word; + $word = $lord . ' ' . $word; } return $word; } diff --git a/languages/classes/LanguageTyv.php b/languages/classes/LanguageTyv.php index 6d147c8793..fc1e8a8123 100644 --- a/languages/classes/LanguageTyv.php +++ b/languages/classes/LanguageTyv.php @@ -150,7 +150,7 @@ class LanguageTyv extends Language { $word = implode( "", $ar[0] ) . "ты"; } else { } - } elseif ( $wordEnding === "л" || $wordEnding === "l" ) { + } elseif ( $wordEnding === "л" || $wordEnding === "l" ) { if ( in_array( $wordLastVowel, $roundFrontVowels ) ) { $word = implode( "", $ar[0] ) . "дү"; } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) { diff --git a/languages/classes/LanguageWa.php b/languages/classes/LanguageWa.php index 9e90c7f4ac..5fe4e8fbab 100644 --- a/languages/classes/LanguageWa.php +++ b/languages/classes/LanguageWa.php @@ -84,16 +84,16 @@ class LanguageWa extends Language { $n = substr( $ts, 6, 2 ); if ( $n == 1 ) { $d = "1î d' " . $this->getMonthName( $m ) . - " " . substr( $ts, 0, 4 ); + " " . substr( $ts, 0, 4 ); } elseif ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) { $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) . - " " . substr( $ts, 0, 4 ); + " " . substr( $ts, 0, 4 ); } elseif ( $m == 4 || $m == 8 || $m == 10 ) { $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) . - " " . substr( $ts, 0, 4 ); + " " . substr( $ts, 0, 4 ); } else { $d = ( 0 + $n ) . " di " . $this->getMonthName( $m ) . - " " . substr( $ts, 0, 4 ); + " " . substr( $ts, 0, 4 ); } return $d; } diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index a13453df48..08d864193c 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -153,7 +153,7 @@ abstract class Maintenance { return false; // last call should be to this function } $includeFuncs = array( 'require_once', 'require', 'include', 'include_once' ); - for( $i=1; $i < $count; $i++ ) { + for( $i = 1; $i < $count; $i++ ) { if ( !in_array( $bt[$i]['function'], $includeFuncs ) ) { return false; // previous calls should all be "requires" } diff --git a/maintenance/backupTextPass.inc b/maintenance/backupTextPass.inc index 0b8b344558..eaac02ccea 100644 --- a/maintenance/backupTextPass.inc +++ b/maintenance/backupTextPass.inc @@ -298,7 +298,7 @@ class TextPassDumper extends BackupDumper { } function checkIfTimeExceeded() { - if ( $this->maxTimeAllowed && ( $this->lastTime - $this->timeOfCheckpoint > $this->maxTimeAllowed ) ) { + if ( $this->maxTimeAllowed && ( $this->lastTime - $this->timeOfCheckpoint > $this->maxTimeAllowed ) ) { return true; } return false; diff --git a/maintenance/benchmarks/Benchmarker.php b/maintenance/benchmarks/Benchmarker.php index 98b35b53f9..9fb39fbd1d 100644 --- a/maintenance/benchmarks/Benchmarker.php +++ b/maintenance/benchmarks/Benchmarker.php @@ -48,20 +48,20 @@ abstract class Benchmarker extends Maintenance { foreach( $benchs as $bench ) { // handle empty args - if(!array_key_exists( 'args', $bench )) { + if( !array_key_exists( 'args', $bench ) ) { $bench['args'] = array(); } $bench_number++; $start = microtime( true ); - for( $i=0; $i<$count; $i++ ) { + for( $i = 0; $i < $count; $i++ ) { call_user_func_array( $bench['function'], $bench['args'] ); } $delta = microtime( true ) - $start; // function passed as a callback if( is_array( $bench['function'] ) ) { - $ret = get_class( $bench['function'][0] ). '->' . $bench['function'][1]; + $ret = get_class( $bench['function'][0] ) . '->' . $bench['function'][1]; $bench['function'] = $ret; } @@ -85,7 +85,7 @@ abstract class Benchmarker extends Maintenance { join( ', ', $res['arguments'] ) ); $ret .= sprintf( " %6.2fms (%6.2fms each)\n", - $res['delta'] * 1000, + $res['delta'] * 1000, $res['average'] * 1000 ); } diff --git a/maintenance/dumpIterator.php b/maintenance/dumpIterator.php index 870d632126..9e61bd4fcb 100644 --- a/maintenance/dumpIterator.php +++ b/maintenance/dumpIterator.php @@ -47,7 +47,7 @@ abstract class DumpIterator extends Maintenance { } public function execute() { - if (! ( $this->hasOption('file') ^ $this->hasOption('dump') ) ) { + if ( !( $this->hasOption('file') ^ $this->hasOption('dump') ) ) { $this->error("You must provide a file or dump", true); } @@ -96,7 +96,7 @@ abstract class DumpIterator extends Maintenance { if ( $this->getDbType() == Maintenance::DB_NONE ) { global $wgUseDatabaseMessages, $wgLocalisationCacheConf, $wgHooks; $wgUseDatabaseMessages = false; - $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null'; + $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null'; $wgHooks['InterwikiLoadPrefix'][] = 'DumpIterator::disableInterwikis'; } } diff --git a/maintenance/formatInstallDoc.php b/maintenance/formatInstallDoc.php index 691ed80c88..39731b1d42 100644 --- a/maintenance/formatInstallDoc.php +++ b/maintenance/formatInstallDoc.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( __DIR__ .'/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that formats RELEASE-NOTE file to wiki text or HTML markup. diff --git a/maintenance/importDump.php b/maintenance/importDump.php index 904b6247de..9553a1faea 100644 --- a/maintenance/importDump.php +++ b/maintenance/importDump.php @@ -266,7 +266,7 @@ TEXT; $importer->setNoUpdates( true ); } $importer->setPageCallback( array( &$this, 'reportPage' ) ); - $this->importCallback = $importer->setRevisionCallback( + $this->importCallback = $importer->setRevisionCallback( array( &$this, 'handleRevision' ) ); $this->uploadCallback = $importer->setUploadCallback( array( &$this, 'handleUpload' ) ); diff --git a/maintenance/importImages.php b/maintenance/importImages.php index 782f502dec..9d9a77d908 100644 --- a/maintenance/importImages.php +++ b/maintenance/importImages.php @@ -107,12 +107,12 @@ $timestamp = isset( $options['timestamp'] ) ? $options['timestamp'] : false; $comment = 'Importing image file'; if ( isset( $options['comment-file'] ) ) { - $comment = file_get_contents( $options['comment-file'] ); + $comment = file_get_contents( $options['comment-file'] ); if ( $comment === false || $comment === null ) { die( "failed to read comment file: {$options['comment-file']}\n" ); } } elseif ( isset( $options['comment'] ) ) { - $comment = $options['comment']; + $comment = $options['comment']; } $commentExt = isset( $options['comment-ext'] ) ? $options['comment-ext'] : false; diff --git a/maintenance/install.php b/maintenance/install.php index 935a2966c9..242358beba 100644 --- a/maintenance/install.php +++ b/maintenance/install.php @@ -29,7 +29,7 @@ if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), ' define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' ); define( 'MEDIAWIKI_INSTALL', true ); -require_once( dirname( __DIR__ )."/maintenance/Maintenance.php" ); +require_once( dirname( __DIR__ ) . "/maintenance/Maintenance.php" ); /** * Maintenance script to install and configure MediaWiki diff --git a/maintenance/language/checkLanguage.inc b/maintenance/language/checkLanguage.inc index 1860f4a5a2..3fa8ede456 100644 --- a/maintenance/language/checkLanguage.inc +++ b/maintenance/language/checkLanguage.inc @@ -25,7 +25,7 @@ * @ingroup MaintenanceLanguage */ class CheckLanguageCLI { - protected $code = null; + protected $code = null; protected $level = 2; protected $doLinks = false; protected $linksPrefix = ''; diff --git a/maintenance/language/generateCollationData.php b/maintenance/language/generateCollationData.php index 12823c0cc3..786ba5b68b 100644 --- a/maintenance/language/generateCollationData.php +++ b/maintenance/language/generateCollationData.php @@ -21,7 +21,7 @@ * @ingroup MaintenanceLanguage */ -require_once( __DIR__ .'/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); /** * Generate first letter data files for Collation.php @@ -102,7 +102,7 @@ class GenerateCollationData extends Maintenance { $error .= "You are using outdated version of ICU ($icuVersion), intended for " . ( $unicodeVersion ? "Unicode $unicodeVersion" : "an unknown version of Unicode" ) . "; this file might not be avalaible for it, and it's not supported by MediaWiki. " - ." You are on your own; consider upgrading PHP's intl extension or try " + . " You are on your own; consider upgrading PHP's intl extension or try " . "one of the files available at:"; } elseif ( version_compare( $icuVersion, "51.0", ">=" ) ) { // Extra recent version @@ -386,7 +386,7 @@ class UcdXmlReader { $this->xml = new XMLReader; $this->xml->open( $this->fileName ); if ( !$this->xml ) { - throw new MWException( __METHOD__.": unable to open {$this->fileName}" ); + throw new MWException( __METHOD__ . ": unable to open {$this->fileName}" ); } while ( $this->xml->name !== 'ucd' && $this->xml->read() ); $this->xml->read(); diff --git a/maintenance/language/writeMessagesArray.inc b/maintenance/language/writeMessagesArray.inc index b2e04c7f83..17e1b2e631 100644 --- a/maintenance/language/writeMessagesArray.inc +++ b/maintenance/language/writeMessagesArray.inc @@ -243,10 +243,10 @@ $blockComment if( strpos( $value, $single ) === false ) { # Nothing ugly, just use ' - $blockText .= $single.$value.$single; + $blockText .= $single . $value . $single; } elseif( strpos( $value, $double ) === false && !preg_match('/\$[a-zA-Z_\x7f-\xff]/', $value) ) { # No "-quotes, no variables that need quoting, use " - $blockText .= $double.$value.$double; + $blockText .= $double . $value . $double; } else { # Something needs quoting, pick the quote which causes less quoting $quote = substr_count( $value, $double ) + substr_count( $value, '$' ) >= substr_count( $value, $single ) ? $single : $double; diff --git a/maintenance/parse.php b/maintenance/parse.php index 58e76b0a43..8ca9fbb55e 100644 --- a/maintenance/parse.php +++ b/maintenance/parse.php @@ -90,7 +90,7 @@ class CLIParser extends Maintenance { if( $input_file === $php_stdin ) { $ctrl = wfIsWindows() ? 'CTRL+Z' : 'CTRL+D'; - $this->error( basename(__FILE__) .": warning: reading wikitext from STDIN. Press $ctrl to parse.\n" ); + $this->error( basename(__FILE__) . ": warning: reading wikitext from STDIN. Press $ctrl to parse.\n" ); } return file_get_contents( $input_file ); diff --git a/maintenance/purgeList.php b/maintenance/purgeList.php index fb66db0036..0945c9d419 100644 --- a/maintenance/purgeList.php +++ b/maintenance/purgeList.php @@ -74,7 +74,7 @@ class PurgeList extends Maintenance { } } } - $this->output( "Purging " . count( $urls ). " urls\n" ); + $this->output( "Purging " . count( $urls ) . " urls\n" ); $this->sendPurgeRequest( $urls ); } diff --git a/maintenance/rebuildrecentchanges.php b/maintenance/rebuildrecentchanges.php index bfaaab5498..ea2051e761 100644 --- a/maintenance/rebuildrecentchanges.php +++ b/maintenance/rebuildrecentchanges.php @@ -61,9 +61,9 @@ class RebuildRecentchanges extends Maintenance { $this->output( '$wgRCMaxAge=' . $wgRCMaxAge ); $days = $wgRCMaxAge / 24 / 3600; if ( intval( $days ) == $days ) { - $this->output( " (" . $days . " days)\n" ); + $this->output( " (" . $days . " days)\n" ); } else { - $this->output( " (approx. " . intval( $days ) . " days)\n" ); + $this->output( " (approx. " . intval( $days ) . " days)\n" ); } $cutoff = time() - $wgRCMaxAge; diff --git a/maintenance/storage/compressOld.php b/maintenance/storage/compressOld.php index d636283495..8d372e1995 100644 --- a/maintenance/storage/compressOld.php +++ b/maintenance/storage/compressOld.php @@ -357,10 +357,10 @@ class CompressOld extends Maintenance { } # Store External Storage URLs instead of Stub placeholders foreach ($stubs as $stub) { - if ($stub===false) + if ( $stub === false ) continue; # $stored should provide base path to a BLOB - $url = $stored."/".$stub->getHash(); + $url = $stored . "/" . $stub->getHash(); $dbw->update( 'text', array( /* SET */ 'old_text' => $url, diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index 21b07f7d32..ae97a8a911 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -127,7 +127,7 @@ class CologneBlueTemplate extends BaseTemplate { * * @return string */ - function processBottomLink( $key, $navlink, $message=null ) { + function processBottomLink( $key, $navlink, $message = null ) { if ( !$navlink ) { // Empty navlinks might be passed. return null; @@ -246,7 +246,7 @@ class CologneBlueTemplate extends BaseTemplate { * @param $navlink array Navigational link generated by SkinTemplate * @param $idPrefix mixed Prefix to add to id of this navlink. If false, id is removed entirely. Default is 'cb-'. */ - function processNavlinkForDocument( $navlink, $idPrefix='cb-' ) { + function processNavlinkForDocument( $navlink, $idPrefix = 'cb-' ) { if ( $navlink['id'] ) { $navlink['single-id'] = $navlink['id']; // to allow for tooltip generation $navlink['tooltiponly'] = true; // but no accesskeys @@ -255,7 +255,7 @@ class CologneBlueTemplate extends BaseTemplate { if ( $idPrefix === false ) { unset( $navlink['id'] ); } else { - $navlink['id'] = $idPrefix . $navlink['id']; + $navlink['id'] = $idPrefix . $navlink['id']; } } diff --git a/tests/phpunit/includes/BlockTest.php b/tests/phpunit/includes/BlockTest.php index 0f37182157..b86204019a 100644 --- a/tests/phpunit/includes/BlockTest.php +++ b/tests/phpunit/includes/BlockTest.php @@ -233,35 +233,35 @@ class BlockTest extends MediaWikiLangTestCase { $blockList = array( array( 'target' => '70.2.0.0/16', - 'type' => Block::TYPE_RANGE, + 'type' => Block::TYPE_RANGE, 'desc' => 'Range Hardblock', 'ACDisable' => false, 'isHardblock' => true, 'isAutoBlocking' => false, ), array( 'target' => '2001:4860:4001::/48', - 'type' => Block::TYPE_RANGE, + 'type' => Block::TYPE_RANGE, 'desc' => 'Range6 Hardblock', 'ACDisable' => false, 'isHardblock' => true, 'isAutoBlocking' => false, ), array( 'target' => '60.2.0.0/16', - 'type' => Block::TYPE_RANGE, + 'type' => Block::TYPE_RANGE, 'desc' => 'Range Softblock with AC Disabled', 'ACDisable' => true, 'isHardblock' => false, 'isAutoBlocking' => false, ), array( 'target' => '50.2.0.0/16', - 'type' => Block::TYPE_RANGE, + 'type' => Block::TYPE_RANGE, 'desc' => 'Range Softblock', 'ACDisable' => false, 'isHardblock' => false, 'isAutoBlocking' => false, ), array( 'target' => '50.1.1.1', - 'type' => Block::TYPE_IP, + 'type' => Block::TYPE_IP, 'desc' => 'Exact Softblock', 'ACDisable' => false, 'isHardblock' => false, -- 2.20.1