Various unused variables, add some braces
Explicitally define some variables used in hook type calls
This commit is contained in:
parent
1e4934e9b7
commit
10ecfeb03b
34 changed files with 33 additions and 55 deletions
|
|
@ -1473,7 +1473,6 @@ class Article {
|
|||
global $wgOut;
|
||||
|
||||
$oldid = $this->getOldID();
|
||||
$useParserCache = $this->useParserCache( $oldid );
|
||||
$parserOptions = $this->getParserOptions();
|
||||
|
||||
# Render printable version, use printable version cache
|
||||
|
|
|
|||
|
|
@ -1055,7 +1055,7 @@ class EnhancedChangesList extends ChangesList {
|
|||
# Extract fields from DB into the function scope (rc_xxxx variables)
|
||||
// FIXME: Would be good to replace this extract() call with something
|
||||
// that explicitly initializes variables.
|
||||
$classes = array(); // TODO implement
|
||||
// TODO implement
|
||||
extract( $rcObj->mAttribs );
|
||||
$query['curid'] = $rc_cur_id;
|
||||
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ class ConfEditor {
|
|||
|
||||
switch ( $state ) {
|
||||
case 'file':
|
||||
$token = $this->expect( T_OPEN_TAG );
|
||||
$this->expect( T_OPEN_TAG );
|
||||
$token = $this->skipSpace();
|
||||
if ( $token->isEnd() ) {
|
||||
break 2;
|
||||
|
|
|
|||
|
|
@ -2229,7 +2229,9 @@ HTML
|
|||
|
||||
$script = '';
|
||||
foreach ( $toolarray as $tool ) {
|
||||
if ( !$tool ) continue;
|
||||
if ( !$tool ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$params = array(
|
||||
$image = $wgStylePath . '/common/images/' . $tool['image'],
|
||||
|
|
|
|||
|
|
@ -529,7 +529,9 @@ class HistoryPager extends ReverseChronologicalPager {
|
|||
$rev->isDeleted( Revision::DELETED_RESTRICTED ), false );
|
||||
}
|
||||
}
|
||||
if( $del ) $s .= " $del ";
|
||||
if( $del ) {
|
||||
$s .= " $del ";
|
||||
}
|
||||
|
||||
$s .= " $link";
|
||||
$s .= " <span class='history-user'>" .
|
||||
|
|
|
|||
|
|
@ -327,8 +327,6 @@ class ImagePage extends Article {
|
|||
$height_orig = $this->displayImg->getHeight( $page );
|
||||
$height = $height_orig;
|
||||
|
||||
$showLink = false;
|
||||
$linkAttribs = array( 'href' => $full_url );
|
||||
$longDesc = $this->displayImg->getLongDesc();
|
||||
|
||||
wfRunHooks( 'ImageOpenShowImageInlineBefore', array( &$this, &$wgOut ) );
|
||||
|
|
@ -1002,6 +1000,7 @@ class ImageHistoryList {
|
|||
}
|
||||
$row .= '</td>';
|
||||
|
||||
$rowClass = null;
|
||||
wfRunHooks( 'ImagePageFileHistoryLine', array( $this, $file, &$row, &$rowClass ) );
|
||||
$classAttr = $rowClass ? " class='$rowClass'" : "";
|
||||
|
||||
|
|
|
|||
|
|
@ -826,7 +826,7 @@ class MimeMagic {
|
|||
$m = trim( $m );
|
||||
$m = strtolower( $m );
|
||||
|
||||
if ( strpos( $m, 'unknown' ) !== false ) {
|
||||
if ( strpos( $m, 'unknown' ) === false ) {
|
||||
$m = null;
|
||||
} else {
|
||||
wfDebug( __METHOD__.": magic mime type of $file: $m\n" );
|
||||
|
|
|
|||
|
|
@ -563,11 +563,6 @@ class OutputPage {
|
|||
$nameWithTags = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags( $name ) );
|
||||
$this->mPagetitle = $nameWithTags;
|
||||
|
||||
$taction = $this->getPageTitleActionText();
|
||||
if( !empty( $taction ) ) {
|
||||
$name .= ' - '.$taction;
|
||||
}
|
||||
|
||||
# change "<i>foo&bar</i>" to "foo&bar"
|
||||
$this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,7 +358,6 @@ class SkinTemplate extends Skin {
|
|||
|
||||
if( $wgPageShowWatchingUsers ) {
|
||||
$dbr = wfGetDB( DB_SLAVE );
|
||||
$watchlist = $dbr->tableName( 'watchlist' );
|
||||
$res = $dbr->select( 'watchlist',
|
||||
array( 'COUNT(*) AS n' ),
|
||||
array( 'wl_title' => $dbr->strencode( $this->mTitle->getDBkey() ), 'wl_namespace' => $this->mTitle->getNamespace() ),
|
||||
|
|
|
|||
|
|
@ -3302,7 +3302,6 @@ class Title {
|
|||
# Truncate for whole multibyte characters. +5 bytes for ellipsis
|
||||
$comment = $wgContLang->truncate( $comment, 250 );
|
||||
|
||||
$newid = $nt->getArticleID();
|
||||
$oldid = $this->getArticleID();
|
||||
$latest = $this->getLatestRevId();
|
||||
|
||||
|
|
|
|||
|
|
@ -347,7 +347,8 @@ class WatchlistEditor {
|
|||
*/
|
||||
private function showNormalForm( $output, $user ) {
|
||||
global $wgUser;
|
||||
if( ( $count = $this->showItemCount( $output, $user ) ) > 0 ) {
|
||||
$count = $this->showItemCount( $output, $user );
|
||||
if( $count > 0 ) {
|
||||
$self = SpecialPage::getTitleFor( 'Watchlist' );
|
||||
$form = Xml::openElement( 'form', array( 'method' => 'post',
|
||||
'action' => $self->getLocalUrl( array( 'action' => 'edit' ) ) ) );
|
||||
|
|
|
|||
|
|
@ -1249,11 +1249,9 @@ EOF;
|
|||
$join_conds );
|
||||
|
||||
// We must adjust for offset
|
||||
if ( isset( $options['LIMIT'] ) ) {
|
||||
if ( isset ( $options['OFFSET'] ) ) {
|
||||
$limit = $options['LIMIT'];
|
||||
$offset = $options['OFFSET'];
|
||||
}
|
||||
if ( isset( $options['LIMIT'] ) && isset ( $options['OFFSET'] ) ) {
|
||||
$limit = $options['LIMIT'];
|
||||
$offset = $options['OFFSET'];
|
||||
}
|
||||
|
||||
// DB2 does not have a proper num_rows() function yet, so we must emulate
|
||||
|
|
|
|||
|
|
@ -552,9 +552,9 @@ class DatabaseMssql extends DatabaseBase {
|
|||
*/
|
||||
function nextSequenceValue( $seqName ) {
|
||||
if ( !$this->tableExists( 'sequence_' . $seqName ) ) {
|
||||
$ret = sqlsrv_query( $this->mConn, "CREATE TABLE [sequence_$seqName] (id INT NOT NULL IDENTITY PRIMARY KEY, junk varchar(10) NULL)" );
|
||||
sqlsrv_query( $this->mConn, "CREATE TABLE [sequence_$seqName] (id INT NOT NULL IDENTITY PRIMARY KEY, junk varchar(10) NULL)" );
|
||||
}
|
||||
$ret = sqlsrv_query( $this->mConn, "INSERT INTO [sequence_$seqName] (junk) VALUES ('')" );
|
||||
sqlsrv_query( $this->mConn, "INSERT INTO [sequence_$seqName] (junk) VALUES ('')" );
|
||||
$ret = sqlsrv_query( $this->mConn, "SELECT TOP 1 id FROM [sequence_$seqName] ORDER BY id DESC" );
|
||||
$row = sqlsrv_fetch_array( $ret, SQLSRV_FETCH_ASSOC );// KEEP ASSOC THERE, weird weird bug dealing with the return value if you don't
|
||||
|
||||
|
|
|
|||
|
|
@ -751,7 +751,6 @@ class DatabasePostgres extends DatabaseBase {
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ class _DiffEngine {
|
|||
}
|
||||
$matches = $ymatches[$line];
|
||||
reset($matches);
|
||||
while ( list( $junk, $y ) = each( $matches ) ) {
|
||||
while ( list( , $y ) = each( $matches ) ) {
|
||||
if ( empty( $this->in_seq[$y] ) ) {
|
||||
$k = $this->_lcs_pos( $y );
|
||||
assert( $k > 0 );
|
||||
|
|
@ -321,7 +321,7 @@ class _DiffEngine {
|
|||
break;
|
||||
}
|
||||
}
|
||||
while (list ( /* $junk */, $y) = each($matches)) {
|
||||
while (list ( , $y) = each($matches)) {
|
||||
if ($y > $this->seq[$k-1]) {
|
||||
assert($y < $this->seq[$k]);
|
||||
// Optimization: this is a common case:
|
||||
|
|
|
|||
|
|
@ -395,7 +395,6 @@ abstract class DatabaseInstaller {
|
|||
* Set this to false to show a creation checkbox.
|
||||
*/
|
||||
public function getWebUserBox( $noCreateMsg = false ) {
|
||||
$name = $this->getName();
|
||||
$s = Html::openElement( 'fieldset' ) .
|
||||
Html::element( 'legend', array(), wfMsg( 'config-db-web-account' ) ) .
|
||||
$this->getCheckBox(
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ class MysqlInstaller extends DatabaseInstaller {
|
|||
if ( !$create ) {
|
||||
// Test the web account
|
||||
try {
|
||||
$webConn = new Database(
|
||||
new Database(
|
||||
$this->getVar( 'wgDBserver' ),
|
||||
$this->getVar( 'wgDBuser' ),
|
||||
$this->getVar( 'wgDBpassword' ),
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ class MysqlUpdater extends DatabaseUpdater {
|
|||
$prev_namespace = $row->cur_namespace;
|
||||
}
|
||||
$sql = "DELETE FROM $cur WHERE cur_id IN ( " . join( ',', $deleteId ) . ')';
|
||||
$rows = $this->db->query( $sql, __METHOD__ );
|
||||
$this->db->query( $sql, __METHOD__ );
|
||||
$this->output( wfTimestamp( TS_DB ) );
|
||||
$this->output( "......<b>Deleted</b> " . $this->db->affectedRows() . " records.\n" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ class OracleInstaller extends DatabaseInstaller {
|
|||
}
|
||||
|
||||
public function getWebUserBox( $noCreateMsg = false ) {
|
||||
$name = $this->getName();
|
||||
$this->parent->setVar( '_SameAccount', false );
|
||||
$this->parent->setVar( '_CreateDBAccount', true );
|
||||
$this->parent->setVar( 'wgDBname', '' );
|
||||
|
|
|
|||
|
|
@ -150,7 +150,6 @@ class SvgHandler extends ImageHandler {
|
|||
}
|
||||
|
||||
function getMetadata( $file, $filename ) {
|
||||
$metadata = array();
|
||||
try {
|
||||
$metadata = SVGMetadataExtractor::getMetadata( $filename );
|
||||
} catch( Exception $e ) {
|
||||
|
|
|
|||
|
|
@ -159,7 +159,6 @@ class LinkHolderArray {
|
|||
$current = null;
|
||||
foreach ( $this->internals as $ns => $entries ) {
|
||||
foreach ( $entries as $index => $entry ) {
|
||||
$key = "$ns:$index";
|
||||
$title = $entry['title'];
|
||||
$pdbk = $entry['pdbk'];
|
||||
|
||||
|
|
|
|||
|
|
@ -789,7 +789,6 @@ class Parser {
|
|||
wfProfileIn( __METHOD__ );
|
||||
|
||||
$lines = StringUtils::explode( "\n", $text );
|
||||
$text = null;
|
||||
$out = '';
|
||||
$td_history = array(); # Is currently a td tag open?
|
||||
$last_tag_history = array(); # Save history of last lag activated (td, th or caption)
|
||||
|
|
|
|||
|
|
@ -511,9 +511,7 @@ class Preprocessor_DOM implements Preprocessor {
|
|||
// another heading. Infinite loops are avoided because the next iteration MUST
|
||||
// hit the heading open case above, which unconditionally increments the
|
||||
// input pointer.
|
||||
}
|
||||
|
||||
elseif ( $found == 'open' ) {
|
||||
} elseif ( $found == 'open' ) {
|
||||
# count opening brace characters
|
||||
$count = strspn( $text, $curChar, $i );
|
||||
|
||||
|
|
@ -536,9 +534,7 @@ class Preprocessor_DOM implements Preprocessor {
|
|||
$accum .= htmlspecialchars( str_repeat( $curChar, $count ) );
|
||||
}
|
||||
$i += $count;
|
||||
}
|
||||
|
||||
elseif ( $found == 'close' ) {
|
||||
} elseif ( $found == 'close' ) {
|
||||
$piece = $stack->top;
|
||||
# lets check if there are enough characters for closing brace
|
||||
$maxCount = $piece->count;
|
||||
|
|
@ -961,7 +957,9 @@ class PPFrame_DOM implements PPFrame {
|
|||
$iteratorStack[$level] = false;
|
||||
}
|
||||
|
||||
if ( $contextNode instanceof PPNode_DOM ) $contextNode = $contextNode->node;
|
||||
if ( $contextNode instanceof PPNode_DOM ) {
|
||||
$contextNode = $contextNode->node;
|
||||
}
|
||||
|
||||
$newIterator = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ class SpecialComparePages extends SpecialPage {
|
|||
$this->form();
|
||||
|
||||
if( $this->opts->getValue( 'rev1' ) && $this->opts->getValue( 'rev2' ) ) {
|
||||
$title = Title::newFromText( $this->opts->getValue( 'page2' ) );
|
||||
$de = new DifferenceEngine( null,
|
||||
$this->opts->getValue( 'rev1' ),
|
||||
$this->opts->getValue( 'rev2' ),
|
||||
|
|
|
|||
|
|
@ -342,9 +342,9 @@ class SpecialSearch {
|
|||
global $wgOut;
|
||||
// Figure out the active search profile header
|
||||
$nsAllSet = array_keys( SearchEngine::searchableNamespaces() );
|
||||
if( $this->searchAdvanced )
|
||||
if( $this->searchAdvanced ) {
|
||||
$this->active = 'advanced';
|
||||
else {
|
||||
} else {
|
||||
$profiles = $this->getSearchProfiles();
|
||||
|
||||
foreach( $profiles as $key => $data ) {
|
||||
|
|
@ -416,7 +416,6 @@ class SpecialSearch {
|
|||
if( !is_null($infoLine) ) {
|
||||
$out .= "\n<!-- {$infoLine} -->\n";
|
||||
}
|
||||
$off = $this->offset + 1;
|
||||
$out .= "<ul class='mw-search-results'>\n";
|
||||
while( $result = $matches->next() ) {
|
||||
$out .= $this->showHit( $result, $terms );
|
||||
|
|
@ -623,7 +622,6 @@ class SpecialSearch {
|
|||
|
||||
$out = "<div id='mw-search-interwiki'><div id='mw-search-interwiki-caption'>".
|
||||
wfMsg('search-interwiki-caption')."</div>\n";
|
||||
$off = $this->offset + 1;
|
||||
$out .= "<ul class='mw-search-iwresults'>\n";
|
||||
|
||||
// work out custom project captions
|
||||
|
|
|
|||
|
|
@ -176,7 +176,6 @@ class LoginForm {
|
|||
$wgOut->addWikiMsg( 'accmailtext', $u->getName(), $u->getEmail() );
|
||||
$wgOut->returnToMain( false );
|
||||
}
|
||||
$u = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -620,7 +619,7 @@ class LoginForm {
|
|||
}
|
||||
|
||||
wfDebug( __METHOD__ . ": creating account\n" );
|
||||
$user = $this->initUser( $user, true );
|
||||
$this->initUser( $user, true );
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ abstract class UploadBase {
|
|||
protected function verifyFile() {
|
||||
# get the title, even though we are doing nothing with it, because
|
||||
# we need to populate mFinalExtension
|
||||
$nt = $this->getTitle();
|
||||
$this->getTitle();
|
||||
|
||||
$this->mFileProps = File::getPropsFromPath( $this->mTempPath, $this->mFinalExtension );
|
||||
$this->checkMacBinary();
|
||||
|
|
|
|||
|
|
@ -263,7 +263,6 @@ class TextPassDumper extends BackupDumper {
|
|||
while ( true ) {
|
||||
try {
|
||||
$text = $this->getTextDb( $id );
|
||||
$ex = new MWException( "Graceful storage failure" );
|
||||
} catch ( DBQueryError $ex ) {
|
||||
$text = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,6 @@ class Orphans extends Maintenance {
|
|||
$dbw = wfGetDB( DB_MASTER );
|
||||
$page = $dbw->tableName( 'page' );
|
||||
$revision = $dbw->tableName( 'revision' );
|
||||
$text = $dbw->tableName( 'text' );
|
||||
|
||||
if ( $fix ) {
|
||||
$dbw->lockTables( $dbw, 'text', __METHOD__ );
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ TEXT;
|
|||
|
||||
$maxlag = intval( $maxlag );
|
||||
$throttle = intval( $throttle );
|
||||
$force = (bool)$force;
|
||||
if ( $begin !== '' ) {
|
||||
$where = 'cl_to > ' . $dbw->addQuotes( $begin );
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class ReassignEdits extends Maintenance {
|
|||
# Update recent changes if required
|
||||
if ( $rc ) {
|
||||
$this->output( "Updating recent changes..." );
|
||||
$res = $dbw->update( 'recentchanges', $this->userSpecification( $to, 'rc_user', 'rc_user_text' ), $this->userConditions( $from, 'rc_user', 'rc_user_text' ), __METHOD__ );
|
||||
$dbw->update( 'recentchanges', $this->userSpecification( $to, 'rc_user', 'rc_user_text' ), $this->userConditions( $from, 'rc_user', 'rc_user_text' ), __METHOD__ );
|
||||
$this->output( "done.\n" );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,6 @@ class UploadFromUrlTest extends ApiTestSetup {
|
|||
$this->assertTrue( $exception, "Got exception" );
|
||||
|
||||
self::$user->addGroup( 'sysop' );
|
||||
$exception = false;
|
||||
$data = $this->doApiRequest( array(
|
||||
'action' => 'upload',
|
||||
'url' => 'http://bits.wikimedia.org/skins-1.5/common/images/poweredby_mediawiki_88x31.png',
|
||||
|
|
|
|||
|
|
@ -306,7 +306,6 @@ class ApiUploadTest extends ApiTestCase {
|
|||
global $wgUser;
|
||||
$wgUser = self::$users['uploader']->user;
|
||||
|
||||
$extension = 'png';
|
||||
$mimeType = 'image/png';
|
||||
|
||||
$filePath = tempnam( wfTempDir(), "" );
|
||||
|
|
@ -617,7 +616,7 @@ class ApiUploadTest extends ApiTestCase {
|
|||
$hash = File::sha1Base36( $filePath );
|
||||
$dupes = RepoGroup::singleton()->findBySha1( $hash );
|
||||
$success = true;
|
||||
foreach ( $dupes as $key => $dupe ) {
|
||||
foreach ( $dupes as $dupe ) {
|
||||
$success &= $this->deleteFileByTitle( $dupe->getTitle() );
|
||||
}
|
||||
return $success;
|
||||
|
|
|
|||
|
|
@ -203,6 +203,7 @@ class RandomImageGenerator {
|
|||
$args[] = $filename;
|
||||
|
||||
$command = wfEscapeShellArg( $wgImageMagickConvertCommand ) . " " . implode( " ", $args );
|
||||
$retval = null;
|
||||
$output = wfShellExec( $command, $retval );
|
||||
return ( $retval === 0 );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue