fix some spacing
authorumherirrender <umherirrender_de.wp@web.de>
Sun, 3 Feb 2013 18:30:03 +0000 (19:30 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 4 Feb 2013 19:54:07 +0000 (19:54 +0000)
Change-Id: I93f0a87ba7129bc336083e7289247d3150feb606

25 files changed:
includes/cache/CacheDependency.php
includes/cache/HTMLFileCache.php
includes/cache/MessageCache.php
includes/content/AbstractContent.php
includes/content/ContentHandler.php
includes/content/WikitextContent.php
includes/logging/LogEventsList.php
includes/logging/LogFormatter.php
includes/logging/LogPage.php
includes/logging/LogPager.php
includes/profiler/Profiler.php
includes/profiler/ProfilerSimple.php
includes/profiler/ProfilerSimpleText.php
includes/profiler/ProfilerSimpleTrace.php
includes/profiler/ProfilerSimpleUDP.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/resourceloader/ResourceLoaderWikiModule.php
includes/revisiondelete/RevisionDelete.php
includes/search/SearchEngine.php
includes/search/SearchIBM_DB2.php
includes/search/SearchMySQL.php
includes/search/SearchOracle.php
includes/search/SearchPostgres.php
includes/search/SearchSqlite.php
includes/search/SearchUpdate.php

index 5cdc867..c67b655 100644 (file)
@@ -404,7 +404,7 @@ class GlobalDependency extends CacheDependency {
         * @return bool
         */
        function isExpired() {
-               if( !isset($GLOBALS[$this->name]) ) {
+               if( !isset( $GLOBALS[$this->name] ) ) {
                        return true;
                }
                return $GLOBALS[$this->name] != $this->value;
index fca071a..6476646 100644 (file)
@@ -168,10 +168,10 @@ class HTMLFileCache extends FileCacheBase {
                $now = wfTimestampNow();
                if ( $this->useGzip() ) {
                        $text = str_replace(
-                               '</html>', '<!-- Cached/compressed '.$now." -->\n</html>", $text );
+                               '</html>', '<!-- Cached/compressed ' . $now . " -->\n</html>", $text );
                } else {
                        $text = str_replace(
-                               '</html>', '<!-- Cached '.$now." -->\n</html>", $text );
+                               '</html>', '<!-- Cached ' . $now . " -->\n</html>", $text );
                }
 
                // Store text to FS...
index e2cf1b4..bd4ce22 100644 (file)
@@ -545,7 +545,7 @@ class MessageCache {
                        $serialized = serialize( $cache );
                        $hash = md5( $serialized );
                        $this->mMemc->set( wfMemcKey( 'messages', $code, 'hash' ), $hash, $this->mExpiry );
-                       if ($wgLocalMessageCacheSerialized) {
+                       if ( $wgLocalMessageCacheSerialized ) {
                                $this->saveToLocal( $serialized, $hash, $code );
                        } else {
                                $this->saveToScript( $cache, $hash, $code );
index 926dea7..7341602 100644 (file)
@@ -75,7 +75,7 @@ abstract class AbstractContent implements Content {
                if ( $modelId !== $this->model_id ) {
                        throw new MWException(
                                "Bad content model: " .
-                               "expected {$this->model_id}  " .
+                               "expected {$this->model_id} " .
                                "but got $modelId."
                        );
                }
index b493715..5e0447f 100644 (file)
@@ -1074,7 +1074,7 @@ abstract class ContentHandler {
 
                        wfRestoreWarnings();
 
-                       wfWarn( "Using obsolete hook $event via ContentHandler::runLegacyHooks()! Handlers: " . implode(', ', $handlerInfo), 2 );
+                       wfWarn( "Using obsolete hook $event via ContentHandler::runLegacyHooks()! Handlers: " . implode( ', ', $handlerInfo ), 2 );
                }
 
                // convert Content objects to text
index 8d778f5..89aac20 100644 (file)
@@ -241,7 +241,7 @@ class WikitextContent extends TextContent {
                        case 'any':
                                return true;
                        case 'comma':
-                               return strpos( $text,  ',' ) !== false;
+                               return strpos( $text, ',' ) !== false;
                        case 'link':
                                if ( $hasLinks === null ) { # not known, find out
                                        if ( !$title ) {
index 03d5276..d34bf6e 100644 (file)
@@ -74,7 +74,7 @@ class LogEventsList extends ContextSource {
        public function showHeader( $type ) {
                wfDeprecated( __METHOD__, '1.19' );
                // If only one log type is used, then show a special message...
-               $headerType = (count($type) == 1) ? $type[0] : '';
+               $headerType = (count( $type ) == 1) ? $type[0] : '';
                $out = $this->getOutput();
                if( LogPage::isLogType( $headerType ) ) {
                        $page = new LogPage( $headerType );
@@ -97,8 +97,8 @@ class LogEventsList extends ContextSource {
         * @param $filter: array
         * @param $tagFilter: array?
         */
-       public function showOptions( $types=array(), $user='', $page='', $pattern='', $year='',
-               $month = '', $filter = null, $tagFilter='' ) {
+       public function showOptions( $types=array(), $user = '', $page = '', $pattern = '', $year = '',
+               $month = '', $filter = null, $tagFilter = '' ) {
                global $wgScript, $wgMiserMode;
 
                $title = SpecialPage::getTitleFor( 'Log' );
@@ -117,7 +117,7 @@ class LogEventsList extends ContextSource {
                $html .= $this->getExtraInputs( $types ) . "\n";
 
                // Title pattern, if allowed
-               if (!$wgMiserMode) {
+               if ( !$wgMiserMode ) {
                        $html .= $this->getTitlePattern( $pattern ) . "\n";
                }
 
@@ -125,12 +125,12 @@ class LogEventsList extends ContextSource {
                $html .= Xml::tags( 'p', null, Xml::dateMenu( $year, $month ) );
 
                // Tag filter
-               if ($tagSelector) {
+               if ( $tagSelector ) {
                        $html .= Xml::tags( 'p', null, implode( '&#160;', $tagSelector ) );
                }
 
                // Filter links
-               if ($filter) {
+               if ( $filter ) {
                        $html .= Xml::tags( 'p', null, $this->getFilterLinks( $filter ) );
                }
 
@@ -162,7 +162,7 @@ class LogEventsList extends ContextSource {
                        $query = $this->getDefaultQuery();
                        $queryKey = "hide_{$type}_log";
 
-                       $hideVal = 1 - intval($val);
+                       $hideVal = 1 - intval( $val );
                        $query[$queryKey] = $hideVal;
 
                        $link = Linker::linkKnown(
@@ -176,7 +176,7 @@ class LogEventsList extends ContextSource {
                        $hiddens .= Html::hidden( "hide_{$type}_log", $val ) . "\n";
                }
                // Build links
-               return '<small>'.$this->getLanguage()->pipeList( $links ) . '</small>' . $hiddens;
+               return '<small>' . $this->getLanguage()->pipeList( $links ) . '</small>' . $hiddens;
        }
 
        private function getDefaultQuery() {
@@ -198,7 +198,7 @@ class LogEventsList extends ContextSource {
         * @return String: Formatted HTML
         */
        private function getTypeMenu( $queryTypes ) {
-               $queryType = count($queryTypes) == 1 ? $queryTypes[0] : '';
+               $queryType = count( $queryTypes ) == 1 ? $queryTypes[0] : '';
                $selector = $this->getTypeSelector();
                $selector->setDefault( $queryType );
                return $selector->getHtml();
@@ -212,7 +212,7 @@ class LogEventsList extends ContextSource {
        public function getTypeSelector() {
                $typesByName = array(); // Temporary array
                // First pass to load the log names
-               foreach(  LogPage::validTypes() as $type ) {
+               foreach( LogPage::validTypes() as $type ) {
                        $page = new LogPage( $type );
                        $restriction = $page->getRestriction();
                        if ( $this->getUser()->isAllowed( $restriction ) ) {
@@ -221,7 +221,7 @@ class LogEventsList extends ContextSource {
                }
 
                // Second pass to sort by name
-               asort($typesByName);
+               asort( $typesByName );
 
                // Always put "All public logs" on top
                $public = $typesByName[''];
@@ -273,10 +273,10 @@ class LogEventsList extends ContextSource {
        private function getExtraInputs( $types ) {
                $offender = $this->getRequest()->getVal( 'offender' );
                $user = User::newFromName( $offender, false );
-               if( !$user || ($user->getId() == 0 && !IP::isIPAddress($offender) ) ) {
+               if( !$user || ( $user->getId() == 0 && !IP::isIPAddress( $offender ) ) ) {
                        $offender = ''; // Blank field if invalid
                }
-               if( count($types) == 1 && $types[0] == 'suppress' ) {
+               if( count( $types ) == 1 && $types[0] == 'suppress' ) {
                        return Xml::inputLabel( $this->msg( 'revdelete-offender' )->text(), 'offender',
                                'mw-log-offender', 20, $offender );
                }
@@ -383,8 +383,8 @@ class LogEventsList extends ContextSource {
         * @param $right string
         * @return Boolean
         */
-       public static function typeAction( $row, $type, $action, $right='' ) {
-               $match = is_array($type) ?
+       public static function typeAction( $row, $type, $action, $right = '' ) {
+               $match = is_array( $type ) ?
                        in_array( $row->log_type, $type ) : $row->log_type == $type;
                if( $match ) {
                        $match = is_array( $action ) ?
@@ -468,13 +468,13 @@ class LogEventsList extends ContextSource {
         * @return Integer Number of total log items (not limited by $lim)
         */
        public static function showLogExtract(
-               &$out, $types=array(), $page='', $user='', $param = array()
+               &$out, $types=array(), $page = '', $user = '', $param = array()
        ) {
                $defaultParameters = array(
                        'lim' => 25,
                        'conds' => array(),
                        'showIfEmpty' => true,
-                       'msgKey' => array(''),
+                       'msgKey' => array( '' ),
                        'wrap' => "$1",
                        'flags' => 0
                );
@@ -520,8 +520,8 @@ class LogEventsList extends ContextSource {
                                }
                        }
                        $s .= $loglist->beginLogEventsList() .
-                                $logBody .
-                                $loglist->endLogEventsList();
+                               $logBody .
+                               $loglist->endLogEventsList();
                } else {
                        if ( $showIfEmpty ) {
                                $s = Html::rawElement( 'div', array( 'class' => 'mw-warning-logempty' ),
@@ -602,4 +602,4 @@ class LogEventsList extends ContextSource {
                }
                return false;
        }
- }
+}
index ce5b053..5ff0434 100644 (file)
@@ -198,12 +198,12 @@ class LogFormatter {
                        case 'move':
                                switch( $entry->getSubtype() ) {
                                        case 'move':
-                                               $movesource =  $parameters['4::target'];
+                                               $movesource = $parameters['4::target'];
                                                $text = wfMessage( '1movedto2' )
                                                        ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
                                                break;
                                        case 'move_redir':
-                                               $movesource =  $parameters['4::target'];
+                                               $movesource = $parameters['4::target'];
                                                $text = wfMessage( '1movedto2_redir' )
                                                        ->rawParams( $target, $movesource )->inContentLanguage()->escaped();
                                                break;
@@ -588,7 +588,7 @@ class LogFormatter {
                        return $this->msg( $message )->text();
                }
 
-               $content =  $this->msg( $message )->escaped();
+               $content = $this->msg( $message )->escaped();
                $attribs = array( 'class' => 'history-deleted' );
                return Html::rawElement( 'span', $attribs, $content );
        }
@@ -713,7 +713,7 @@ class LegacyLogFormatter extends LogFormatter {
 
                $performer = $this->getPerformerElement();
                if ( !$this->irctext ) {
-                       $action = $performer .  $this->msg( 'word-separator' )->text() . $action;
+                       $action = $performer . $this->msg( 'word-separator' )->text() . $action;
                }
 
                return $action;
@@ -913,7 +913,7 @@ class DeleteLogFormatter extends LogFormatter {
                                foreach ( $extra as $v ) {
                                        $changes[] = $this->msg( $v )->plain();
                                }
-                               $changeText =  $this->context->getLanguage()->listToText( $changes );
+                               $changeText = $this->context->getLanguage()->listToText( $changes );
 
 
                                $newParams = array_slice( $params, 0, 3 );
@@ -957,7 +957,7 @@ class DeleteLogFormatter extends LogFormatter {
                                $this->msg( $message )->escaped(),
                                array(),
                                array( 'target' => $this->entry->getTarget()->getPrefixedDBkey() )
-                        );
+                       );
                        return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
 
                case 'revision': // If an edit was hidden from a page give a review link to the history
index 5854e99..9778f27 100644 (file)
@@ -271,7 +271,7 @@ class LogPage {
                                                $params[2] = isset( $params[2] ) ?
                                                        self::formatBlockFlags( $params[2], $langObj ) : '';
                                        // Page protections
-                                       } elseif ( $type == 'protect' && count($params) == 3 ) {
+                                       } elseif ( $type == 'protect' && count( $params ) == 3 ) {
                                                // Restrictions and expiries
                                                if( $skin ) {
                                                        $details .= $wgLang->getDirMark() . htmlspecialchars( " {$params[1]}" );
index af62ce3..fad1058 100644 (file)
@@ -71,7 +71,7 @@ class LogPager extends ReverseChronologicalPager {
        public function getFilterParams() {
                global $wgFilterLogTypes;
                $filters = array();
-               if( count($this->types) ) {
+               if( count( $this->types ) ) {
                        return $filters;
                }
                foreach( $wgFilterLogTypes as $type => $default ) {
@@ -122,10 +122,10 @@ class LogPager extends ReverseChronologicalPager {
                if( $hideLogs !== false ) {
                        $this->mConds[] = $hideLogs;
                }
-               if( count($types) ) {
+               if( count( $types ) ) {
                        $this->mConds['log_type'] = $types;
                        // Set typeCGI; used in url param for paging
-                       if( count($types) == 1 ) $this->typeCGI = $types[0];
+                       if( count( $types ) == 1 ) $this->typeCGI = $types[0];
                }
        }
 
@@ -140,7 +140,7 @@ class LogPager extends ReverseChronologicalPager {
                        return false;
                }
                $usertitle = Title::makeTitleSafe( NS_USER, $name );
-               if( is_null($usertitle) ) {
+               if( is_null( $usertitle ) ) {
                        return false;
                }
                /* Fetch userid at first, if known, provides awesome query plan afterwards */
@@ -154,9 +154,9 @@ class LogPager extends ReverseChronologicalPager {
                        // Paranoia: avoid brute force searches (bug 17342)
                        $user = $this->getUser();
                        if( !$user->isAllowed( 'deletedhistory' ) ) {
-                               $this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::DELETED_USER) . ' = 0';
+                               $this->mConds[] = $this->mDb->bitAnd( 'log_deleted', LogPage::DELETED_USER ) . ' = 0';
                        } elseif( !$user->isAllowed( 'suppressrevision' ) ) {
-                               $this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::SUPPRESSED_USER) .
+                               $this->mConds[] = $this->mDb->bitAnd( 'log_deleted', LogPage::SUPPRESSED_USER ) .
                                        ' != ' . LogPage::SUPPRESSED_USER;
                        }
                        $this->performer = $usertitle->getText();
@@ -209,9 +209,9 @@ class LogPager extends ReverseChronologicalPager {
                // Paranoia: avoid brute force searches (bug 17342)
                $user = $this->getUser();
                if( !$user->isAllowed( 'deletedhistory' ) ) {
-                       $this->mConds[] = $db->bitAnd('log_deleted', LogPage::DELETED_ACTION) . ' = 0';
+                       $this->mConds[] = $db->bitAnd( 'log_deleted', LogPage::DELETED_ACTION) . ' = 0';
                } elseif( !$user->isAllowed( 'suppressrevision' ) ) {
-                       $this->mConds[] = $db->bitAnd('log_deleted', LogPage::SUPPRESSED_ACTION) .
+                       $this->mConds[] = $db->bitAnd( 'log_deleted', LogPage::SUPPRESSED_ACTION) .
                                ' != ' . LogPage::SUPPRESSED_ACTION;
                }
        }
@@ -251,10 +251,10 @@ class LogPager extends ReverseChronologicalPager {
                # avoids site-breaking filesorts.
                } elseif( $this->title || $this->pattern || $this->performer ) {
                        $index['logging'] = array( 'page_time', 'user_time' );
-                       if( count($this->types) == 1 ) {
+                       if( count( $this->types ) == 1 ) {
                                $index['logging'][] = 'log_user_type_time';
                        }
-               } elseif( count($this->types) == 1 ) {
+               } elseif( count( $this->types ) == 1 ) {
                        $index['logging'] = 'type_time';
                } else {
                        $index['logging'] = 'times';
index b30b031..1ead836 100644 (file)
@@ -178,10 +178,10 @@ class Profiler {
                        $this->debug( str_repeat( ' ', count( $this->mWorkStack ) - 1 ) . 'Exiting ' . $functionname . "\n" );
                }
 
-               $bit = array_pop($this->mWorkStack);
+               $bit = array_pop( $this->mWorkStack );
 
-               if (!$bit) {
-                       $this->debug("Profiling error, !\$bit: $functionname\n");
+               if ( !$bit ) {
+                       $this->debug( "Profiling error, !\$bit: $functionname\n" );
                } else {
                        //if( $wgDebugProfiling ) {
                                if( $functionname == 'close' ) {
@@ -293,9 +293,9 @@ class Profiler {
         * @return string
         */
        function getCallTreeLine( $entry ) {
-               list( $fname, $level, $start, /* $x */, $end = $entry;
+               list( $fname, $level, $start, /* $x */, $end ) = $entry;
                $delta = $end - $start;
-               $space = str_repeat(' ', $level);
+               $space = str_repeat( ' ', $level );
                # The ugly double sprintf is to work around a PHP bug,
                # which has been fixed in recent releases.
                return sprintf( "%10s %s %s\n", trim( sprintf( "%7.3f", $delta * 1000.0 ) ), $space, $fname );
@@ -386,7 +386,7 @@ class Profiler {
                $this->mMemory = array();
 
                # Estimate profiling overhead
-               $profileCount = count($this->mStack);
+               $profileCount = count( $this->mStack );
                self::calculateOverhead( $profileCount );
 
                # First, subtract the overhead!
@@ -441,8 +441,8 @@ class Profiler {
                        $this->mCollated[$fname] += $elapsed;
                        $this->mCalls[$fname]++;
                        $this->mMemory[$fname] += $memory;
-                       $this->mMin[$fname] = min($this->mMin[$fname], $elapsed);
-                       $this->mMax[$fname] = max($this->mMax[$fname], $elapsed);
+                       $this->mMin[$fname] = min( $this->mMin[$fname], $elapsed );
+                       $this->mMax[$fname] = max( $this->mMax[$fname], $elapsed );
                        $this->mOverhead[$fname] += $subcalls;
                }
 
@@ -499,10 +499,10 @@ class Profiler {
         * @return Integer
         * @private
         */
-       function calltreeCount($stack, $start) {
+       function calltreeCount( $stack, $start ) {
                $level = $stack[$start][1];
                $count = 0;
-               for ($i = $start -1; $i >= 0 && $stack[$i][1] > $level; $i --) {
+               for ( $i = $start -1; $i >= 0 && $stack[$i][1] > $level; $i-- ) {
                        $count ++;
                }
                return $count;
@@ -557,9 +557,9 @@ class Profiler {
 
                                $rc = $dbw->affectedRows();
                                if ( $rc == 0 ) {
-                                       $dbw->insert('profiling', array ('pf_name' => $name, 'pf_count' => $eventCount,
+                                       $dbw->insert( 'profiling', array ( 'pf_name' => $name, 'pf_count' => $eventCount,
                                                'pf_time' => $timeSum, 'pf_memory' => $memorySum, 'pf_server' => $pfhost ),
-                                               __METHOD__, array ('IGNORE'));
+                                               __METHOD__, array ( 'IGNORE' ) );
                                }
                                // When we upgrade to mysql 4.1, the insert+update
                                // can be merged into just a insert with this construct added:
index d1d1c5d..1322e47 100644 (file)
@@ -29,7 +29,7 @@
 class ProfilerSimple extends Profiler {
        var $mMinimumTime = 0;
 
-       var $zeroEntry = array('cpu'=> 0.0, 'cpu_sq' => 0.0, 'real' => 0.0, 'real_sq' => 0.0, 'count' => 0);
+       var $zeroEntry = array( 'cpu'=> 0.0, 'cpu_sq' => 0.0, 'real' => 0.0, 'real_sq' => 0.0, 'count' => 0 );
        var $errorEntry;
 
        public function isPersistent() {
@@ -57,33 +57,33 @@ class ProfilerSimple extends Profiler {
                $this->mMinimumTime = $min;
        }
 
-       function profileIn($functionname) {
+       function profileIn( $functionname ) {
                global $wgDebugFunctionEntry;
-               if ($wgDebugFunctionEntry) {
-                       $this->debug(str_repeat(' ', count($this->mWorkStack)).'Entering '.$functionname."\n");
+               if ( $wgDebugFunctionEntry ) {
+                       $this->debug( str_repeat( ' ', count( $this->mWorkStack ) ) . 'Entering ' . $functionname . "\n" );
                }
                $this->mWorkStack[] = array( $functionname, count( $this->mWorkStack ), $this->getTime(), $this->getTime( 'cpu' ) );
        }
 
-       function profileOut($functionname) {
+       function profileOut( $functionname ) {
                global $wgDebugFunctionEntry;
 
-               if ($wgDebugFunctionEntry) {
-                       $this->debug(str_repeat(' ', count($this->mWorkStack) - 1).'Exiting '.$functionname."\n");
+               if ( $wgDebugFunctionEntry ) {
+                       $this->debug( str_repeat( ' ', count( $this->mWorkStack ) - 1 ) . 'Exiting ' . $functionname . "\n" );
                }
 
-               list($ofname, /* $ocount */ ,$ortime,$octime) = array_pop($this->mWorkStack);
+               list( $ofname, /* $ocount */, $ortime, $octime ) = array_pop( $this->mWorkStack );
 
-               if (!$ofname) {
-                       $this->debug("Profiling error: $functionname\n");
+               if ( !$ofname ) {
+                       $this->debug( "Profiling error: $functionname\n" );
                } else {
-                       if ($functionname == 'close') {
+                       if ( $functionname == 'close' ) {
                                $message = "Profile section ended by close(): {$ofname}";
                                $functionname = $ofname;
                                $this->debug( "$message\n" );
                                $this->mCollated[$message] = $this->errorEntry;
                        }
-                       elseif ($ofname != $functionname) {
+                       elseif ( $ofname != $functionname ) {
                                $message = "Profiling error: in({$ofname}), out($functionname)";
                                $this->debug( "$message\n" );
                                $this->mCollated[$message] = $this->errorEntry;
@@ -91,7 +91,7 @@ class ProfilerSimple extends Profiler {
                        $entry =& $this->mCollated[$functionname];
                        $elapsedcpu = $this->getTime( 'cpu' ) - $octime;
                        $elapsedreal = $this->getTime() - $ortime;
-                       if (!is_array($entry)) {
+                       if ( !is_array( $entry ) ) {
                                $entry = $this->zeroEntry;
                                $this->mCollated[$functionname] =& $entry;
                        }
index e62622f..847e34f 100644 (file)
@@ -48,8 +48,8 @@ class ProfilerSimpleText extends ProfilerSimple {
                        $totalReal = isset( $this->mCollated['-total'] )
                                ? $this->mCollated['-total']['real']
                                : 0; // profiling mismatch error?
-                       uasort( $this->mCollated, array('self','sort') );
-                       array_walk( $this->mCollated, array('self','format'), $totalReal );
+                       uasort( $this->mCollated, array( 'self', 'sort' ) );
+                       array_walk( $this->mCollated, array( 'self', 'format' ), $totalReal );
                        if ( php_sapi_name() === 'cli' ) {
                                print "<!--\n".self::$out."\n-->\n";
                        } elseif ( $this->getContentType() === 'text/html' ) {
index 017e135..f766a39 100644 (file)
@@ -32,18 +32,18 @@ class ProfilerSimpleTrace extends ProfilerSimple {
 
        function profileIn( $functionname ) {
                parent::profileIn( $functionname );
-               $this->trace .= "         " . sprintf("%6.1f",$this->memoryDiff()) .
-                               str_repeat( " ", count($this->mWorkStack)) . " > " . $functionname . "\n";
+               $this->trace .= "         " . sprintf( "%6.1f", $this->memoryDiff() ) .
+                               str_repeat( " ", count( $this->mWorkStack ) ) . " > " . $functionname . "\n";
        }
 
-       function profileOut($functionname) {
+       function profileOut( $functionname ) {
                global $wgDebugFunctionEntry;
 
                if ( $wgDebugFunctionEntry ) {
-                       $this->debug(str_repeat(' ', count($this->mWorkStack) - 1).'Exiting '.$functionname."\n");
+                       $this->debug( str_repeat( ' ', count( $this->mWorkStack ) - 1 ) . 'Exiting ' . $functionname . "\n" );
                }
 
-               list( $ofname, /* $ocount */ , $ortime ) = array_pop( $this->mWorkStack );
+               list( $ofname, /* $ocount */, $ortime ) = array_pop( $this->mWorkStack );
 
                if ( !$ofname ) {
                        $this->trace .= "Profiling error: $functionname\n";
@@ -58,7 +58,7 @@ class ProfilerSimpleTrace extends ProfilerSimple {
                        }
                        $elapsedreal = $this->getTime() - $ortime;
                        $this->trace .= sprintf( "%03.6f %6.1f", $elapsedreal, $this->memoryDiff() ) .
-                                       str_repeat(" ", count( $this->mWorkStack ) + 1 ) . " < " . $functionname . "\n";
+                                       str_repeat( " ", count( $this->mWorkStack ) + 1 ) . " < " . $functionname . "\n";
                }
        }
 
index a95ccb0..abefa81 100644 (file)
@@ -50,7 +50,7 @@ class ProfilerSimpleUDP extends ProfilerSimple {
                $plength = 0;
                $packet = "";
                foreach ( $this->mCollated as $entry => $pfdata ) {
-                       if( !isset($pfdata['count'])
+                       if( !isset( $pfdata['count'] )
                                || !isset( $pfdata['cpu'] )
                                || !isset( $pfdata['cpu_sq'] )
                                || !isset( $pfdata['real'] )
index fad0027..9904107 100644 (file)
@@ -441,9 +441,9 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                        return $this->modifiedTime[$context->getHash()] = 1;
                }
 
-               wfProfileIn( __METHOD__.'-filemtime' );
+               wfProfileIn( __METHOD__ . '-filemtime' );
                $filesMtime = max( array_map( array( __CLASS__, 'safeFilemtime' ), $files ) );
-               wfProfileOut( __METHOD__.'-filemtime' );
+               wfProfileOut( __METHOD__ . '-filemtime' );
                $this->modifiedTime[$context->getHash()] = max(
                        $filesMtime,
                        $this->getMsgBlobMtime( $context->getLanguage() ) );
@@ -571,7 +571,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                foreach ( array_unique( $scripts ) as $fileName ) {
                        $localPath = $this->getLocalPath( $fileName );
                        if ( !file_exists( $localPath ) ) {
-                               throw new MWException( __METHOD__.": script file not found: \"$localPath\"" );
+                               throw new MWException( __METHOD__ . ": script file not found: \"$localPath\"" );
                        }
                        $contents = file_get_contents( $localPath );
                        if ( $wgResourceLoaderValidateStaticJS ) {
@@ -628,7 +628,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
        protected function readStyleFile( $path, $flip ) {
                $localPath = $this->getLocalPath( $path );
                if ( !file_exists( $localPath ) ) {
-                       $msg = __METHOD__.": style file not found: \"$localPath\"";
+                       $msg = __METHOD__ . ": style file not found: \"$localPath\"";
                        wfDebugLog( 'resourceloader', $msg );
                        throw new MWException( $msg );
                }
index b85da16..4ea9f4e 100644 (file)
@@ -147,7 +147,7 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule {
                                continue;
                        }
                        $title = Title::newFromText( $titleText );
-                       if ( !$title || $title->isRedirect()  ) {
+                       if ( !$title || $title->isRedirect() ) {
                                continue;
                        }
                        $media = isset( $options['media'] ) ? $options['media'] : 'all';
index 6ceadff..5340cb9 100644 (file)
@@ -424,7 +424,7 @@ class RevDel_ArchivedRevisionItem extends RevDel_ArchiveItem {
                $dbw->update( 'archive',
                        array( 'ar_deleted' => $bits ),
                        array( 'ar_rev_id' => $this->row->ar_rev_id,
-                                  'ar_deleted' => $this->getBits()
+                               'ar_deleted' => $this->getBits()
                        ),
                        __METHOD__ );
                return (bool)$dbw->affectedRows();
@@ -899,7 +899,7 @@ class RevDel_LogItem extends RevDel_Item {
                $action = $formatter->getActionText();
                // Comment
                $comment = $this->list->getLanguage()->getDirMark() . Linker::commentBlock( $this->row->log_comment );
-               if( LogEventsList::isDeleted($this->row,LogPage::DELETED_COMMENT) ) {
+               if( LogEventsList::isDeleted( $this->row, LogPage::DELETED_COMMENT ) ) {
                        $comment = '<span class="history-deleted">' . $comment . '</span>';
                }
 
index e10b642..5e5755c 100644 (file)
@@ -45,7 +45,7 @@ class SearchEngine {
         */
        protected $db;
 
-       function __construct($db = null) {
+       function __construct( $db = null ) {
                if ( $db ) {
                        $this->db = $db;
                } else {
@@ -1142,8 +1142,8 @@ class SearchHighlighter {
                                // add more lines
                                $add = $index + 1;
                                while ( $len < $targetchars - 20
-                                          && array_key_exists( $add, $all )
-                                          && !array_key_exists( $add, $snippets ) ) {
+                                               && array_key_exists( $add, $all )
+                                               && !array_key_exists( $add, $snippets ) ) {
                                        $offsets[$add] = 0;
                                        $tt = "\n" . $this->extract( $all[$add], 0, $targetchars - $len, $offsets[$add] );
                                        $extended[$add] = $tt;
@@ -1153,7 +1153,7 @@ class SearchHighlighter {
                        }
                }
 
-               // $snippets = array_map('htmlspecialchars', $extended);
+               // $snippets = array_map( 'htmlspecialchars', $extended );
                $snippets = $extended;
                $last = - 1;
                $extract = '';
@@ -1332,12 +1332,12 @@ class SearchHighlighter {
                $fname = __METHOD__;
                wfProfileIn( $fname );
 
-               // $text = preg_replace("/'{2,5}/", "", $text);
-               // $text = preg_replace("/\[[a-z]+:\/\/[^ ]+ ([^]]+)\]/", "\\2", $text);
-               // $text = preg_replace("/\[\[([^]|]+)\]\]/", "\\1", $text);
-               // $text = preg_replace("/\[\[([^]]+\|)?([^|]]+)\]\]/", "\\2", $text);
-               // $text = preg_replace("/\\{\\|(.*?)\\|\\}/", "", $text);
-               // $text = preg_replace("/\\[\\[[A-Za-z_-]+:([^|]+?)\\]\\]/", "", $text);
+               // $text = preg_replace( "/'{2,5}/", "", $text );
+               // $text = preg_replace( "/\[[a-z]+:\/\/[^ ]+ ([^]]+)\]/", "\\2", $text );
+               // $text = preg_replace( "/\[\[([^]|]+)\]\]/", "\\1", $text );
+               // $text = preg_replace( "/\[\[([^]]+\|)?([^|]]+)\]\]/", "\\2", $text );
+               // $text = preg_replace( "/\\{\\|(.*?)\\|\\}/", "", $text );
+               // $text = preg_replace( "/\\[\\[[A-Za-z_-]+:([^|]+?)\\]\\]/", "", $text );
                $text = preg_replace( "/\\{\\{([^|]+?)\\}\\}/", "", $text );
                $text = preg_replace( "/\\{\\{([^|]+\\|)(.*?)\\}\\}/", "\\2", $text );
                $text = preg_replace( "/\\[\\[([^|]+?)\\]\\]/", "\\1", $text );
index 368d900..ebc9d5a 100644 (file)
@@ -34,7 +34,7 @@ class SearchIBM_DB2 extends SearchEngine {
         * Creates an instance of this class
         * @param $db DatabaseIbm_db2: database object
         */
-       function __construct($db) {
+       function __construct( $db ) {
                parent::__construct( $db );
        }
 
@@ -45,8 +45,8 @@ class SearchIBM_DB2 extends SearchEngine {
         * @return SqlSearchResultSet
         */
        function searchText( $term ) {
-               $resultSet = $this->db->resultObject($this->db->query($this->getQuery($this->filter($term), true)));
-               return new SqlSearchResultSet($resultSet, $this->searchTerms);
+               $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), true ) ) );
+               return new SqlSearchResultSet( $resultSet, $this->searchTerms );
        }
 
        /**
@@ -55,9 +55,9 @@ class SearchIBM_DB2 extends SearchEngine {
         * @param $term String: taw search term
         * @return SqlSearchResultSet
         */
-       function searchTitle($term) {
-               $resultSet = $this->db->resultObject($this->db->query($this->getQuery($this->filter($term), false)));
-               return new SqlSearchResultSet($resultSet, $this->searchTerms);
+       function searchTitle( $term ) {
+               $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), false ) ) );
+               return new SqlSearchResultSet( $resultSet, $this->searchTerms );
        }
 
 
@@ -66,7 +66,7 @@ class SearchIBM_DB2 extends SearchEngine {
         * @return String
         */
        function queryRedirect() {
-               if ($this->showRedirects) {
+               if ( $this->showRedirects ) {
                        return '';
                } else {
                        return 'AND page_is_redirect=0';
@@ -78,10 +78,10 @@ class SearchIBM_DB2 extends SearchEngine {
         * @return String
         */
        function queryNamespaces() {
-               if( is_null($this->namespaces) )
+               if( is_null( $this->namespaces ) )
                        return '';
-               $namespaces = implode(',', $this->namespaces);
-               if ($namespaces == '') {
+               $namespaces = implode( ',', $this->namespaces );
+               if ( $namespaces == '' ) {
                        $namespaces = '0';
                }
                return 'AND page_namespace IN (' . $namespaces . ')';
@@ -92,7 +92,7 @@ class SearchIBM_DB2 extends SearchEngine {
         * @return String
         */
        function queryLimit( $sql ) {
-               return $this->db->limitResult($sql, $this->limit, $this->offset);
+               return $this->db->limitResult( $sql, $this->limit, $this->offset );
        }
 
        /**
@@ -100,7 +100,7 @@ class SearchIBM_DB2 extends SearchEngine {
         * subclasses may define this though
         * @return String
         */
-       function queryRanking($filteredTerm, $fulltext) {
+       function queryRanking( $filteredTerm, $fulltext ) {
                // requires Net Search Extender or equivalent
                // return ' ORDER BY score(1)';
                return '';
@@ -114,10 +114,10 @@ class SearchIBM_DB2 extends SearchEngine {
         * @return String
         */
        function getQuery( $filteredTerm, $fulltext ) {
-               return $this->queryLimit($this->queryMain($filteredTerm, $fulltext) . ' ' .
+               return $this->queryLimit( $this->queryMain( $filteredTerm, $fulltext ) . ' ' .
                        $this->queryRedirect() . ' ' .
                        $this->queryNamespaces() . ' ' .
-                       $this->queryRanking( $filteredTerm, $fulltext ) . ' ');
+                       $this->queryRanking( $filteredTerm, $fulltext ) . ' ' );
        }
 
 
@@ -126,7 +126,7 @@ class SearchIBM_DB2 extends SearchEngine {
         * @param $fulltext Boolean
         * @return String
         */
-       function getIndexField($fulltext) {
+       function getIndexField( $fulltext ) {
                return $fulltext ? 'si_text' : 'si_title';
        }
 
@@ -138,9 +138,9 @@ class SearchIBM_DB2 extends SearchEngine {
         * @return String
         */
        function queryMain( $filteredTerm, $fulltext ) {
-               $match = $this->parseQuery($filteredTerm, $fulltext);
-               $page        = $this->db->tableName('page');
-               $searchindex = $this->db->tableName('searchindex');
+               $match = $this->parseQuery( $filteredTerm, $fulltext );
+               $page = $this->db->tableName( 'page' );
+               $searchindex = $this->db->tableName( 'searchindex' );
                return 'SELECT page_id, page_namespace, page_title ' .
                        "FROM $page,$searchindex " .
                        'WHERE page_id=si_page AND ' . $match;
@@ -149,7 +149,7 @@ class SearchIBM_DB2 extends SearchEngine {
        /** @todo document
         * @return string
         */
-       function parseQuery($filteredText, $fulltext) {
+       function parseQuery( $filteredText, $fulltext ) {
                global $wgContLang;
                $lc = SearchEngine::legalSearchChars();
                $this->searchTerms = array();
@@ -158,9 +158,9 @@ class SearchIBM_DB2 extends SearchEngine {
                $m = array();
                $q = array();
 
-               if (preg_match_all('/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
-                         $filteredText, $m, PREG_SET_ORDER)) {
-                       foreach($m as $terms) {
+               if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
+                               $filteredText, $m, PREG_SET_ORDER ) ) {
+                       foreach( $m as $terms ) {
 
                                // Search terms in all variant forms, only
                                // apply on wiki with LanguageConverter
@@ -173,19 +173,19 @@ class SearchIBM_DB2 extends SearchEngine {
                                else
                                        $q[] = $terms[1] . $wgContLang->normalizeForSearch( $terms[2] );
 
-                               if (!empty($terms[3])) {
+                               if ( !empty( $terms[3] ) ) {
                                        $regexp = preg_quote( $terms[3], '/' );
-                                       if ($terms[4])
+                                       if ( $terms[4] )
                                                $regexp .= "[0-9A-Za-z_]+";
                                } else {
-                                       $regexp = preg_quote(str_replace('"', '', $terms[2]), '/');
+                                       $regexp = preg_quote(str_replace( '"', '', $terms[2]), '/' );
                                }
                                $this->searchTerms[] = $regexp;
                        }
                }
 
-               $searchon = $this->db->strencode(join(',', $q));
-               $field = $this->getIndexField($fulltext);
+               $searchon = $this->db->strencode( join( ',', $q ) );
+               $field = $this->getIndexField( $fulltext );
 
                // requires Net Search Extender or equivalent
                //return " CONTAINS($field, '$searchon') > 0 ";
@@ -201,18 +201,18 @@ class SearchIBM_DB2 extends SearchEngine {
         * @param $title String
         * @param $text String
         */
-       function update($id, $title, $text) {
-               $dbw = wfGetDB(DB_MASTER);
-               $dbw->replace('searchindex',
-                       array('si_page'),
+       function update( $id, $title, $text ) {
+               $dbw = wfGetDB( DB_MASTER );
+               $dbw->replace( 'searchindex',
+                       array( 'si_page' ),
                        array(
                                'si_page' => $id,
                                'si_title' => $title,
                                'si_text' => $text
                        ), 'SearchIBM_DB2::update' );
                // ?
-               //$dbw->query("CALL ctx_ddl.sync_index('si_text_idx')");
-               //$dbw->query("CALL ctx_ddl.sync_index('si_title_idx')");
+               //$dbw->query( "CALL ctx_ddl.sync_index('si_text_idx')" );
+               //$dbw->query( "CALL ctx_ddl.sync_index('si_title_idx')" );
        }
 
        /**
@@ -222,13 +222,13 @@ class SearchIBM_DB2 extends SearchEngine {
         * @param $id Integer
         * @param $title String
         */
-       function updateTitle($id, $title) {
-               $dbw = wfGetDB(DB_MASTER);
+       function updateTitle( $id, $title ) {
+               $dbw = wfGetDB( DB_MASTER );
 
-               $dbw->update('searchindex',
-                       array('si_title' => $title),
-                       array('si_page'  => $id),
+               $dbw->update( 'searchindex',
+                       array( 'si_title' => $title ),
+                       array( 'si_page'  => $id ),
                        'SearchIBM_DB2::updateTitle',
-                       array());
+                       array() );
        }
 }
index 5cee03e..a76662b 100644 (file)
@@ -58,7 +58,7 @@ class SearchMySQL extends SearchEngine {
                # @todo FIXME: This doesn't handle parenthetical expressions.
                $m = array();
                if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
-                         $filteredText, $m, PREG_SET_ORDER ) ) {
+                               $filteredText, $m, PREG_SET_ORDER ) ) {
                        foreach( $m as $bits ) {
                                @list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits;
 
@@ -221,7 +221,7 @@ class SearchMySQL extends SearchEngine {
         */
        protected function queryFeatures( &$query ) {
                foreach ( $this->features as $feature => $value ) {
-                       if ( $feature ===  'list-redirects' && !$value ) {
+                       if ( $feature === 'list-redirects' && !$value ) {
                                $query['conds']['page_is_redirect'] = 0;
                        } elseif( $feature === 'title-suffix-filter' && $value ) {
                                $query['conds'][] = 'page_title' . $this->db->buildLike( $this->db->anyString(), $value );
index 29070e1..009502b 100644 (file)
@@ -61,7 +61,7 @@ class SearchOracle extends SearchEngine {
         * Creates an instance of this class
         * @param $db DatabasePostgres: database object
         */
-       function __construct($db) {
+       function __construct( $db ) {
                parent::__construct( $db );
        }
 
@@ -72,11 +72,11 @@ class SearchOracle extends SearchEngine {
         * @return SqlSearchResultSet
         */
        function searchText( $term ) {
-               if ($term == '')
-                       return new SqlSearchResultSet(false, '');
+               if ( $term == '' )
+                       return new SqlSearchResultSet( false, '' );
 
-               $resultSet = $this->db->resultObject($this->db->query($this->getQuery($this->filter($term), true)));
-               return new SqlSearchResultSet($resultSet, $this->searchTerms);
+               $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), true ) ) );
+               return new SqlSearchResultSet( $resultSet, $this->searchTerms );
        }
 
        /**
@@ -85,12 +85,12 @@ class SearchOracle extends SearchEngine {
         * @param $term String: raw search term
         * @return SqlSearchResultSet
         */
-       function searchTitle($term) {
-               if ($term == '')
-                       return new SqlSearchResultSet(false, '');
+       function searchTitle( $term ) {
+               if ( $term == '' )
+                       return new SqlSearchResultSet( false, '' );
 
-               $resultSet = $this->db->resultObject($this->db->query($this->getQuery($this->filter($term), false)));
-               return new MySQLSearchResultSet($resultSet, $this->searchTerms);
+               $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), false ) ) );
+               return new MySQLSearchResultSet( $resultSet, $this->searchTerms );
        }
 
 
@@ -99,7 +99,7 @@ class SearchOracle extends SearchEngine {
         * @return String
         */
        function queryRedirect() {
-               if ($this->showRedirects) {
+               if ( $this->showRedirects ) {
                        return '';
                } else {
                        return 'AND page_is_redirect=0';
@@ -111,7 +111,7 @@ class SearchOracle extends SearchEngine {
         * @return String
         */
        function queryNamespaces() {
-               if( is_null($this->namespaces) )
+               if( is_null( $this->namespaces ) )
                        return '';
                if ( !count( $this->namespaces ) ) {
                        $namespaces = '0';
@@ -129,7 +129,7 @@ class SearchOracle extends SearchEngine {
         * @return String
         */
        function queryLimit( $sql ) {
-               return $this->db->limitResult($sql, $this->limit, $this->offset);
+               return $this->db->limitResult( $sql, $this->limit, $this->offset );
        }
 
        /**
@@ -150,10 +150,10 @@ class SearchOracle extends SearchEngine {
         * @return String
         */
        function getQuery( $filteredTerm, $fulltext ) {
-               return $this->queryLimit($this->queryMain($filteredTerm, $fulltext) . ' ' .
+               return $this->queryLimit( $this->queryMain( $filteredTerm, $fulltext ) . ' ' .
                        $this->queryRedirect() . ' ' .
                        $this->queryNamespaces() . ' ' .
-                       $this->queryRanking( $filteredTerm, $fulltext ) . ' ');
+                       $this->queryRanking( $filteredTerm, $fulltext ) . ' ' );
        }
 
 
@@ -162,7 +162,7 @@ class SearchOracle extends SearchEngine {
         * @param $fulltext Boolean
         * @return String
         */
-       function getIndexField($fulltext) {
+       function getIndexField( $fulltext ) {
                return $fulltext ? 'si_text' : 'si_title';
        }
 
@@ -174,9 +174,9 @@ class SearchOracle extends SearchEngine {
         * @return String
         */
        function queryMain( $filteredTerm, $fulltext ) {
-               $match = $this->parseQuery($filteredTerm, $fulltext);
-               $page        = $this->db->tableName('page');
-               $searchindex = $this->db->tableName('searchindex');
+               $match = $this->parseQuery( $filteredTerm, $fulltext );
+               $page = $this->db->tableName( 'page' );
+               $searchindex = $this->db->tableName( 'searchindex' );
                return 'SELECT page_id, page_namespace, page_title ' .
                        "FROM $page,$searchindex " .
                        'WHERE page_id=si_page AND ' . $match;
@@ -187,7 +187,7 @@ class SearchOracle extends SearchEngine {
         * as part of a WHERE clause
         * @return string
         */
-       function parseQuery($filteredText, $fulltext) {
+       function parseQuery( $filteredText, $fulltext ) {
                global $wgContLang;
                $lc = SearchEngine::legalSearchChars();
                $this->searchTerms = array();
@@ -195,9 +195,9 @@ class SearchOracle extends SearchEngine {
                # @todo FIXME: This doesn't handle parenthetical expressions.
                $m = array();
                $searchon = '';
-               if (preg_match_all('/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
-                         $filteredText, $m, PREG_SET_ORDER)) {
-                       foreach($m as $terms) {
+               if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
+                               $filteredText, $m, PREG_SET_ORDER ) ) {
+                       foreach( $m as $terms ) {
                                // Search terms in all variant forms, only
                                // apply on wiki with LanguageConverter
                                $temp_terms = $wgContLang->autoConvertToAllVariants( $terms[2] );
@@ -210,27 +210,27 @@ class SearchOracle extends SearchEngine {
                                else {
                                        $searchon .= ($terms[1] == '-' ? ' ~' : ' & ') . $this->escapeTerm( $terms[2] );
                                }
-                               if (!empty($terms[3])) {
+                               if ( !empty( $terms[3] ) ) {
                                        $regexp = preg_quote( $terms[3], '/' );
-                                       if ($terms[4])
+                                       if ( $terms[4] )
                                                $regexp .= "[0-9A-Za-z_]+";
                                } else {
-                                       $regexp = preg_quote(str_replace('"', '', $terms[2]), '/');
+                                       $regexp = preg_quote( str_replace( '"', '', $terms[2] ), '/' );
                                }
                                $this->searchTerms[] = $regexp;
                        }
                }
 
 
-               $searchon = $this->db->addQuotes(ltrim($searchon, ' &'));
-               $field = $this->getIndexField($fulltext);
+               $searchon = $this->db->addQuotes( ltrim( $searchon, ' &' ) );
+               $field = $this->getIndexField( $fulltext );
                return " CONTAINS($field, $searchon, 1) > 0 ";
        }
 
-       private function escapeTerm($t) {
+       private function escapeTerm( $t ) {
                global $wgContLang;
-               $t = $wgContLang->normalizeForSearch($t);
-               $t = isset($this->reservedWords[strtoupper($t)]) ? '{'.$t.'}' : $t;
+               $t = $wgContLang->normalizeForSearch( $t );
+               $t = isset( $this->reservedWords[strtoupper( $t )] ) ? '{'.$t.'}' : $t;
                $t = preg_replace('/^"(.*)"$/', '($1)', $t);
                $t = preg_replace('/([-&|])/', '\\\\$1', $t);
                return $t;
@@ -243,10 +243,10 @@ class SearchOracle extends SearchEngine {
         * @param $title String
         * @param $text String
         */
-       function update($id, $title, $text) {
-               $dbw = wfGetDB(DB_MASTER);
-               $dbw->replace('searchindex',
-                       array('si_page'),
+       function update( $id, $title, $text ) {
+               $dbw = wfGetDB( DB_MASTER );
+               $dbw->replace( 'searchindex',
+                       array( 'si_page' ),
                        array(
                                'si_page' => $id,
                                'si_title' => $title,
@@ -271,14 +271,14 @@ class SearchOracle extends SearchEngine {
         * @param $id Integer
         * @param $title String
         */
-       function updateTitle($id, $title) {
-               $dbw = wfGetDB(DB_MASTER);
+       function updateTitle( $id, $title ) {
+               $dbw = wfGetDB( DB_MASTER );
 
-               $dbw->update('searchindex',
-                       array('si_title' => $title),
-                       array('si_page'  => $id),
+               $dbw->update( 'searchindex',
+                       array( 'si_title' => $title ),
+                       array( 'si_page'  => $id ),
                        'SearchOracle::updateTitle',
-                       array());
+                       array() );
        }
 
 
index 9c89c3d..727cc16 100644 (file)
@@ -66,8 +66,8 @@ class SearchPostgres extends SearchEngine {
                $q = $this->searchQuery( $term, 'textvector', 'old_text' );
                $olderror = error_reporting(E_ERROR);
                $resultSet = $this->db->resultObject( $this->db->query( $q, 'SearchPostgres', true ) );
-               error_reporting($olderror);
-               if (!$resultSet) {
+               error_reporting( $olderror );
+               if ( !$resultSet ) {
                        return new SearchResultTooMany();
                }
                return new PostgresSearchResultSet( $resultSet, $this->searchTerms );
@@ -99,16 +99,16 @@ class SearchPostgres extends SearchEngine {
                $m = array();
                if( preg_match_all('/([-!]?)(\S+)\s*/', $term, $m, PREG_SET_ORDER ) ) {
                        foreach( $m as $terms ) {
-                               if (strlen($terms[1])) {
+                               if ( strlen( $terms[1] ) ) {
                                        $searchstring .= ' & !';
                                }
-                               if (strtolower($terms[2]) === 'and') {
+                               if ( strtolower( $terms[2] ) === 'and' ) {
                                        $searchstring .= ' & ';
                                }
-                               elseif (strtolower($terms[2]) === 'or' or $terms[2] === '|') {
+                               elseif ( strtolower( $terms[2] ) === 'or' or $terms[2] === '|' ) {
                                        $searchstring .= ' | ';
                                }
-                               elseif (strtolower($terms[2]) === 'not') {
+                               elseif ( strtolower( $terms[2] ) === 'not' ) {
                                        $searchstring .= ' & !';
                                }
                                else {
@@ -133,7 +133,7 @@ class SearchPostgres extends SearchEngine {
                $searchstring = preg_replace('/^[\'"](.*)[\'"]$/', "$1", $searchstring);
 
                ## Quote the whole thing
-               $searchstring = $this->db->addQuotes($searchstring);
+               $searchstring = $this->db->addQuotes( $searchstring );
 
                wfDebug( "parseQuery returned: $searchstring \n" );
 
@@ -154,15 +154,15 @@ class SearchPostgres extends SearchEngine {
 
                ## We need a separate query here so gin does not complain about empty searches
                $SQL = "SELECT to_tsquery($searchstring)";
-               $res = $this->db->query($SQL);
-               if (!$res) {
+               $res = $this->db->query( $SQL );
+               if ( !$res ) {
                        ## TODO: Better output (example to catch: one 'two)
-                       die ("Sorry, that was not a valid search string. Please go back and try again");
+                       die( "Sorry, that was not a valid search string. Please go back and try again" );
                }
                $top = $res->fetchRow();
                $top = $top[0];
 
-               if ($top === "") { ## e.g. if only stopwords are used XXX return something better
+               if ( $top === "" ) { ## e.g. if only stopwords are used XXX return something better
                        $query = "SELECT page_id, page_namespace, page_title, 0 AS score ".
                                "FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " .
                                "AND r.rev_text_id = c.old_id AND 1=0";
@@ -182,7 +182,7 @@ class SearchPostgres extends SearchEngine {
                }
 
                ## Redirects
-               if (! $this->showRedirects)
+               if ( !$this->showRedirects )
                        $query .= ' AND page_is_redirect = 0';
 
                ## Namespaces - defaults to 0
@@ -226,7 +226,7 @@ class SearchPostgres extends SearchEngine {
  */
 class PostgresSearchResult extends SearchResult {
        function __construct( $row ) {
-               parent::__construct($row);
+               parent::__construct( $row );
                $this->score = $row->score;
        }
        function getScore() {
index e52e4fe..f91399a 100644 (file)
@@ -62,7 +62,7 @@ class SearchSqlite extends SearchEngine {
 
                $m = array();
                if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
-                         $filteredText, $m, PREG_SET_ORDER ) ) {
+                               $filteredText, $m, PREG_SET_ORDER ) ) {
                        foreach( $m as $bits ) {
                                @list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits;
 
@@ -214,7 +214,7 @@ class SearchSqlite extends SearchEngine {
         * @return String
         */
        function queryNamespaces() {
-               if( is_null($this->namespaces) )
+               if( is_null( $this->namespaces ) )
                        return '';  # search all
                if ( !count( $this->namespaces ) ) {
                        $namespaces = '0';
@@ -266,7 +266,7 @@ class SearchSqlite extends SearchEngine {
         */
        function queryMain( $filteredTerm, $fulltext ) {
                $match = $this->parseQuery( $filteredTerm, $fulltext );
-               $page        = $this->db->tableName( 'page' );
+               $page = $this->db->tableName( 'page' );
                $searchindex = $this->db->tableName( 'searchindex' );
                return "SELECT $searchindex.rowid, page_namespace, page_title " .
                        "FROM $page,$searchindex " .
@@ -317,7 +317,7 @@ class SearchSqlite extends SearchEngine {
         * @param $id Integer
         * @param $title String
         */
-    function updateTitle( $id, $title ) {
+       function updateTitle( $id, $title ) {
                if ( !$this->fulltextSearchSupported() ) {
                        return;
                }
index 389c317..eabcda3 100644 (file)
@@ -79,7 +79,7 @@ class SearchUpdate implements DeferrableUpdate {
                $text = preg_replace( "/<\\/?\\s*[A-Za-z][^>]*?>/",
                        ' ', $wgContLang->lc( " " . $text . " " ) ); # Strip HTML markup
                $text = preg_replace( "/(^|\\n)==\\s*([^\\n]+)\\s*==(\\s)/sD",
-                 "\\1\\2 \\2 \\2\\3", $text ); # Emphasize headings
+                       "\\1\\2 \\2 \\2\\3", $text ); # Emphasize headings
 
                # Strip external URLs
                $uc = "A-Za-z0-9_\\/:.,~%\\-+&;#?!=()@\\x80-\\xFF";
@@ -97,7 +97,7 @@ class SearchUpdate implements DeferrableUpdate {
                $text = preg_replace( $pat2, " \\1 \\3", $text );
 
                $text = preg_replace( "/([^{$lc}])([{$lc}]+)]]([a-z]+)/",
-                 "\\1\\2 \\2\\3", $text ); # Handle [[game]]s
+                       "\\1\\2 \\2\\3", $text ); # Handle [[game]]s
 
                # Strip all remaining non-search characters
                $text = preg_replace( "/[^{$lc}]+/", " ", $text );
@@ -127,7 +127,7 @@ class SearchUpdate implements DeferrableUpdate {
                wfRunHooks( 'SearchUpdate', array( $this->mId, $this->mNamespace, $this->mTitle, &$text ) );
 
                # Perform the actual update
-               $search->update($this->mId, $search->normalizeText( Title::indexTitle( $this->mNamespace, $this->mTitle ) ),
+               $search->update( $this->mId, $search->normalizeText( Title::indexTitle( $this->mNamespace, $this->mTitle ) ),
                                $search->normalizeText( $text ) );
 
                wfProfileOut( __METHOD__ );