From f97a3a4027717ee2ef33976c72af951a18cadb8f Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sun, 3 Feb 2013 19:47:42 +0100 Subject: [PATCH] fix some spacing Change-Id: I670a7baf3ba1e70d18346bb00938d518ba2063bd --- includes/actions/HistoryAction.php | 12 ++--- includes/api/ApiBase.php | 4 +- includes/api/ApiFileRevert.php | 4 +- includes/api/ApiFormatXml.php | 4 +- includes/api/ApiImport.php | 2 +- includes/api/ApiPageSet.php | 2 +- includes/api/ApiQueryBase.php | 2 +- includes/api/ApiQueryBlocks.php | 8 ++-- includes/api/ApiQueryCategoryMembers.php | 2 +- includes/api/ApiQueryImageInfo.php | 4 +- includes/api/ApiQueryPageProps.php | 2 +- includes/api/ApiQueryQueryPage.php | 2 +- includes/api/ApiQueryRecentChanges.php | 4 +- includes/api/ApiQueryRevisions.php | 2 +- includes/api/ApiQuerySiteinfo.php | 2 +- includes/api/ApiQueryUserContributions.php | 2 +- includes/api/ApiQueryUsers.php | 2 +- includes/api/ApiUpload.php | 8 ++-- includes/db/CloneDatabase.php | 4 +- includes/db/Database.php | 30 ++++++------ includes/db/DatabaseError.php | 8 ++-- includes/db/DatabaseIbm_db2.php | 12 ++--- includes/db/DatabaseMssql.php | 36 +++++++-------- includes/db/DatabaseMysql.php | 12 ++--- includes/db/DatabaseOracle.php | 52 ++++++++++----------- includes/db/DatabasePostgres.php | 54 +++++++++++----------- includes/db/DatabaseSqlite.php | 4 +- includes/db/DatabaseUtility.php | 2 +- includes/db/LBFactory.php | 10 ++-- includes/db/LBFactory_Multi.php | 4 +- includes/db/LoadBalancer.php | 52 ++++++++++----------- includes/db/LoadMonitor.php | 6 +-- includes/diff/DairikiDiff.php | 7 ++- includes/diff/DifferenceEngine.php | 2 +- includes/externalstore/ExternalStore.php | 2 +- includes/externalstore/ExternalStoreDB.php | 8 ++-- includes/job/JobQueueDB.php | 2 +- includes/normal/UtfNormalDefines.php | 2 +- includes/upload/UploadBase.php | 22 ++++----- includes/upload/UploadStash.php | 4 +- 40 files changed, 201 insertions(+), 202 deletions(-) diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index a1d1c3a197..d26228a35b 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -23,7 +23,7 @@ */ /** - * This class handles printing the history page for an article. In order to + * This class handles printing the history page for an article. In order to * be efficient, it uses timestamps rather than offsets for paging, to avoid * costly LIMIT,offset queries. * @@ -132,7 +132,7 @@ class HistoryAction extends FormlessAction { array( 'delete', 'move' ), $this->getTitle(), '', - array( 'lim' => 10, + array( 'lim' => 10, 'conds' => array( "log_action != 'revision'" ), 'showIfEmpty' => false, 'msgKey' => array( 'moveddeleted-notice' ) @@ -515,7 +515,7 @@ class HistoryPager extends ReverseChronologicalPager { function submitButton( $message, $attributes = array() ) { # Disable submit button if history has 1 revision only if ( $this->getNumRows() > 1 ) { - return Xml::submitButton( $message , $attributes ); + return Xml::submitButton( $message, $attributes ); } else { return ''; } @@ -609,7 +609,7 @@ class HistoryPager extends ReverseChronologicalPager { ? $this->parentLens[$row->rev_parent_id] : 0; $sDiff = ChangesList::showCharacterDifference( $prevSize, $rev->getSize() ); - $fSize = Linker::formatRevisionSize($rev->getSize()); + $fSize = Linker::formatRevisionSize( $rev->getSize() ); $s .= ' . . ' . "$fSize $sDiff"; } @@ -617,7 +617,7 @@ class HistoryPager extends ReverseChronologicalPager { $s2 = Linker::revComment( $rev, false, true ); if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) { - $s2 .= ' ' . $this->msg( 'updatedmarker' )->escaped() . ''; + $s2 .= ' ' . $this->msg( 'updatedmarker' )->escaped() . ''; $classes[] = 'mw-history-line-updated'; } @@ -671,7 +671,7 @@ class HistoryPager extends ReverseChronologicalPager { $s .= ' . . ' . $s2; } - wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row , &$s, &$classes ) ); + wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row, &$s, &$classes ) ); $attribs = array(); if ( $classes ) { diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 5621b7cf77..68302b1fa3 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1303,8 +1303,8 @@ abstract class ApiBase extends ContextSource { // uploadMsgs 'invalid-file-key' => array( 'code' => 'invalid-file-key', 'info' => 'Not a valid file key' ), 'nouploadmodule' => array( 'code' => 'nouploadmodule', 'info' => 'No upload module set' ), - 'uploaddisabled' => array( 'code' => 'uploaddisabled', 'info' => 'Uploads are not enabled. Make sure $wgEnableUploads is set to true in LocalSettings.php and the PHP ini setting file_uploads is true' ), - 'copyuploaddisabled' => array( 'code' => 'copyuploaddisabled', 'info' => 'Uploads by URL is not enabled. Make sure $wgAllowCopyUploads is set to true in LocalSettings.php.' ), + 'uploaddisabled' => array( 'code' => 'uploaddisabled', 'info' => 'Uploads are not enabled. Make sure $wgEnableUploads is set to true in LocalSettings.php and the PHP ini setting file_uploads is true' ), + 'copyuploaddisabled' => array( 'code' => 'copyuploaddisabled', 'info' => 'Uploads by URL is not enabled. Make sure $wgAllowCopyUploads is set to true in LocalSettings.php.' ), 'copyuploadbaddomain' => array( 'code' => 'copyuploadbaddomain', 'info' => 'Uploads by URL are not allowed from this domain.' ), 'filename-tooshort' => array( 'code' => 'filename-tooshort', 'info' => 'The filename is too short' ), diff --git a/includes/api/ApiFileRevert.php b/includes/api/ApiFileRevert.php index 91ab499d9d..9520dc7b16 100644 --- a/includes/api/ApiFileRevert.php +++ b/includes/api/ApiFileRevert.php @@ -69,8 +69,8 @@ class ApiFileRevert extends ApiBase { protected function checkPermissions( $user ) { $title = $this->file->getTitle(); $permissionErrors = array_merge( - $title->getUserPermissionsErrors( 'edit' , $user ), - $title->getUserPermissionsErrors( 'upload' , $user ) + $title->getUserPermissionsErrors( 'edit', $user ), + $title->getUserPermissionsErrors( 'upload', $user ) ); if ( $permissionErrors ) { diff --git a/includes/api/ApiFormatXml.php b/includes/api/ApiFormatXml.php index 6ad7ccd2dd..b4e8e330e6 100644 --- a/includes/api/ApiFormatXml.php +++ b/includes/api/ApiFormatXml.php @@ -88,7 +88,7 @@ class ApiFormatXml extends ApiFormatBase { * * @par Example: * @verbatim - * name='root', value = array( '_element'=>'page', 'x', 'y', 'z') + * name='root', value = array( '_element'=>'page', 'x', 'y', 'z') * @endverbatim * creates: * @verbatim @@ -101,7 +101,7 @@ class ApiFormatXml extends ApiFormatBase { * * @par Example: * @verbatim - * name='root', value = array( '*'=>'text', 'lang'=>'en', 'id'=>10) + * name='root', value = array( '*'=>'text', 'lang'=>'en', 'id'=>10) * @endverbatim * creates: * @verbatim diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php index 9657e12d1c..408805ee63 100644 --- a/includes/api/ApiImport.php +++ b/includes/api/ApiImport.php @@ -146,7 +146,7 @@ class ApiImport extends ApiBase { public function getDescription() { return array( - 'Import a page from another wiki, or an XML file.' , + 'Import a page from another wiki, or an XML file.', 'Note that the HTTP POST must be done as a file upload (i.e. using multipart/form-data) when', 'sending a file for the "xml" parameter.' ); diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index e2f4daebad..4dbccc6c9d 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -562,7 +562,7 @@ class ApiPageSet extends ApiQueryBase { // Get pageIDs data from the `page` table $this->profileDBIn(); - $res = $db->select( $tables, $fields, $where, __METHOD__ ); + $res = $db->select( $tables, $fields, $where, __METHOD__ ); foreach ( $res as $row ) { $revid = intval( $row->rev_id ); $pageid = intval( $row->rev_page ); diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 2a8645f62d..addcf074ca 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -351,7 +351,7 @@ abstract class ApiQueryBase extends ApiBase { } $result = $this->getResult(); $fit = $result->addValue( array( 'query', 'pages', $pageId, - $this->getModuleName() ), null, $item ); + $this->getModuleName() ), null, $item ); if ( !$fit ) { return false; } diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php index 0d2fa0d3c7..d9be9f28b0 100644 --- a/includes/api/ApiQueryBlocks.php +++ b/includes/api/ApiQueryBlocks.php @@ -132,10 +132,10 @@ class ApiQueryBlocks extends ApiQueryBase { $this->addWhereIf( 'ipb_user != 0', isset( $show['account'] ) ); $this->addWhereIf( 'ipb_user != 0 OR ipb_range_end > ipb_range_start', isset( $show['!ip'] ) ); $this->addWhereIf( 'ipb_user = 0 AND ipb_range_end = ipb_range_start', isset( $show['ip'] ) ); - $this->addWhereIf( 'ipb_expiry = '.$db->addQuotes($db->getInfinity()), isset( $show['!temp'] ) ); - $this->addWhereIf( 'ipb_expiry != '.$db->addQuotes($db->getInfinity()), isset( $show['temp'] ) ); - $this->addWhereIf( "ipb_range_end = ipb_range_start", isset( $show['!range'] ) ); - $this->addWhereIf( "ipb_range_end > ipb_range_start", isset( $show['range'] ) ); + $this->addWhereIf( 'ipb_expiry = ' . $db->addQuotes( $db->getInfinity() ), isset( $show['!temp'] ) ); + $this->addWhereIf( 'ipb_expiry != ' . $db->addQuotes( $db->getInfinity() ), isset( $show['temp'] ) ); + $this->addWhereIf( 'ipb_range_end = ipb_range_start', isset( $show['!range'] ) ); + $this->addWhereIf( 'ipb_range_end > ipb_range_start', isset( $show['range'] ) ); } if ( !$this->getUser()->isAllowed( 'hideuser' ) ) { diff --git a/includes/api/ApiQueryCategoryMembers.php b/includes/api/ApiQueryCategoryMembers.php index 6a392bd36c..fd9d4c5785 100644 --- a/includes/api/ApiQueryCategoryMembers.php +++ b/includes/api/ApiQueryCategoryMembers.php @@ -243,7 +243,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { if ( is_null( $resultPageSet ) ) { $result->setIndexedTagName_internal( - array( 'query', $this->getModuleName() ), 'cm' ); + array( 'query', $this->getModuleName() ), 'cm' ); } } diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index b368af8a0e..4b9bc98839 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -435,7 +435,7 @@ class ApiQueryImageInfo extends ApiQueryBase { */ protected function getContinueStr( $img ) { return $img->getOriginalTitle()->getText() . - '|' . $img->getTimestamp(); + '|' . $img->getTimestamp(); } public function getAllowedParams() { @@ -539,7 +539,7 @@ class ApiQueryImageInfo extends ApiQueryBase { return array( 'prop' => self::getPropertyDescriptions( array(), $p ), 'urlwidth' => array( "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.", - 'Only the current version of the image can be scaled' ), + 'Only the current version of the image can be scaled' ), 'urlheight' => "Similar to {$p}urlwidth. Cannot be used without {$p}urlwidth", 'urlparam' => array( "A handler specific parameter string. For example, pdf's ", "might use 'page15-100px'. {$p}urlwidth must be used and be consistent with {$p}urlparam" ), diff --git a/includes/api/ApiQueryPageProps.php b/includes/api/ApiQueryPageProps.php index 189e15a043..9dd2c6a800 100644 --- a/includes/api/ApiQueryPageProps.php +++ b/includes/api/ApiQueryPageProps.php @@ -49,7 +49,7 @@ class ApiQueryPageProps extends ApiQueryBase { $this->addTables( 'page_props' ); $this->addFields( array( 'pp_page', 'pp_propname', 'pp_value' ) ); - $this->addWhereFld( 'pp_page', array_keys( $pages ) ); + $this->addWhereFld( 'pp_page', array_keys( $pages ) ); if ( $this->params['continue'] ) { $this->addWhere( 'pp_page >=' . intval( $this->params['continue'] ) ); diff --git a/includes/api/ApiQueryQueryPage.php b/includes/api/ApiQueryQueryPage.php index 182bc2c6a0..1c9deb711c 100644 --- a/includes/api/ApiQueryQueryPage.php +++ b/includes/api/ApiQueryQueryPage.php @@ -211,7 +211,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase { public function getPossibleErrors() { return array_merge( parent::getPossibleErrors(), array( - array( 'specialpage-cantexecute' ) + array( 'specialpage-cantexecute' ) ) ); } diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index f7a22bdc02..6acca673fe 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -234,7 +234,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { $this->addFieldsIf( 'rc_comment', $this->fld_comment || $this->fld_parsedcomment ); $this->addFieldsIf( 'rc_user', $this->fld_user ); $this->addFieldsIf( 'rc_user_text', $this->fld_user || $this->fld_userid ); - $this->addFieldsIf( array( 'rc_minor', 'rc_type', 'rc_bot' ) , $this->fld_flags ); + $this->addFieldsIf( array( 'rc_minor', 'rc_type', 'rc_bot' ), $this->fld_flags ); $this->addFieldsIf( array( 'rc_old_len', 'rc_new_len' ), $this->fld_sizes ); $this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled ); $this->addFieldsIf( array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ), $this->fld_loginfo ); @@ -260,7 +260,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { if ( !is_null( $params['tag'] ) ) { $this->addTables( 'change_tag' ); $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rc_id=ct_rc_id' ) ) ) ); - $this->addWhereFld( 'ct_tag' , $params['tag'] ); + $this->addWhereFld( 'ct_tag', $params['tag'] ); global $wgOldChangeTagsIndex; $index['change_tag'] = $wgOldChangeTagsIndex ? 'ct_tag' : 'change_tag_tag_id'; } diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 27ea6befea..9b54ee5194 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -189,7 +189,7 @@ class ApiQueryRevisions extends ApiQueryBase { if ( !is_null( $params['tag'] ) ) { $this->addTables( 'change_tag' ); $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) ); - $this->addWhereFld( 'ct_tag' , $params['tag'] ); + $this->addWhereFld( 'ct_tag', $params['tag'] ); global $wgOldChangeTagsIndex; $index['change_tag'] = $wgOldChangeTagsIndex ? 'ct_tag' : 'change_tag_tag_id'; } diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 2fef68aaeb..04897e8e55 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -462,7 +462,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { } if ( isset( $ext['author'] ) ) { $ret['author'] = is_array( $ext['author'] ) ? - implode( ', ', $ext['author' ] ) : $ext['author']; + implode( ', ', $ext['author'] ) : $ext['author']; } if ( isset( $ext['url'] ) ) { $ret['url'] = $ext['url']; diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 4d1edf185b..2410f057c9 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -220,7 +220,7 @@ class ApiQueryContributions extends ApiQueryBase { ) ); if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) || - $this->fld_patrolled ) { + $this->fld_patrolled ) { if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) { $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' ); } diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index 03a0b79923..50ea5870f3 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -161,7 +161,7 @@ class ApiQueryUsers extends ApiQueryBase { } if ( isset( $this->prop['implicitgroups'] ) ) { - $data[$name]['implicitgroups'] = $user->getAutomaticGroups(); + $data[$name]['implicitgroups'] = $user->getAutomaticGroups(); } if ( isset( $this->prop['rights'] ) ) { diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 03c10d0f51..2627396060 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -194,7 +194,7 @@ class ApiUpload extends ApiBase { $request = $this->getMain()->getRequest(); $chunkPath = $request->getFileTempname( 'chunk' ); $chunkSize = $request->getUpload( 'chunk' )->getSize(); - if ($this->mParams['offset'] == 0) { + if ( $this->mParams['offset'] == 0 ) { $result['filekey'] = $this->performStash(); } else { $status = $this->mUpload->addChunk( @@ -246,7 +246,7 @@ class ApiUpload extends ApiBase { } // We have a new filekey for the fully concatenated file. - $result['filekey'] = $this->mUpload->getLocalFile()->getFileKey(); + $result['filekey'] = $this->mUpload->getLocalFile()->getFileKey(); // Remove chunk from stash. (Checks against user ownership of chunks.) $this->mUpload->stash->removeFile( $this->mParams['filekey'] ); @@ -519,7 +519,7 @@ class ApiUpload extends ApiBase { break; default: $this->dieUsage( 'An unknown error occurred', 'unknown-error', - 0, array( 'code' => $verification['status'] ) ); + 0, array( 'code' => $verification['status'] ) ); break; } } @@ -791,7 +791,7 @@ class ApiUpload extends ApiBase { ' * Have the MediaWiki server fetch a file from a URL, using the "url" parameter', ' * Complete an earlier upload that failed due to warnings, using the "filekey" parameter', 'Note that the HTTP POST must be done as a file upload (i.e. using multipart/form-data) when', - 'sending the "file". Also you must get and send an edit token before doing any upload stuff' + 'sending the "file". Also you must get and send an edit token before doing any upload stuff' ); } diff --git a/includes/db/CloneDatabase.php b/includes/db/CloneDatabase.php index 4ff7913bd2..56717b63c9 100644 --- a/includes/db/CloneDatabase.php +++ b/includes/db/CloneDatabase.php @@ -100,12 +100,12 @@ class CloneDatabase { if( $this->dropCurrentTables && !in_array( $this->db->getType(), array( 'postgres', 'oracle' ) ) ) { $this->db->dropTable( $tbl, __METHOD__ ); - wfDebug( __METHOD__." dropping {$newTableName}\n", true); + wfDebug( __METHOD__ . " dropping {$newTableName}\n", true ); //Dropping the oldTable because the prefix was changed } # Create new table - wfDebug( __METHOD__." duplicating $oldTableName to $newTableName\n", true ); + wfDebug( __METHOD__ . " duplicating $oldTableName to $newTableName\n", true ); $this->db->duplicateTableStructure( $oldTableName, $newTableName, $this->useTemporaryTables ); } } diff --git a/includes/db/Database.php b/includes/db/Database.php index 97e2fe2f4d..7e865c1c2c 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -112,8 +112,8 @@ interface DatabaseType { * The value inserted should be fetched from nextSequenceValue() * * Example: - * $id = $dbw->nextSequenceValue('page_page_id_seq'); - * $dbw->insert('page',array('page_id' => $id)); + * $id = $dbw->nextSequenceValue( 'page_page_id_seq' ); + * $dbw->insert( 'page', array( 'page_id' => $id ) ); * $id = $dbw->insertId(); * * @return int @@ -393,7 +393,7 @@ abstract class DatabaseBase implements DatabaseType { return wfSetVar( $this->mTablePrefix, $prefix ); } - /** + /** * Set the filehandle to copy write statements to. * * @param $fh filehandle @@ -584,7 +584,7 @@ abstract class DatabaseBase implements DatabaseType { global $wgDebugDBTransactions; $this->mFlags |= $flag; if ( ( $flag & DBO_TRX) & $wgDebugDBTransactions ) { - wfDebug("Implicit transactions are now disabled.\n"); + wfDebug( "Implicit transactions are now disabled.\n" ); } } @@ -597,7 +597,7 @@ abstract class DatabaseBase implements DatabaseType { global $wgDebugDBTransactions; $this->mFlags &= ~$flag; if ( ( $flag & DBO_TRX ) && $wgDebugDBTransactions ) { - wfDebug("Implicit transactions are now disabled.\n"); + wfDebug( "Implicit transactions are now disabled.\n" ); } } @@ -671,12 +671,12 @@ abstract class DatabaseBase implements DatabaseType { if ( $wgCommandLineMode ) { $this->mFlags &= ~DBO_TRX; if ( $wgDebugDBTransactions ) { - wfDebug("Implicit transaction open disabled.\n"); + wfDebug( "Implicit transaction open disabled.\n" ); } } else { $this->mFlags |= DBO_TRX; if ( $wgDebugDBTransactions ) { - wfDebug("Implicit transaction open enabled.\n"); + wfDebug( "Implicit transaction open enabled.\n" ); } } } @@ -772,7 +772,7 @@ abstract class DatabaseBase implements DatabaseType { * @param $errno * @param $errstr */ - protected function connectionErrorHandler( $errno, $errstr ) { + protected function connectionErrorHandler( $errno, $errstr ) { $this->mPHPError = $errstr; } @@ -921,7 +921,7 @@ abstract class DatabaseBase implements DatabaseType { if ( strpos( $sqlstart, "SHOW " ) !== 0 && strpos( $sqlstart, "SET " ) !== 0 ) { global $wgDebugDBTransactions; if ( $wgDebugDBTransactions ) { - wfDebug("Implicit transaction start.\n"); + wfDebug( "Implicit transaction start.\n" ); } $this->begin( __METHOD__ . " ($fname)" ); $this->mTrxAutomatic = true; @@ -1096,7 +1096,7 @@ abstract class DatabaseBase implements DatabaseType { case '\\&': return '&'; } - list( /* $n */ , $arg ) = each( $this->preparedArgs ); + list( /* $n */, $arg ) = each( $this->preparedArgs ); switch( $matches[1] ) { case '?': return $this->addQuotes( $arg ); @@ -1419,7 +1419,7 @@ abstract class DatabaseBase implements DatabaseType { * join, the second is an SQL fragment giving the join condition for that * table. For example: * - * array( 'page' => array('LEFT JOIN','page_latest=rev_id') ) + * array( 'page' => array( 'LEFT JOIN', 'page_latest=rev_id' ) ) * * @return ResultWrapper. If the query returned no rows, a ResultWrapper * with no rows in it will be returned. If there was a query error, a @@ -2097,7 +2097,7 @@ abstract class DatabaseBase implements DatabaseType { * This is handy when you need to construct SQL for joins * * Example: - * extract($dbr->tableNames('user','watchlist')); + * extract( $dbr->tableNames( 'user', 'watchlist' ) ); * $sql = "SELECT wl_namespace,wl_title FROM $watchlist,$user * WHERE wl_user=user_id AND wl_user=$nameWithQuotes"; * @@ -2119,7 +2119,7 @@ abstract class DatabaseBase implements DatabaseType { * This is handy when you need to construct SQL for joins * * Example: - * list( $user, $watchlist ) = $dbr->tableNamesN('user','watchlist'); + * list( $user, $watchlist ) = $dbr->tableNamesN( 'user', 'watchlist' ); * $sql = "SELECT wl_namespace,wl_title FROM $watchlist,$user * WHERE wl_user=user_id AND wl_user=$nameWithQuotes"; * @@ -2671,7 +2671,7 @@ abstract class DatabaseBase implements DatabaseType { list( $startOpts, $useIndex, $tailOpts ) = $this->makeSelectOptions( $selectOptions ); if ( is_array( $srcTable ) ) { - $srcTable = implode( ',', array_map( array( &$this, 'tableName' ), $srcTable ) ); + $srcTable = implode( ',', array_map( array( &$this, 'tableName' ), $srcTable ) ); } else { $srcTable = $this->tableName( $srcTable ); } @@ -3466,7 +3466,7 @@ abstract class DatabaseBase implements DatabaseType { // replace `{$var}` $ins = str_replace( '`{$' . $var . '}`', $this->addIdentifierQuotes( $value ), $ins ); // replace /*$var*/ - $ins = str_replace( '/*$' . $var . '*/', $this->strencode( $value ) , $ins ); + $ins = str_replace( '/*$' . $var . '*/', $this->strencode( $value ), $ins ); } return $ins; } diff --git a/includes/db/DatabaseError.php b/includes/db/DatabaseError.php index b6d0d00f98..18b2733e8c 100644 --- a/includes/db/DatabaseError.php +++ b/includes/db/DatabaseError.php @@ -289,10 +289,10 @@ class DBQueryError extends DBError { * @param $fname string */ function __construct( DatabaseBase &$db, $error, $errno, $sql, $fname ) { - $message = "A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script\n" . - "Query: $sql\n" . - "Function: $fname\n" . - "Error: $errno $error\n"; + $message = "A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script\n" . + "Query: $sql\n" . + "Function: $fname\n" . + "Error: $errno $error\n"; parent::__construct( $db, $message ); $this->error = $error; diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index 03c1f9b198..57fc7b9bbd 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -787,8 +787,8 @@ class DatabaseIbm_db2 extends DatabaseBase { // Wide characters are evil -- some of them look like ' $s = utf8_encode( $s ); // Fix its stupidity - $from = array( "\\\\", "\\'", '\\n', '\\t', '\\"', '\\r' ); - $to = array( "\\", "''", "\n", "\t", '"', "\r" ); + $from = array( "\\\\", "\\'", '\\n', '\\t', '\\"', '\\r' ); + $to = array( "\\", "''", "\n", "\t", '"', "\r" ); $s = str_replace( $from, $to, $s ); // DB2 expects '', not \' escaping return $s; } @@ -1115,10 +1115,10 @@ class DatabaseIbm_db2 extends DatabaseBase { // find out the primary keys $keyres = $this->doQuery( "SELECT NAME FROM SYSIBM.SYSCOLUMNS WHERE TBNAME = '" - . strtoupper( $table ) - . "' AND TBCREATOR = '" - . strtoupper( $schema ) - . "' AND KEYSEQ > 0" ); + . strtoupper( $table ) + . "' AND TBCREATOR = '" + . strtoupper( $schema ) + . "' AND KEYSEQ > 0" ); $keys = array(); for ( diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index 8796a48374..57ffd4f0bf 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -156,7 +156,7 @@ class DatabaseMssql extends DatabaseBase { // perform query $stmt = sqlsrv_query( $this->mConn, $sql ); if ( $stmt == false ) { - $message = "A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: http://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script\n" . + $message = "A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: http://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script\n" . "Query: " . htmlentities( $sql ) . "\n" . "Function: " . __METHOD__ . "\n"; // process each error (our driver will give us an array of errors unlike other providers) @@ -319,7 +319,7 @@ class DatabaseMssql extends DatabaseBase { if ( isset( $options['EXPLAIN'] ) ) { unset( $options['EXPLAIN'] ); } - return parent::selectSQLText( $table, $vars, $conds, $fname, $options, $join_conds ); + return parent::selectSQLText( $table, $vars, $conds, $fname, $options, $join_conds ); } /** @@ -484,7 +484,7 @@ class DatabaseMssql extends DatabaseBase { } elseif ( is_array( $value ) || is_object( $value ) ) { if ( is_object( $value ) && strtolower( get_class( $value ) ) == 'blob' ) { $sql .= $this->addQuotes( $value ); - } else { + } else { $sql .= $this->addQuotes( serialize( $value ) ); } } else { @@ -608,9 +608,9 @@ class DatabaseMssql extends DatabaseBase { } else { $sql = ' SELECT * FROM ( - SELECT sub2.*, ROW_NUMBER() OVER(ORDER BY sub2.line2) AS line3 FROM ( - SELECT 1 AS line2, sub1.* FROM (' . $sql . ') AS sub1 - ) as sub2 + SELECT sub2.*, ROW_NUMBER() OVER(ORDER BY sub2.line2) AS line3 FROM ( + SELECT 1 AS line2, sub1.* FROM (' . $sql . ') AS sub1 + ) as sub2 ) AS sub3 WHERE line3 BETWEEN ' . ( $offset + 1 ) . ' AND ' . ( $offset + $limit ); return $sql; @@ -770,17 +770,17 @@ class DatabaseMssql extends DatabaseBase { $newUser = $this->escapeIdentifier( $newUser ); $loginPassword = $this->addQuotes( $loginPassword ); - $this->doQuery("CREATE DATABASE $dbName;"); - $this->doQuery("USE $dbName;"); - $this->doQuery("CREATE SCHEMA $dbName;"); - $this->doQuery(" + $this->doQuery( "CREATE DATABASE $dbName;" ); + $this->doQuery( "USE $dbName;" ); + $this->doQuery( "CREATE SCHEMA $dbName;" ); + $this->doQuery( " CREATE LOGIN $newUser WITH PASSWORD=$loginPassword ; - "); - $this->doQuery(" + " ); + $this->doQuery( " CREATE USER $newUser FOR @@ -788,8 +788,8 @@ class DatabaseMssql extends DatabaseBase { WITH DEFAULT_SCHEMA=$dbName ; - "); - $this->doQuery(" + " ); + $this->doQuery( " GRANT BACKUP DATABASE, BACKUP LOG, @@ -804,15 +804,15 @@ class DatabaseMssql extends DatabaseBase { DATABASE::$dbName TO $newUser ; - "); - $this->doQuery(" + " ); + $this->doQuery( " GRANT CONTROL ON SCHEMA::$dbName TO $newUser ; - "); + " ); } @@ -917,7 +917,7 @@ class DatabaseMssql extends DatabaseBase { } // we want this to be compatible with the output of parent::makeSelectOptions() - return array( $startOpts, '' , $tailOpts, '' ); + return array( $startOpts, '', $tailOpts, '' ); } /** diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index 04c22f12df..c5100b5c21 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -361,7 +361,7 @@ class DatabaseMysql extends DatabaseBase { * @param $options string|array * @return int */ - public function estimateRowCount( $table, $vars='*', $conds='', $fname = 'DatabaseMysql::estimateRowCount', $options = array() ) { + public function estimateRowCount( $table, $vars = '*', $conds = '', $fname = 'DatabaseMysql::estimateRowCount', $options = array() ) { $options['EXPLAIN'] = true; $res = $this->select( $table, $vars, $conds, $fname, $options ); if ( $res === false ) { @@ -393,7 +393,7 @@ class DatabaseMysql extends DatabaseBase { for( $i = 0; $i < $n; $i++ ) { $meta = mysql_fetch_field( $res->result, $i ); if( $field == $meta->name ) { - return new MySQLField($meta); + return new MySQLField( $meta ); } } return false; @@ -449,7 +449,7 @@ class DatabaseMysql extends DatabaseBase { function strencode( $s ) { $sQuoted = mysql_real_escape_string( $s, $this->mConn ); - if($sQuoted === false) { + if( $sQuoted === false ) { $this->ping(); $sQuoted = mysql_real_escape_string( $s, $this->mConn ); } @@ -685,7 +685,7 @@ class DatabaseMysql extends DatabaseBase { public function streamStatementEnd( &$sql, &$newLine ) { if ( strtoupper( substr( $newLine, 0, 9 ) ) == 'DELIMITER' ) { - preg_match( '/^DELIMITER\s+(\S+)/' , $newLine, $m ); + preg_match( '/^DELIMITER\s+(\S+)/', $newLine, $m ); $this->delimiter = $m[1]; $newLine = ''; } @@ -721,7 +721,7 @@ class DatabaseMysql extends DatabaseBase { if( $row->lockstatus == 1 ) { return true; } else { - wfDebug( __METHOD__." failed to acquire lock\n" ); + wfDebug( __METHOD__ . " failed to acquire lock\n" ); return false; } } @@ -899,7 +899,7 @@ class DatabaseMysql extends DatabaseBase { $endArray = array(); foreach( $result as $table ) { - $vars = get_object_vars($table); + $vars = get_object_vars( $table ); $table = array_pop( $vars ); if( !$prefix || strpos( $table, $prefix ) === 0 ) { diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index ed9f324fdc..5195a83fa3 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -23,7 +23,7 @@ /** * The oci8 extension is fairly weak and doesn't support oci_num_rows, among - * other things. We use a wrapper class to handle that and other + * other things. We use a wrapper class to handle that and other * Oracle-specific bits, like converting column names back to lowercase. * @ingroup Database */ @@ -69,7 +69,7 @@ class ORAResult { $this->nrows = count( $this->rows ); } - if ($this->nrows > 0) { + if ( $this->nrows > 0 ) { foreach ( $this->rows[0] as $k => $v ) { $this->columns[$k] = strtolower( oci_field_name( $stmt, $k + 1 ) ); } @@ -80,7 +80,7 @@ class ORAResult { } public function free() { - unset($this->db); + unset( $this->db ); } public function seek( $row ) { @@ -92,7 +92,7 @@ class ORAResult { } public function numFields() { - return count($this->columns); + return count( $this->columns ); } public function fetchObject() { @@ -633,7 +633,7 @@ class DatabaseOracle extends DatabaseBase { } list( $startOpts, $useIndex, $tailOpts ) = $this->makeSelectOptions( $selectOptions ); if ( is_array( $srcTable ) ) { - $srcTable = implode( ',', array_map( array( &$this, 'tableName' ), $srcTable ) ); + $srcTable = implode( ',', array_map( array( &$this, 'tableName' ), $srcTable ) ); } else { $srcTable = $this->tableName( $srcTable ); } @@ -778,8 +778,8 @@ class DatabaseOracle extends DatabaseBase { function listTables( $prefix = null, $fname = 'DatabaseOracle::listTables' ) { $listWhere = ''; - if (!empty($prefix)) { - $listWhere = ' AND table_name LIKE \''.strtoupper($prefix).'%\''; + if ( !empty( $prefix ) ) { + $listWhere = ' AND table_name LIKE \'' . strtoupper( $prefix ) . '%\''; } $owner = strtoupper( $this->mDBname ); @@ -787,12 +787,12 @@ class DatabaseOracle extends DatabaseBase { // dirty code ... i know $endArray = array(); - $endArray[] = strtoupper($prefix.'MWUSER'); - $endArray[] = strtoupper($prefix.'PAGE'); - $endArray[] = strtoupper($prefix.'IMAGE'); + $endArray[] = strtoupper( $prefix . 'MWUSER' ); + $endArray[] = strtoupper( $prefix . 'PAGE' ); + $endArray[] = strtoupper( $prefix . 'IMAGE' ); $fixedOrderTabs = $endArray; - while (($row = $result->fetchRow()) !== false) { - if (!in_array($row['table_name'], $fixedOrderTabs)) + while ( ($row = $result->fetchRow()) !== false ) { + if ( !in_array( $row['table_name'], $fixedOrderTabs ) ) $endArray[] = $row['table_name']; } @@ -800,7 +800,7 @@ class DatabaseOracle extends DatabaseBase { } public function dropTable( $tableName, $fName = 'DatabaseOracle::dropTable' ) { - $tableName = $this->tableName($tableName); + $tableName = $this->tableName( $tableName ); if( !$this->tableExists( $tableName ) ) { return false; } @@ -846,7 +846,7 @@ class DatabaseOracle extends DatabaseBase { function getServerVersion() { //better version number, fallback on driver $rset = $this->doQuery( 'SELECT version FROM product_component_version WHERE UPPER(product) LIKE \'ORACLE DATABASE%\'' ); - if ( !( $row = $rset->fetchRow() ) ) { + if ( !( $row = $rset->fetchRow() ) ) { return oci_server_version( $this->mConn ); } return $row['version']; @@ -907,7 +907,7 @@ class DatabaseOracle extends DatabaseBase { $table = array_map( array( &$this, 'tableNameInternal' ), $table ); $tableWhere = 'IN ('; foreach( $table as &$singleTable ) { - $singleTable = $this->removeIdentifierQuotes($singleTable); + $singleTable = $this->removeIdentifierQuotes( $singleTable ); if ( isset( $this->mFieldInfoCache["$singleTable.$field"] ) ) { return $this->mFieldInfoCache["$singleTable.$field"]; } @@ -915,14 +915,14 @@ class DatabaseOracle extends DatabaseBase { } $tableWhere = rtrim( $tableWhere, ',' ) . ')'; } else { - $table = $this->removeIdentifierQuotes( $this->tableNameInternal( $table ) ); + $table = $this->removeIdentifierQuotes( $this->tableNameInternal( $table ) ); if ( isset( $this->mFieldInfoCache["$table.$field"] ) ) { return $this->mFieldInfoCache["$table.$field"]; } $tableWhere = '= \''.$table.'\''; } - $fieldInfoStmt = oci_parse( $this->mConn, 'SELECT * FROM wiki_field_info_full WHERE table_name '.$tableWhere.' and column_name = \''.$field.'\'' ); + $fieldInfoStmt = oci_parse( $this->mConn, 'SELECT * FROM wiki_field_info_full WHERE table_name ' . $tableWhere . ' and column_name = \'' . $field . '\'' ); if ( oci_execute( $fieldInfoStmt, $this->execFlags() ) === false ) { $e = oci_error( $fieldInfoStmt ); $this->reportQueryError( $e['message'], $e['code'], 'fieldInfo QUERY', __METHOD__ ); @@ -957,7 +957,7 @@ class DatabaseOracle extends DatabaseBase { if ( is_array( $table ) ) { throw new DBUnexpectedError( $this, 'DatabaseOracle::fieldInfo called with table array!' ); } - return $this->fieldInfoMulti ($table, $field); + return $this->fieldInfoMulti( $table, $field ); } protected function doBegin( $fname = 'DatabaseOracle::begin' ) { @@ -1066,7 +1066,7 @@ class DatabaseOracle extends DatabaseBase { if ( $db == null || $db == $this->mUser ) { return true; } - $sql = 'ALTER SESSION SET CURRENT_SCHEMA=' . strtoupper($db); + $sql = 'ALTER SESSION SET CURRENT_SCHEMA=' . strtoupper( $db ); $stmt = oci_parse( $this->mConn, $sql ); wfSuppressWarnings(); $success = oci_execute( $stmt ); @@ -1101,11 +1101,11 @@ class DatabaseOracle extends DatabaseBase { } public function removeIdentifierQuotes( $s ) { - return strpos($s, '/*Q*/') === FALSE ? $s : substr($s, 5); + return strpos( $s, '/*Q*/' ) === FALSE ? $s : substr( $s, 5 ); } public function isQuotedIdentifier( $s ) { - return strpos($s, '/*Q*/') !== FALSE; + return strpos( $s, '/*Q*/' ) !== FALSE; } private function wrapFieldForWhere( $table, &$col, &$val ) { @@ -1139,7 +1139,7 @@ class DatabaseOracle extends DatabaseBase { } function selectRow( $table, $vars, $conds, $fname = 'DatabaseOracle::selectRow', $options = array(), $join_conds = array() ) { - if ( is_array($conds) ) { + if ( is_array( $conds ) ) { $conds = $this->wrapConditionsForWhere( $table, $conds ); } return parent::selectRow( $table, $vars, $conds, $fname, $options, $join_conds ); @@ -1186,15 +1186,15 @@ class DatabaseOracle extends DatabaseBase { return array( $startOpts, $useIndex, $preLimitTail, $postLimitTail ); } - + public function delete( $table, $conds, $fname = 'DatabaseOracle::delete' ) { - if ( is_array($conds) ) { + if ( is_array( $conds ) ) { $conds = $this->wrapConditionsForWhere( $table, $conds ); } // a hack for deleting pages, users and images (which have non-nullable FKs) // all deletions on these tables have transactions so final failure rollbacks these updates $table = $this->tableName( $table ); - if ( $table == $this->tableName( 'user' ) ) { + if ( $table == $this->tableName( 'user' ) ) { $this->update( 'archive', array( 'ar_user' => 0 ), array( 'ar_user' => $conds['user_id'] ), $fname ); $this->update( 'ipblocks', array( 'ipb_user' => 0 ), array( 'ipb_user' => $conds['user_id'] ), $fname ); $this->update( 'image', array( 'img_user' => 0 ), array( 'img_user' => $conds['user_id'] ), $fname ); @@ -1204,7 +1204,7 @@ class DatabaseOracle extends DatabaseBase { $this->update( 'uploadstash', array( 'us_user' => 0 ), array( 'us_user' => $conds['user_id'] ), $fname ); $this->update( 'recentchanges', array( 'rc_user' => 0 ), array( 'rc_user' => $conds['user_id'] ), $fname ); $this->update( 'logging', array( 'log_user' => 0 ), array( 'log_user' => $conds['user_id'] ), $fname ); - } elseif ( $table == $this->tableName( 'image' ) ) { + } elseif ( $table == $this->tableName( 'image' ) ) { $this->update( 'oldimage', array( 'oi_name' => 0 ), array( 'oi_name' => $conds['img_name'] ), $fname ); } return parent::delete( $table, $conds, $fname ); diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index 8d02cee988..86b8e8a7bb 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -176,8 +176,8 @@ class PostgresTransactionState { $old = reset( $this->mCurrentState ); $new = reset( $this->mNewState ); foreach ( self::$WATCHED as $watched ) { - if ($old !== $new) { - $this->log_changed($old, $new, $watched); + if ( $old !== $new ) { + $this->log_changed( $old, $new, $watched ); } $old = next( $this->mCurrentState ); $new = next( $this->mNewState ); @@ -197,11 +197,11 @@ class PostgresTransactionState { } protected function log_changed( $old, $new, $watched ) { - wfDebug(sprintf($watched["desc"], + wfDebug( sprintf( $watched["desc"], $this->mConn, $this->describe_changed( $old, $watched["states"] ), - $this->describe_changed( $new, $watched["states"] )) - ); + $this->describe_changed( $new, $watched["states"] ) + ) ); } } @@ -218,7 +218,7 @@ class SavepointPostgres { protected $id; protected $didbegin; - public function __construct ($dbw, $id) { + public function __construct ( $dbw, $id ) { $this->dbw = $dbw; $this->id = $id; $this->didbegin = false; @@ -247,29 +247,29 @@ class SavepointPostgres { global $wgDebugDBTransactions; if ( $this->dbw->doQuery( $keyword . " " . $this->id ) !== false ) { if ( $wgDebugDBTransactions ) { - wfDebug( sprintf ($msg_ok, $this->id ) ); + wfDebug( sprintf ( $msg_ok, $this->id ) ); } } else { - wfDebug( sprintf ($msg_failed, $this->id ) ); + wfDebug( sprintf ( $msg_failed, $this->id ) ); } } public function savepoint() { - $this->query("SAVEPOINT", + $this->query( "SAVEPOINT", "Transaction state: savepoint \"%s\" established.\n", "Transaction state: establishment of savepoint \"%s\" FAILED.\n" ); } public function release() { - $this->query("RELEASE", + $this->query( "RELEASE", "Transaction state: savepoint \"%s\" released.\n", "Transaction state: release of savepoint \"%s\" FAILED.\n" ); } public function rollback() { - $this->query("ROLLBACK TO", + $this->query( "ROLLBACK TO", "Transaction state: savepoint \"%s\" rolled back.\n", "Transaction state: rollback of savepoint \"%s\" FAILED.\n" ); @@ -606,7 +606,7 @@ class DatabasePostgres extends DatabaseBase { * Takes same arguments as Database::select() * @return int */ - function estimateRowCount( $table, $vars = '*', $conds='', $fname = 'DatabasePostgres::estimateRowCount', $options = array() ) { + function estimateRowCount( $table, $vars = '*', $conds = '', $fname = 'DatabasePostgres::estimateRowCount', $options = array() ) { $options['EXPLAIN'] = true; $res = $this->select( $table, $vars, $conds, $fname, $options ); $rows = -1; @@ -684,7 +684,7 @@ class DatabasePostgres extends DatabaseBase { AND i.indclass[s.g] = opcls.oid AND pg_am.oid = opcls.opcmethod __INDEXATTR__; - $res = $this->query($sql, __METHOD__); + $res = $this->query( $sql, __METHOD__ ); $a = array(); if ( $res ) { foreach ( $res as $row ) { @@ -692,7 +692,7 @@ __INDEXATTR__; $row->attname, $row->opcname, $row->amname, - $row->option); + $row->option ); } } else { return null; @@ -735,7 +735,7 @@ __INDEXATTR__; } $table = $this->tableName( $table ); - if (! isset( $this->numeric_version ) ) { + if ( !isset( $this->numeric_version ) ) { $this->getServerVersion(); } @@ -987,7 +987,7 @@ __INDEXATTR__; $endArray = array(); foreach( $result as $table ) { - $vars = get_object_vars($table); + $vars = get_object_vars( $table ); $table = array_pop( $vars ); if( !$prefix || strpos( $table, $prefix ) === 0 ) { $endArray[] = $table; @@ -1068,7 +1068,7 @@ __INDEXATTR__; * @return string return default schema for the current session */ function getCurrentSchema() { - $res = $this->query( "SELECT current_schema()", __METHOD__); + $res = $this->query( "SELECT current_schema()", __METHOD__ ); $row = $this->fetchRow( $res ); return $row[0]; } @@ -1084,11 +1084,11 @@ __INDEXATTR__; * @return array list of actual schemas for the current sesson */ function getSchemas() { - $res = $this->query( "SELECT current_schemas(false)", __METHOD__); + $res = $this->query( "SELECT current_schemas(false)", __METHOD__ ); $row = $this->fetchRow( $res ); $schemas = array(); /* PHP pgsql support does not support array type, "{a,b}" string is returned */ - return $this->pg_array_parse($row[0], $schemas); + return $this->pg_array_parse( $row[0], $schemas ); } /** @@ -1101,10 +1101,10 @@ __INDEXATTR__; * @return array how to search for table names schemas for the current user */ function getSearchPath() { - $res = $this->query( "SHOW search_path", __METHOD__); + $res = $this->query( "SHOW search_path", __METHOD__ ); $row = $this->fetchRow( $res ); /* PostgreSQL returns SHOW values as strings */ - return explode(",", $row[0]); + return explode( ",", $row[0] ); } /** @@ -1115,7 +1115,7 @@ __INDEXATTR__; * @param $search_path array list of schemas to be searched by default */ function setSearchPath( $search_path ) { - $this->query( "SET search_path = " . implode(", ", $search_path) ); + $this->query( "SET search_path = " . implode( ", ", $search_path ) ); } /** @@ -1136,7 +1136,7 @@ __INDEXATTR__; if ( $this->schemaExists( $desired_schema ) ) { if ( in_array( $desired_schema, $this->getSchemas() ) ) { $this->mCoreSchema = $desired_schema; - wfDebug("Schema \"" . $desired_schema . "\" already in the search path\n"); + wfDebug( "Schema \"" . $desired_schema . "\" already in the search path\n" ); } else { /** * Prepend our schema (e.g. 'mediawiki') in front @@ -1148,11 +1148,11 @@ __INDEXATTR__; $this->addIdentifierQuotes( $desired_schema )); $this->setSearchPath( $search_path ); $this->mCoreSchema = $desired_schema; - wfDebug("Schema \"" . $desired_schema . "\" added to the search path\n"); + wfDebug( "Schema \"" . $desired_schema . "\" added to the search path\n" ); } } else { $this->mCoreSchema = $this->getCurrentSchema(); - wfDebug("Schema \"" . $desired_schema . "\" not found, using current \"". $this->mCoreSchema ."\"\n"); + wfDebug( "Schema \"" . $desired_schema . "\" not found, using current \"" . $this->mCoreSchema . "\"\n" ); } /* Commit SET otherwise it will be rollbacked on error or IGNORE SELECT */ $this->commit( __METHOD__ ); @@ -1258,8 +1258,8 @@ SQL; } function constraintExists( $table, $constraint ) { - $SQL = sprintf( "SELECT 1 FROM information_schema.table_constraints ". - "WHERE constraint_schema = %s AND table_name = %s AND constraint_name = %s", + $SQL = sprintf( "SELECT 1 FROM information_schema.table_constraints " . + "WHERE constraint_schema = %s AND table_name = %s AND constraint_name = %s", $this->addQuotes( $this->getCoreSchema() ), $this->addQuotes( $table ), $this->addQuotes( $constraint ) diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 7e95fd3c21..9120c28758 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -163,7 +163,7 @@ class DatabaseSqlite extends DatabaseBase { $res = $this->query( "SELECT sql FROM sqlite_master WHERE tbl_name = '$table'", __METHOD__ ); if ( $res ) { $row = $res->fetchRow(); - self::$fulltextEnabled = stristr($row['sql'], 'fts' ) !== false; + self::$fulltextEnabled = stristr( $row['sql'], 'fts' ) !== false; } } return self::$fulltextEnabled; @@ -850,7 +850,7 @@ class DatabaseSqlite extends DatabaseBase { $endArray = array(); foreach( $result as $table ) { - $vars = get_object_vars($table); + $vars = get_object_vars( $table ); $table = array_pop( $vars ); if( !$prefix || strpos( $table, $prefix ) === 0 ) { diff --git a/includes/db/DatabaseUtility.php b/includes/db/DatabaseUtility.php index 064bc41cdb..5e110767a3 100644 --- a/includes/db/DatabaseUtility.php +++ b/includes/db/DatabaseUtility.php @@ -138,7 +138,7 @@ class ResultWrapper implements Iterator { /** * Fetch the next row from the given result object, in associative array - * form. Fields are retrieved with $row['fieldname']. + * form. Fields are retrieved with $row['fieldname']. * * @return Array * @throws DBUnexpectedError Thrown if the database returns an error diff --git a/includes/db/LBFactory.php b/includes/db/LBFactory.php index e82c54ba3d..cc7f133bba 100644 --- a/includes/db/LBFactory.php +++ b/includes/db/LBFactory.php @@ -240,7 +240,7 @@ class LBFactory_Simple extends LBFactory { function newExternalLB( $cluster, $wiki = false ) { global $wgExternalServers; if ( !isset( $wgExternalServers[$cluster] ) ) { - throw new MWException( __METHOD__.": Unknown cluster \"$cluster\"" ); + throw new MWException( __METHOD__ . ": Unknown cluster \"$cluster\"" ); } return new LoadBalancer( array( 'servers' => $wgExternalServers[$cluster] @@ -345,7 +345,7 @@ class ChronologyProtector { if ( $lb->getServerCount() > 1 && !empty( $this->startupPos[$masterName] ) ) { $info = $lb->parentInfo(); $pos = $this->startupPos[$masterName]; - wfDebug( __METHOD__.": LB " . $info['id'] . " waiting for master pos $pos\n" ); + wfDebug( __METHOD__ . ": LB " . $info['id'] . " waiting for master pos $pos\n" ); $lb->waitFor( $this->startupPos[$masterName] ); } } @@ -370,11 +370,11 @@ class ChronologyProtector { $db = $lb->getAnyOpenConnection( 0 ); $info = $lb->parentInfo(); if ( !$db || !$db->doneWrites() ) { - wfDebug( __METHOD__.": LB {$info['id']}, no writes done\n" ); + wfDebug( __METHOD__ . ": LB {$info['id']}, no writes done\n" ); return; } $pos = $db->getMasterPos(); - wfDebug( __METHOD__.": LB {$info['id']} has master pos $pos\n" ); + wfDebug( __METHOD__ . ": LB {$info['id']} has master pos $pos\n" ); $this->shutdownPos[$masterName] = $pos; } @@ -384,7 +384,7 @@ class ChronologyProtector { */ function shutdown() { if ( session_id() != '' && count( $this->shutdownPos ) ) { - wfDebug( __METHOD__.": saving master pos for " . + wfDebug( __METHOD__ . ": saving master pos for " . count( $this->shutdownPos ) . " master(s)\n" ); $_SESSION[__CLASS__] = $this->shutdownPos; } diff --git a/includes/db/LBFactory_Multi.php b/includes/db/LBFactory_Multi.php index 9b468a7f7f..88b7500245 100644 --- a/includes/db/LBFactory_Multi.php +++ b/includes/db/LBFactory_Multi.php @@ -83,7 +83,7 @@ class LBFactory_Multi extends LBFactory { foreach ( $required as $key ) { if ( !isset( $conf[$key] ) ) { - throw new MWException( __CLASS__.": $key is required in configuration" ); + throw new MWException( __CLASS__ . ": $key is required in configuration" ); } $this->$key = $conf[$key]; } @@ -161,7 +161,7 @@ class LBFactory_Multi extends LBFactory { */ function newExternalLB( $cluster, $wiki = false ) { if ( !isset( $this->externalLoads[$cluster] ) ) { - throw new MWException( __METHOD__.": Unknown cluster \"$cluster\"" ); + throw new MWException( __METHOD__ . ": Unknown cluster \"$cluster\"" ); } $template = $this->serverTemplate; if ( isset( $this->externalTemplateOverrides ) ) { diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 2a0c50ff3e..d42a152858 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -45,7 +45,7 @@ class LoadBalancer { */ function __construct( $params ) { if ( !isset( $params['servers'] ) ) { - throw new MWException( __CLASS__.': missing servers parameter' ); + throw new MWException( __CLASS__ . ': missing servers parameter' ); } $this->mServers = $params['servers']; @@ -205,7 +205,7 @@ class LoadBalancer { global $wgReadOnly, $wgDBClusterTimeout, $wgDBAvgStatusPoll, $wgDBtype; # @todo FIXME: For now, only go through all this for mysql databases - if ($wgDBtype != 'mysql') { + if ( $wgDBtype != 'mysql' ) { return $this->getWriterIndex(); } @@ -230,7 +230,7 @@ class LoadBalancer { $nonErrorLoads = $this->mGroupLoads[$group]; } else { # No loads for this group, return false and the caller can use some other group - wfDebug( __METHOD__.": no loads for group $group\n" ); + wfDebug( __METHOD__ . ": no loads for group $group\n" ); wfProfileOut( __METHOD__ ); return false; } @@ -272,16 +272,16 @@ class LoadBalancer { # pickRandom() returned false # This is permanent and means the configuration or the load monitor # wants us to return false. - wfDebugLog( 'connect', __METHOD__.": pickRandom() returned false\n" ); + wfDebugLog( 'connect', __METHOD__ . ": pickRandom() returned false\n" ); wfProfileOut( __METHOD__ ); return false; } - wfDebugLog( 'connect', __METHOD__.": Using reader #$i: {$this->mServers[$i]['host']}...\n" ); + wfDebugLog( 'connect', __METHOD__ . ": Using reader #$i: {$this->mServers[$i]['host']}...\n" ); $conn = $this->openConnection( $i, $wiki ); if ( !$conn ) { - wfDebugLog( 'connect', __METHOD__.": Failed connecting to $i/$wiki\n" ); + wfDebugLog( 'connect', __METHOD__ . ": Failed connecting to $i/$wiki\n" ); unset( $nonErrorLoads[$i] ); unset( $currentLoads[$i] ); continue; @@ -320,7 +320,7 @@ class LoadBalancer { # Some servers must have been overloaded if ( $overloadedServers == 0 ) { - throw new MWException( __METHOD__.": unexpectedly found no overloaded servers" ); + throw new MWException( __METHOD__ . ": unexpectedly found no overloaded servers" ); } # Back off for a while # Scale the sleep time by the number of connected threads, to produce a @@ -358,7 +358,7 @@ class LoadBalancer { */ function sleep( $t ) { wfProfileIn( __METHOD__ ); - wfDebug( __METHOD__.": waiting $t us\n" ); + wfDebug( __METHOD__ . ": waiting $t us\n" ); usleep( $t ); wfProfileOut( __METHOD__ ); return $t; @@ -435,15 +435,15 @@ class LoadBalancer { } } - wfDebug( __METHOD__.": Waiting for slave #$index to catch up...\n" ); + wfDebug( __METHOD__ . ": Waiting for slave #$index to catch up...\n" ); $result = $conn->masterPosWait( $this->mWaitForPos, $this->mWaitTimeout ); if ( $result == -1 || is_null( $result ) ) { # Timed out waiting for slave, use master instead - wfDebug( __METHOD__.": Timed out waiting for slave #$index pos {$this->mWaitForPos}\n" ); + wfDebug( __METHOD__ . ": Timed out waiting for slave #$index pos {$this->mWaitForPos}\n" ); return false; } else { - wfDebug( __METHOD__.": Done\n" ); + wfDebug( __METHOD__ . ": Done\n" ); return true; } } @@ -479,7 +479,7 @@ class LoadBalancer { $groupIndex = $this->getReaderIndex( $groups, $wiki ); if ( $groupIndex !== false ) { $serverName = $this->getServerName( $groupIndex ); - wfDebug( __METHOD__.": using server $serverName for group $groups\n" ); + wfDebug( __METHOD__ . ": using server $serverName for group $groups\n" ); $i = $groupIndex; } } else { @@ -487,7 +487,7 @@ class LoadBalancer { $groupIndex = $this->getReaderIndex( $group, $wiki ); if ( $groupIndex !== false ) { $serverName = $this->getServerName( $groupIndex ); - wfDebug( __METHOD__.": using server $serverName for group $group\n" ); + wfDebug( __METHOD__ . ": using server $serverName for group $group\n" ); $i = $groupIndex; break; } @@ -525,8 +525,8 @@ class LoadBalancer { * @throws MWException */ public function reuseConnection( $conn ) { - $serverIndex = $conn->getLBInfo('serverIndex'); - $refCount = $conn->getLBInfo('foreignPoolRefCount'); + $serverIndex = $conn->getLBInfo( 'serverIndex' ); + $refCount = $conn->getLBInfo( 'foreignPoolRefCount' ); $dbName = $conn->getDBname(); $prefix = $conn->tablePrefix(); if ( strval( $prefix ) !== '' ) { @@ -535,7 +535,7 @@ class LoadBalancer { $wiki = $dbName; } if ( $serverIndex === null || $refCount === null ) { - wfDebug( __METHOD__.": this connection was not opened as a foreign connection\n" ); + wfDebug( __METHOD__ . ": this connection was not opened as a foreign connection\n" ); /** * This can happen in code like: * foreach ( $dbs as $db ) { @@ -549,15 +549,15 @@ class LoadBalancer { return; } if ( $this->mConns['foreignUsed'][$serverIndex][$wiki] !== $conn ) { - throw new MWException( __METHOD__.": connection not found, has the connection been freed already?" ); + throw new MWException( __METHOD__ . ": connection not found, has the connection been freed already?" ); } $conn->setLBInfo( 'foreignPoolRefCount', --$refCount ); if ( $refCount <= 0 ) { $this->mConns['foreignFree'][$serverIndex][$wiki] = $conn; unset( $this->mConns['foreignUsed'][$serverIndex][$wiki] ); - wfDebug( __METHOD__.": freed connection $serverIndex/$wiki\n" ); + wfDebug( __METHOD__ . ": freed connection $serverIndex/$wiki\n" ); } else { - wfDebug( __METHOD__.": reference count for $serverIndex/$wiki reduced to $refCount\n" ); + wfDebug( __METHOD__ . ": reference count for $serverIndex/$wiki reduced to $refCount\n" ); } } @@ -620,18 +620,18 @@ class LoadBalancer { * @return DatabaseBase */ function openForeignConnection( $i, $wiki ) { - wfProfileIn(__METHOD__); + wfProfileIn( __METHOD__ ); list( $dbName, $prefix ) = wfSplitWikiID( $wiki ); if ( isset( $this->mConns['foreignUsed'][$i][$wiki] ) ) { // Reuse an already-used connection $conn = $this->mConns['foreignUsed'][$i][$wiki]; - wfDebug( __METHOD__.": reusing connection $i/$wiki\n" ); + wfDebug( __METHOD__ . ": reusing connection $i/$wiki\n" ); } elseif ( isset( $this->mConns['foreignFree'][$i][$wiki] ) ) { // Reuse a free connection for the same wiki $conn = $this->mConns['foreignFree'][$i][$wiki]; unset( $this->mConns['foreignFree'][$i][$wiki] ); $this->mConns['foreignUsed'][$i][$wiki] = $conn; - wfDebug( __METHOD__.": reusing free connection $i/$wiki\n" ); + wfDebug( __METHOD__ . ": reusing free connection $i/$wiki\n" ); } elseif ( !empty( $this->mConns['foreignFree'][$i] ) ) { // Reuse a connection from another wiki $conn = reset( $this->mConns['foreignFree'][$i] ); @@ -646,7 +646,7 @@ class LoadBalancer { $conn->tablePrefix( $prefix ); unset( $this->mConns['foreignFree'][$i][$oldWiki] ); $this->mConns['foreignUsed'][$i][$wiki] = $conn; - wfDebug( __METHOD__.": reusing free connection from $oldWiki for $wiki\n" ); + wfDebug( __METHOD__ . ": reusing free connection from $oldWiki for $wiki\n" ); } } else { // Open a new connection @@ -655,13 +655,13 @@ class LoadBalancer { $server['foreignPoolRefCount'] = 0; $conn = $this->reallyOpenConnection( $server, $dbName ); if ( !$conn->isOpen() ) { - wfDebug( __METHOD__.": error opening connection for $i/$wiki\n" ); + wfDebug( __METHOD__ . ": error opening connection for $i/$wiki\n" ); $this->mErrorConnection = $conn; $conn = false; } else { $conn->tablePrefix( $prefix ); $this->mConns['foreignUsed'][$i][$wiki] = $conn; - wfDebug( __METHOD__.": opened new connection for $i/$wiki\n" ); + wfDebug( __METHOD__ . ": opened new connection for $i/$wiki\n" ); } } @@ -670,7 +670,7 @@ class LoadBalancer { $refCount = $conn->getLBInfo( 'foreignPoolRefCount' ); $conn->setLBInfo( 'foreignPoolRefCount', $refCount + 1 ); } - wfProfileOut(__METHOD__); + wfProfileOut( __METHOD__ ); return $conn; } diff --git a/includes/db/LoadMonitor.php b/includes/db/LoadMonitor.php index 22938aaa4e..cb3376fcea 100644 --- a/includes/db/LoadMonitor.php +++ b/includes/db/LoadMonitor.php @@ -159,7 +159,7 @@ class LoadMonitor_MySQL implements LoadMonitor { $times = array(); foreach ( $serverIndexes as $i ) { - if ($i == 0) { # Master + if ( $i == 0 ) { # Master $times[$i] = 0; } elseif ( false !== ( $conn = $this->parent->getAnyOpenConnection( $i ) ) ) { $times[$i] = $conn->getLag(); @@ -173,7 +173,7 @@ class LoadMonitor_MySQL implements LoadMonitor { $wgMemc->set( $memcKey, $times, $expiry ); # But don't give the timestamp to the caller - unset($times['timestamp']); + unset( $times['timestamp'] ); $lagTimes = $times; wfProfileOut( __METHOD__ ); @@ -189,7 +189,7 @@ class LoadMonitor_MySQL implements LoadMonitor { if ( !$threshold ) { return 0; } - $status = $conn->getMysqlStatus("Thread%"); + $status = $conn->getMysqlStatus( "Thread%" ); if ( $status['Threads_running'] > $threshold ) { $server = $conn->getProperty( 'mServer' ); wfLogDBError( "LB backoff from $server - Threads_running = {$status['Threads_running']}\n" ); diff --git a/includes/diff/DairikiDiff.php b/includes/diff/DairikiDiff.php index 46a3398c32..6ef5fcbade 100644 --- a/includes/diff/DairikiDiff.php +++ b/includes/diff/DairikiDiff.php @@ -167,7 +167,7 @@ class _DiffOp_Change extends _DiffOp { */ class _DiffEngine { - const MAX_XREF_LENGTH = 10000; + const MAX_XREF_LENGTH = 10000; protected $xchanged, $ychanged; @@ -491,8 +491,7 @@ class _DiffEngine { // $nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5); // $nchunks = max(2,min(8,(int)$nchunks)); $nchunks = min( 7, $xlim - $xoff, $ylim - $yoff ) + 1; - list ( $lcs, $seps ) - = $this->_diag( $xoff, $xlim, $yoff, $ylim, $nchunks ); + list ( $lcs, $seps ) = $this->_diag( $xoff, $xlim, $yoff, $ylim, $nchunks ); } if ( $lcs == 0 ) { @@ -1365,7 +1364,7 @@ class TableDiffFormatter extends DiffFormatter { */ function _block_header( $xbeg, $xlen, $ybeg, $ylen ) { $r = '\n" . - '\n"; + '\n"; return $r; } diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 97553e682c..a3239a3e86 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -152,7 +152,7 @@ class DifferenceEngine extends ContextSource { function deletedLink( $id ) { if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) { $dbr = wfGetDB( DB_SLAVE ); - $row = $dbr->selectRow('archive', '*', + $row = $dbr->selectRow( 'archive', '*', array( 'ar_rev_id' => $id ), __METHOD__ ); if ( $row ) { diff --git a/includes/externalstore/ExternalStore.php b/includes/externalstore/ExternalStore.php index 8bf1ca976a..5dd49d7555 100644 --- a/includes/externalstore/ExternalStore.php +++ b/includes/externalstore/ExternalStore.php @@ -138,7 +138,7 @@ class ExternalStore { while ( count( $tryStores ) > 0 ) { $index = mt_rand( 0, count( $tryStores ) - 1 ); $storeUrl = $tryStores[$index]; - wfDebug( __METHOD__.": trying $storeUrl\n" ); + wfDebug( __METHOD__ . ": trying $storeUrl\n" ); list( $proto, $path ) = explode( '://', $storeUrl, 2 ); $store = self::getStoreObject( $proto, $params ); if ( $store === false ) { diff --git a/includes/externalstore/ExternalStoreDB.php b/includes/externalstore/ExternalStoreDB.php index 8e05cfec61..3857771465 100644 --- a/includes/externalstore/ExternalStoreDB.php +++ b/includes/externalstore/ExternalStoreDB.php @@ -79,7 +79,7 @@ class ExternalStoreDB extends ExternalStoreMedium { * @return LoadBalancer object */ function &getLoadBalancer( $cluster ) { - $wiki = isset($this->params['wiki']) ? $this->params['wiki'] : false; + $wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : false; return wfGetLBFactory()->getExternalLB( $cluster, $wiki ); } @@ -93,12 +93,12 @@ class ExternalStoreDB extends ExternalStoreMedium { function &getSlave( $cluster ) { global $wgDefaultExternalStore; - $wiki = isset($this->params['wiki']) ? $this->params['wiki'] : false; + $wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : false; $lb =& $this->getLoadBalancer( $cluster ); if ( !in_array( "DB://" . $cluster, (array)$wgDefaultExternalStore ) ) { wfDebug( "read only external store" ); - $lb->allowLagged(true); + $lb->allowLagged( true ); } else { wfDebug( "writable external store" ); } @@ -113,7 +113,7 @@ class ExternalStoreDB extends ExternalStoreMedium { * @return DatabaseBase object */ function &getMaster( $cluster ) { - $wiki = isset($this->params['wiki']) ? $this->params['wiki'] : false; + $wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : false; $lb =& $this->getLoadBalancer( $cluster ); return $lb->getConnection( DB_MASTER, array(), $wiki ); } diff --git a/includes/job/JobQueueDB.php b/includes/job/JobQueueDB.php index 99a517e68f..9b3ffa7ec7 100644 --- a/includes/job/JobQueueDB.php +++ b/includes/job/JobQueueDB.php @@ -114,7 +114,7 @@ class JobQueueDB extends JobQueue { list( $dbr, $scope ) = $this->getSlaveDB(); $count = (int)$dbr->selectField( 'job', 'COUNT(*)', - array( 'job_cmd' => $this->type, "job_token !={$dbr->addQuotes('')}" ), + array( 'job_cmd' => $this->type, "job_token != {$dbr->addQuotes( '' )}" ), __METHOD__ ); $wgMemc->set( $key, $count, self::CACHE_TTL_SHORT ); diff --git a/includes/normal/UtfNormalDefines.php b/includes/normal/UtfNormalDefines.php index 64624b8a14..b07e3399ad 100644 --- a/includes/normal/UtfNormalDefines.php +++ b/includes/normal/UtfNormalDefines.php @@ -26,7 +26,7 @@ */ define( 'UNICODE_HANGUL_FIRST', 0xac00 ); -define( 'UNICODE_HANGUL_LAST', 0xd7a3 ); +define( 'UNICODE_HANGUL_LAST', 0xd7a3 ); define( 'UNICODE_HANGUL_LBASE', 0x1100 ); define( 'UNICODE_HANGUL_VBASE', 0x1161 ); diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index a622630987..4eb30ee119 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -78,7 +78,7 @@ abstract class UploadBase { self::ILLEGAL_FILENAME => 'illegal-filename', self::OVERWRITE_EXISTING_FILE => 'overwrite', self::VERIFICATION_ERROR => 'verification-error', - self::HOOK_ABORTED => 'hookaborted', + self::HOOK_ABORTED => 'hookaborted', self::WINDOWS_NONASCII_FILENAME => 'windows-nonascii-filename', self::FILENAME_TOO_LONG => 'filename-toolong', ); @@ -409,7 +409,7 @@ abstract class UploadBase { $this->mFileProps = FSFile::getPropsFromPath( $this->mTempPath, $this->mFinalExtension ); # check mime type, if desired - $mime = $this->mFileProps[ 'file-mime' ]; + $mime = $this->mFileProps['file-mime']; $status = $this->verifyMimeType( $mime ); if ( $status !== true ) { wfProfileOut( __METHOD__ ); @@ -768,7 +768,7 @@ abstract class UploadBase { } if( strlen( $partname ) < 1 ) { - $this->mTitleError = self::MIN_LENGTH_PARTNAME; + $this->mTitleError = self::MIN_LENGTH_PARTNAME; return $this->mTitle = null; } @@ -940,7 +940,7 @@ abstract class UploadBase { # ugly hack: for text files, always look at the entire file. # For binary field, just check the first K. - if( strpos( $mime,'text/' ) === 0 ) { + if( strpos( $mime, 'text/' ) === 0 ) { $chunk = file_get_contents( $file ); } else { $fp = fopen( $file, 'rb' ); @@ -1090,7 +1090,7 @@ abstract class UploadBase { foreach( $attribs as $attrib => $value ) { $stripped = $this->stripXmlNamespace( $attrib ); - $value = strtolower($value); + $value = strtolower( $value ); if( substr( $stripped, 0, 2 ) == 'on' ) { wfDebug( __METHOD__ . ": Found event-handler attribute '$attrib'='$value' in uploaded file.\n" ); @@ -1143,8 +1143,8 @@ abstract class UploadBase { # use CSS styles to bring in remote code # catch url("http:..., url('http:..., url(http:..., but not url("#..., url('#..., url(#.... if( $stripped == 'style' && preg_match_all( '!((?:font|clip-path|fill|filter|marker|marker-end|marker-mid|marker-start|mask|stroke)\s*:\s*url\s*\(\s*["\']?\s*[^#]+.*?\))!sim', $value, $matches ) ) { - foreach ($matches[1] as $match) { - if (!preg_match( '!(?:font|clip-path|fill|filter|marker|marker-end|marker-mid|marker-start|mask|stroke)\s*:\s*url\s*\(\s*(#|\'#|"#)!sim', $match ) ) { + foreach ( $matches[1] as $match ) { + if ( !preg_match( '!(?:font|clip-path|fill|filter|marker|marker-end|marker-mid|marker-start|mask|stroke)\s*:\s*url\s*\(\s*(#|\'#|"#)!sim', $match ) ) { wfDebug( __METHOD__ . ": Found svg setting a style with remote url '$attrib'='$value' in uploaded file.\n" ); return true; } @@ -1379,7 +1379,7 @@ abstract class UploadBase { if ( self::isThumbName( $file->getName() ) ) { # Check for filenames like 50px- or 180px-, these are mostly thumbnails - $nt_thb = Title::newFromText( substr( $partname , strpos( $partname , '-' ) +1 ) . '.' . $extension, NS_FILE ); + $nt_thb = Title::newFromText( substr( $partname, strpos( $partname, '-' ) + 1 ) . '.' . $extension, NS_FILE ); $file_thb = wfLocalFile( $nt_thb ); if( $file_thb->exists() ) { return array( @@ -1420,10 +1420,10 @@ abstract class UploadBase { $n = strrpos( $filename, '.' ); $partname = $n ? substr( $filename, 0, $n ) : $filename; return ( - substr( $partname , 3, 3 ) == 'px-' || - substr( $partname , 2, 3 ) == 'px-' + substr( $partname, 3, 3 ) == 'px-' || + substr( $partname, 2, 3 ) == 'px-' ) && - preg_match( "/[0-9]{2}/" , substr( $partname , 0, 2 ) ); + preg_match( "/[0-9]{2}/", substr( $partname, 0, 2 ) ); } /** diff --git a/includes/upload/UploadStash.php b/includes/upload/UploadStash.php index d91649c93a..65626cf46a 100644 --- a/includes/upload/UploadStash.php +++ b/includes/upload/UploadStash.php @@ -206,8 +206,8 @@ class UploadStash { // // some things that when combined will make a suitably unique key. // see: http://www.jwz.org/doc/mid.html - list ($usec, $sec) = explode( ' ', microtime() ); - $usec = substr($usec, 2); + list( $usec, $sec ) = explode( ' ', microtime() ); + $usec = substr( $usec, 2 ); $key = wfBaseConvert( $sec . $usec, 10, 36 ) . '.' . wfBaseConvert( mt_rand(), 10, 36 ) . '.'. $this->userId . '.' . -- 2.20.1