Fixed a bunch of silly instances of [^!=]==\s*(true|false)

This commit is contained in:
Chad Horohoe 2010-06-09 11:44:05 +00:00
parent ff4583844c
commit 44229b50e6
21 changed files with 64 additions and 28 deletions

View file

@ -1330,7 +1330,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
$localSettings = str_replace( "\r\n", "\n", $localSettings );
$f = fopen( "LocalSettings.php", 'xt' );
if( $f == false ) {
if( !$f ) {
print( "</li>\n" );
dieout( "<p>Couldn't write out LocalSettings.php. Check that the directory permissions are correct and that there isn't already a file of that name here...</p>\n" .
"<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .

View file

@ -102,7 +102,7 @@ abstract class BagOStuff {
}
public function add( $key, $value, $exptime = 0 ) {
if ( $this->get( $key ) == false ) {
if ( !$this->get( $key ) ) {
$this->set( $key, $value, $exptime );
return true;

View file

@ -2628,7 +2628,7 @@ INPUTS
}
function getBaseRevision() {
if ( $this->mBaseRevision == false ) {
if ( !$this->mBaseRevision ) {
$db = wfGetDB( DB_MASTER );
$baseRevision = Revision::loadFromTimestamp(
$db, $this->mTitle, $this->edittime );

View file

@ -1500,7 +1500,7 @@ function wfMerge( $old, $mine, $yours, &$result ){
pclose( $handle );
unlink( $mytextName ); unlink( $oldtextName ); unlink( $yourtextName );
if ( $result === '' && $old !== '' && $conflict == false ) {
if ( $result === '' && $old !== '' && !$conflict ) {
wfDebug( "Unexpected null result from diff3. Command: $cmd\n" );
$conflict = true;
}

View file

@ -183,7 +183,7 @@ class ImageGallery
* @param $f Boolean: set to false to disable.
*/
function setShowBytes( $f ) {
$this->mShowBytes = ( $f == true);
$this->mShowBytes = $f;
}
/**
@ -193,7 +193,7 @@ class ImageGallery
* @param $f Boolean: set to false to disable.
*/
function setShowFilename( $f ) {
$this->mShowFilename = ( $f == true);
$this->mShowFilename = $f;
}
/**

View file

@ -39,6 +39,7 @@ class OutputPage {
var $mParseWarnings = array();
var $mSquidMaxage = 0;
var $mRevisionId = null;
var $mPageIcons = array();
protected $mTitle = null;
/**
@ -1079,6 +1080,7 @@ class OutputPage {
$this->addCategoryLinks( $parserOutput->getCategories() );
$this->mNewSectionLink = $parserOutput->getNewSection();
$this->mHideNewSectionLink = $parserOutput->getHideNewSection();
$this->mPageIcons = $parserOutput->getPageIcons();
$this->mParseWarnings = $parserOutput->getWarnings();
if ( !$parserOutput->isCacheable() ) {

View file

@ -230,6 +230,21 @@ class SkinTemplate extends Skin {
$tpl->set( 'pageclass', $this->getPageClasses( $this->mTitle ) );
$tpl->set( 'skinnameclass', ( 'skin-' . Sanitizer::escapeClass( $this->getSkinName() ) ) );
$icons = '';
foreach( $out->mPageIcons as $icon ) {
list( $file, $alt ) = $icon;
$fileAttr = array( 'src' => $file->createThumb( 16 ) );
if( $alt != '' ) {
$msg = wfMsg( $alt );
if( !wfEmptyMsg( $alt ) ) {
$alt = $msg;
}
$fileAttr['alt'] = htmlspecialchars( $alt );
}
$icons .= Html::element( 'img', $fileAttr ) . "&nbsp;";
}
$tpl->set( 'pageicons', $icons );
$nsname = MWNamespace::exists( $this->mTitle->getNamespace() ) ?
MWNamespace::getCanonicalName( $this->mTitle->getNamespace() ) :
$this->mTitle->getNsText();

View file

@ -698,7 +698,7 @@ Perhaps no page aliases are defined for it?" );
$this->mRestriction = $restriction;
$this->mListed = $listed;
$this->mIncludable = $includable;
if ( $function == false ) {
if ( !$function ) {
$this->mFunction = 'wfSpecial'.$name;
} else {
$this->mFunction = $function;

View file

@ -824,7 +824,7 @@ class Title {
}
// internal links should point to same variant as current page (only anonymous users)
if ( $variant == false && $wgContLang->hasVariants() && !$wgUser->isLoggedIn() ) {
if ( !$variant && $wgContLang->hasVariants() && !$wgUser->isLoggedIn() ) {
$pref = $wgContLang->getPreferredVariant( false );
if ( $pref != $wgContLang->getCode() )
$variant = $pref;
@ -843,7 +843,7 @@ class Title {
$dbkey = wfUrlencode( $this->getPrefixedDBkey() );
if ( $query == '' ) {
if ( $variant != false && $wgContLang->hasVariants() ) {
if ( $wgVariantArticlePath == false ) {
if ( !$wgVariantArticlePath ) {
$variantArticlePath = "$wgScript?title=$1&variant=$2"; // default
} else {
$variantArticlePath = $wgVariantArticlePath;
@ -1474,7 +1474,7 @@ class Title {
$scBlockExpiryOptions = wfMsg( 'ipboptions' );
foreach ( explode( ',', $scBlockExpiryOptions ) as $option ) {
if ( strpos( $option, ':' ) == false )
if ( !strpos( $option, ':' ) )
continue;
list ( $show, $value ) = explode( ":", $option );

View file

@ -95,7 +95,7 @@ class ApiProtect extends ApiBase {
$expiryarray[$p[0]] = Block::infinity();
} else {
$exp = strtotime( $expiry[$i] );
if ( $exp < 0 || $exp == false ) {
if ( $exp < 0 || !$exp ) {
$this->dieUsageMsg( array( 'invalidexpiry', $expiry[$i] ) );
}

View file

@ -520,7 +520,7 @@ class DatabaseIbm_db2 extends DatabaseBase {
// Rather, turn autocommit off in the begin function and turn on after a commit
db2_autocommit($this->mConn, DB2_AUTOCOMMIT_ON);
if ( $this->mConn == false ) {
if ( !$this->mConn ) {
$this->installPrint( "DB connection error\n" );
$this->installPrint( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" );
$this->installPrint( $this->lastError()."\n" );

View file

@ -249,7 +249,7 @@ class DatabaseOracle extends DatabaseBase {
$this->mConn = oci_connect( $user, $password, $dbName, $this->defaultCharset, $session_mode );
}
if ( $this->mConn == false ) {
if ( !$this->mConn ) {
wfDebug( "DB connection error\n" );
wfDebug( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" );
wfDebug( $this->lastError() . "\n" );
@ -310,7 +310,7 @@ class DatabaseOracle extends DatabaseBase {
return false;
}
if ( oci_execute( $stmt, $this->execFlags() ) == false ) {
if ( !oci_execute( $stmt, $this->execFlags() ) ) {
$e = oci_error( $stmt );
if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) {
$this->reportQueryError( $e['message'], $e['code'], $sql, __FUNCTION__ );
@ -1013,7 +1013,7 @@ class DatabaseOracle extends DatabaseBase {
// Avoid the non-standard "REPLACE INTO" syntax
echo "<li>Populating interwiki table</li>\n";
$f = fopen( "../maintenance/interwiki.sql", 'r' );
if ( $f == false ) {
if ( !$f ) {
dieout( "Could not find the interwiki.sql file" );
}

View file

@ -181,7 +181,7 @@ class DatabasePostgres extends DatabaseBase {
$this->mConn = pg_connect( $connectString );
$phpError = $this->restoreErrorHandler();
if ( $this->mConn == false ) {
if ( !$this->mConn ) {
wfDebug( "DB connection error\n" );
wfDebug( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" );
wfDebug( $this->lastError()."\n" );
@ -309,7 +309,7 @@ class DatabasePostgres extends DatabaseBase {
$connectVars['password'] = $password;
@$this->mConn = pg_connect( $this->makeConnectionString( $connectVars ) );
if ( $this->mConn == false ) {
if ( $this->mConn ) {
print "<b>FAILED TO CONNECT!</b></li>";
dieout("</ul>");
}
@ -1355,7 +1355,7 @@ SQL;
echo "<li>Populating interwiki table... ";
## Avoid the non-standard "REPLACE INTO" syntax
$f = fopen( "../maintenance/interwiki.sql", 'r' );
if ($f == false ) {
if ( $f ) {
print "<b>FAILED</b></li>";
dieout( "Could not find the interwiki.sql file" );
}

View file

@ -494,7 +494,7 @@ class DatabaseSqlite extends DatabaseBase {
# Use DatabasePostgres's code to populate interwiki from MySQL template
$f = fopen( "$IP/maintenance/interwiki.sql", 'r' );
if ( $f == false ) {
if ( !$f ) {
dieout( "Could not find the interwiki.sql file." );
}

View file

@ -69,6 +69,7 @@ class CoreParserFunctions {
$parser->setFunctionHook( 'subjectpagenamee', array( __CLASS__, 'subjectpagenamee' ), SFH_NO_HASH );
$parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS );
$parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) );
$parser->setFunctionHook( 'pageicon', array( __CLASS__, 'pageicon' ) );
if ( $wgAllowDisplayTitle ) {
$parser->setFunctionHook( 'displaytitle', array( __CLASS__, 'displaytitle' ), SFH_NO_HASH );
@ -628,6 +629,14 @@ class CoreParserFunctions {
}
}
public static function pageicon( $parser, $name = '', $alt = '' ) {
$file = wfFindFile( $name );
if( $file ) {
$parser->mOutput->addPageIcon( $file, $alt );
}
return '';
}
/**
* Parser function to extension tag adaptor
*/

View file

@ -28,7 +28,8 @@ class ParserOutput
$mSections = array(), # Table of contents
$mProperties = array(), # Name/value pairs to be cached in the DB
$mTOCHTML = ''; # HTML of the TOC
private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change.
private $mIndexPolicy = '', # 'index' or 'noindex'? Any other value will result in no change.
$mPageIcons = array(); # Array of icons to show for the page (like Protect, Featured, etc)
function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(),
$containsOldMagic = false, $titletext = '' )
@ -59,6 +60,7 @@ class ParserOutput
function getWarnings() { return array_keys( $this->mWarnings ); }
function getIndexPolicy() { return $this->mIndexPolicy; }
function getTOCHTML() { return $this->mTOCHTML; }
function getPageIcons() { return $this->mPageIcons; }
function containsOldMagic() { return $this->mContainsOldMagic; }
function setText( $text ) { return wfSetVar( $this->mText, $text ); }
@ -250,6 +252,15 @@ class ParserOutput
}
}
/**
* Add page icons to the parser output.
* @param File $file A valid file
* @param String $alt Alt text, if any
*/
function addPageIcon( $file, $alt = '' ) {
$this->mPageIcons[] = array( $file, $alt );
}
/**
* Override the title to be used for display
* -- this is assumed to have been validated

View file

@ -698,7 +698,7 @@ class LanguageConverter {
}
$variants = $this->autoConvertToAllVariants( $link );
if ( $variants == false ) { // give up
if ( !$variants ) { // give up
return;
}

View file

@ -356,6 +356,7 @@ $magicWords = array(
'url_path' => array( 0, 'PATH' ),
'url_wiki' => array( 0, 'WIKI' ),
'url_query' => array( 0, 'QUERY' ),
'pageicon' => array( 1, 'pageicon' ),
);
/**

View file

@ -216,10 +216,10 @@ class RebuildRecentchanges extends Maintenance {
$botgroups = $autopatrolgroups = array();
foreach ( $wgGroupPermissions as $group => $rights ) {
if ( isset( $rights['bot'] ) && $rights['bot'] == true ) {
if ( isset( $rights['bot'] ) && $rights['bot'] ) {
$botgroups[] = $dbw->addQuotes( $group );
}
if ( $wgUseRCPatrol && isset( $rights['autopatrol'] ) && $rights['autopatrol'] == true ) {
if ( $wgUseRCPatrol && isset( $rights['autopatrol'] ) && $rights['autopatrol'] ) {
$autopatrolgroups[] = $dbw->addQuotes( $group );
}
}

View file

@ -176,7 +176,7 @@ class RefreshLinks extends Maintenance {
$rt = $wgArticle->followRedirect();
if ( $rt == false || !is_object( $rt ) ) {
if ( !$rt || !is_object( $rt ) ) {
// $wgTitle is not a redirect
// Delete any redirect table entry for it
$dbw->delete( 'redirect', array( 'rd_from' => $id ),

View file

@ -64,11 +64,9 @@ class RunJobs extends Maintenance {
while ( $dbw->selectField( 'job', 'job_id', $conds, 'runJobs.php' ) ) {
$offset = 0;
for ( ; ; ) {
$job = ( $type == false ) ?
Job::pop( $offset )
: Job::pop_type( $type );
$job = !$type ? Job::pop( $offset ) : Job::pop_type( $type );
if ( $job == false )
if ( !$job )
break;
wfWaitForSlaves( 5 );