fix some spacing
authorumherirrender <umherirrender_de.wp@web.de>
Sun, 3 Feb 2013 18:47:42 +0000 (19:47 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 4 Feb 2013 19:59:14 +0000 (19:59 +0000)
Change-Id: I670a7baf3ba1e70d18346bb00938d518ba2063bd

40 files changed:
includes/actions/HistoryAction.php
includes/api/ApiBase.php
includes/api/ApiFileRevert.php
includes/api/ApiFormatXml.php
includes/api/ApiImport.php
includes/api/ApiPageSet.php
includes/api/ApiQueryBase.php
includes/api/ApiQueryBlocks.php
includes/api/ApiQueryCategoryMembers.php
includes/api/ApiQueryImageInfo.php
includes/api/ApiQueryPageProps.php
includes/api/ApiQueryQueryPage.php
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryRevisions.php
includes/api/ApiQuerySiteinfo.php
includes/api/ApiQueryUserContributions.php
includes/api/ApiQueryUsers.php
includes/api/ApiUpload.php
includes/db/CloneDatabase.php
includes/db/Database.php
includes/db/DatabaseError.php
includes/db/DatabaseIbm_db2.php
includes/db/DatabaseMssql.php
includes/db/DatabaseMysql.php
includes/db/DatabaseOracle.php
includes/db/DatabasePostgres.php
includes/db/DatabaseSqlite.php
includes/db/DatabaseUtility.php
includes/db/LBFactory.php
includes/db/LBFactory_Multi.php
includes/db/LoadBalancer.php
includes/db/LoadMonitor.php
includes/diff/DairikiDiff.php
includes/diff/DifferenceEngine.php
includes/externalstore/ExternalStore.php
includes/externalstore/ExternalStoreDB.php
includes/job/JobQueueDB.php
includes/normal/UtfNormalDefines.php
includes/upload/UploadBase.php
includes/upload/UploadStash.php

index a1d1c3a..d26228a 100644 (file)
@@ -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 .= ' <span class="mw-changeslist-separator">. .</span> ' . "$fSize $sDiff";
                }
 
@@ -617,7 +617,7 @@ class HistoryPager extends ReverseChronologicalPager {
                $s2 = Linker::revComment( $rev, false, true );
 
                if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) {
-                       $s2 .= ' <span class="updatedmarker">' .  $this->msg( 'updatedmarker' )->escaped() . '</span>';
+                       $s2 .= ' <span class="updatedmarker">' . $this->msg( 'updatedmarker' )->escaped() . '</span>';
                        $classes[] = 'mw-history-line-updated';
                }
 
@@ -671,7 +671,7 @@ class HistoryPager extends ReverseChronologicalPager {
                        $s .= ' <span class="mw-changeslist-separator">. .</span> ' . $s2;
                }
 
-               wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row , &$s, &$classes ) );
+               wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row, &$s, &$classes ) );
 
                $attribs = array();
                if ( $classes ) {
index 5621b7c..68302b1 100644 (file)
@@ -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' ),
index 91ab499..9520dc7 100644 (file)
@@ -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 ) {
index 6ad7ccd..b4e8e33 100644 (file)
@@ -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
index 9657e12..408805e 100644 (file)
@@ -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.'
                );
index e2f4dae..4dbccc6 100644 (file)
@@ -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 );
index 2a8645f..addcf07 100644 (file)
@@ -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;
                }
index 0d2fa0d..d9be9f2 100644 (file)
@@ -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' ) ) {
index 6a392bd..fd9d4c5 100644 (file)
@@ -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' );
                }
        }
 
index b368af8..4b9bc98 100644 (file)
@@ -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" ),
index 189e15a..9dd2c6a 100644 (file)
@@ -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'] ) );
index 182bc2c..1c9deb7 100644 (file)
@@ -211,7 +211,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
 
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
-                        array( 'specialpage-cantexecute' )
+                       array( 'specialpage-cantexecute' )
                ) );
        }
 
index f7a22bd..6acca67 100644 (file)
@@ -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';
                }
index 27ea6be..9b54ee5 100644 (file)
@@ -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';
                }
index 2fef68a..04897e8 100644 (file)
@@ -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'];
index 4d1edf1..2410f05 100644 (file)
@@ -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' );
                        }
index 03a0b79..50ea587 100644 (file)
@@ -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'] ) ) {
index 03c10d0..2627396 100644 (file)
@@ -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'
                );
        }
 
index 4ff7913..56717b6 100644 (file)
@@ -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 );
                }
        }
index 97e2fe2..7e865c1 100644 (file)
@@ -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;
        }
index b6d0d00..18b2733 100644 (file)
@@ -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;
index 03c1f9b..57fc7b9 100644 (file)
@@ -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 (
index 8796a48..57ffd4f 100644 (file)
@@ -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, '' );
        }
 
        /**
index 04c22f1..c5100b5 100644 (file)
@@ -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 ) {
index ed9f324..5195a83 100644 (file)
@@ -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 );
index 8d02cee..86b8e8a 100644 (file)
@@ -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 )
index 7e95fd3..9120c28 100644 (file)
@@ -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 ) {
index 064bc41..5e11076 100644 (file)
@@ -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
index e82c54b..cc7f133 100644 (file)
@@ -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;
                }
index 9b468a7..88b7500 100644 (file)
@@ -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 ) ) {
index 2a0c50f..d42a152 100644 (file)
@@ -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;
        }
 
index 22938aa..cb3376f 100644 (file)
@@ -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" );
index 46a3398..6ef5fcb 100644 (file)
@@ -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 = '<tr><td colspan="2" class="diff-lineno"><!--LINE ' . $xbeg . "--></td>\n" .
-                 '<td colspan="2" class="diff-lineno"><!--LINE ' . $ybeg . "--></td></tr>\n";
+                       '<td colspan="2" class="diff-lineno"><!--LINE ' . $ybeg . "--></td></tr>\n";
                return $r;
        }
 
index 97553e6..a3239a3 100644 (file)
@@ -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 ) {
index 8bf1ca9..5dd49d7 100644 (file)
@@ -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 ) {
index 8e05cfe..3857771 100644 (file)
@@ -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 );
        }
index 99a517e..9b3ffa7 100644 (file)
@@ -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 );
index 64624b8..b07e339 100644 (file)
@@ -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 );
index a622630..4eb30ee 100644 (file)
@@ -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 ) );
        }
 
        /**
index d91649c..65626cf 100644 (file)
@@ -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 . '.' .