function initialize( &$title, &$article, &$output, &$user, $request ) {
wfProfileIn( __METHOD__ );
$this->preliminaryChecks( $title, $output, $request ) ;
- if ( !$this->initializeSpecialCases( $title, $output, $request ) ) {
+ if( !$this->initializeSpecialCases( $title, $output, $request ) ) {
$new_article = $this->initializeArticle( $title, $request );
if( is_object( $new_article ) ) {
$article = $new_article;
*/
function checkMaxLag( $maxLag ) {
list( $host, $lag ) = wfGetLB()->getMaxLag();
- if ( $lag > $maxLag ) {
+ if( $lag > $maxLag ) {
wfMaxlagError( $host, $lag, $maxLag );
return false;
} else {
*/
function checkInitialQueries( $title, $action ) {
global $wgOut, $wgRequest, $wgContLang;
- if( $wgRequest->getVal( 'printable' ) == 'yes' ){
+ if( $wgRequest->getVal( 'printable' ) === 'yes' ) {
$wgOut->setPrintable();
}
-
$ret = NULL;
-
- if ( $curid = $wgRequest->getInt( 'curid' ) ) {
+ if( $curid = $wgRequest->getInt( 'curid' ) ) {
# URLs like this are generated by RC, because rc_title isn't always accurate
$ret = Title::newFromID( $curid );
- } elseif ( '' == $title && 'delete' != $action ) {
+ } elseif( '' == $title && 'delete' != $action ) {
$ret = Title::newMainPage();
} else {
$ret = Title::newFromURL( $title );
$wgContLang->findVariantLink( $title, $ret );
}
- if ( ( $oldid = $wgRequest->getInt( 'oldid' ) )
+ if( ( $oldid = $wgRequest->getInt( 'oldid' ) )
&& ( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) ) {
// Allow oldid to override a changed or missing title.
$rev = Revision::newFromId( $oldid );
# If the user is not logged in, the Namespace:title of the article must be in
# the Read array in order for the user to see it. (We have to check here to
# catch special pages etc. We check again in Article::view())
- if ( !is_null( $title ) && !$title->userCanRead() ) {
+ if( !is_null( $title ) && !$title->userCanRead() ) {
$output->loginToUse();
$output->output();
exit;
$title = SpecialPage::getTitleFor( 'Badtitle' );
# Die now before we mess up $wgArticle and the skin stops working
throw new ErrorPageError( 'badtitle', 'badtitletext' );
- } else if ( $title->getInterwiki() != '' ) {
+ } else if( $title->getInterwiki() != '' ) {
if( $rdfrom = $request->getVal( 'rdfrom' ) ) {
$url = $title->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) );
} else {
$url = $title->getFullURL();
}
/* Check for a redirect loop */
- if ( !preg_match( '/^' . preg_quote( $this->getVal('Server'), '/' ) . '/', $url ) && $title->isLocal() ) {
+ if( !preg_match( '/^' . preg_quote( $this->getVal('Server'), '/' ) . '/', $url ) && $title->isLocal() ) {
$output->redirect( $url );
} else {
$title = SpecialPage::getTitleFor( 'Badtitle' );
throw new ErrorPageError( 'badtitle', 'badtitletext' );
}
- } else if ( $action == 'view' && !$request->wasPosted() &&
+ } else if( $action == 'view' && !$request->wasPosted() &&
( !isset($this->GET['title']) || $title->getPrefixedDBKey() != $this->GET['title'] ) &&
!count( array_diff( array_keys( $this->GET ), array( 'action', 'title' ) ) ) )
{
$output->setSquidMaxage( 1200 );
$output->redirect( $targetUrl, '301' );
}
- } else if ( NS_SPECIAL == $title->getNamespace() ) {
+ } else if( NS_SPECIAL == $title->getNamespace() ) {
/* actions that need to be made when we have a special pages */
SpecialPage::executePath( $title );
} else {
// Rewrite environment to redirected article
$rarticle = self::articleFromTitle( $target );
$rarticle->loadPageData( $rarticle->pageDataFromTitle( $dbr, $target ) );
- if ( $rarticle->exists() || ( is_object( $file ) && !$file->isLocal() ) ) {
+ if( $rarticle->exists() || ( is_object( $file ) && !$file->isLocal() ) ) {
$rarticle->setRedirectedFrom( $title );
$article = $rarticle;
$title = $target;
$up->doUpdate();
# Commit after every update to prevent lock contention
- if ( $dbw->trxLevel() ) {
+ if( $dbw->trxLevel() ) {
$dbw->commit();
}
}
function doJobs() {
$jobRunRate = $this->getVal( 'JobRunRate' );
- if ( $jobRunRate <= 0 || wfReadOnly() ) {
+ if( $jobRunRate <= 0 || wfReadOnly() ) {
return;
}
- if ( $jobRunRate < 1 ) {
+ if( $jobRunRate < 1 ) {
$max = mt_getrandmax();
- if ( mt_rand( 0, $max ) > $max * $jobRunRate ) {
+ if( mt_rand( 0, $max ) > $max * $jobRunRate ) {
return;
}
$n = 1;
$success = $job->run();
$t += wfTime();
$t = round( $t*1000 );
- if ( !$success ) {
+ if( !$success ) {
$output .= "Error: " . $job->getLastError() . ", Time: $t ms\n";
} else {
$output .= "Success, Time: $t ms\n";
function performAction( &$output, &$article, &$title, &$user, &$request ) {
wfProfileIn( __METHOD__ );
- if ( !wfRunHooks( 'MediaWikiPerformAction', array( $output, $article, $title, $user, $request, $this ) ) ) {
+ if( !wfRunHooks( 'MediaWikiPerformAction', array( $output, $article, $title, $user, $request, $this ) ) ) {
wfProfileOut( __METHOD__ );
return;
}