Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | function initialize( &$title, &$article, &$output, &$user, $request ) { |
54 | 54 | wfProfileIn( __METHOD__ ); |
55 | 55 | $this->preliminaryChecks( $title, $output, $request ) ; |
56 | | - if ( !$this->initializeSpecialCases( $title, $output, $request ) ) { |
| 56 | + if( !$this->initializeSpecialCases( $title, $output, $request ) ) { |
57 | 57 | $new_article = $this->initializeArticle( $title, $request ); |
58 | 58 | if( is_object( $new_article ) ) { |
59 | 59 | $article = $new_article; |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | */ |
79 | 79 | function checkMaxLag( $maxLag ) { |
80 | 80 | list( $host, $lag ) = wfGetLB()->getMaxLag(); |
81 | | - if ( $lag > $maxLag ) { |
| 81 | + if( $lag > $maxLag ) { |
82 | 82 | wfMaxlagError( $host, $lag, $maxLag ); |
83 | 83 | return false; |
84 | 84 | } else { |
— | — | @@ -96,16 +96,14 @@ |
97 | 97 | */ |
98 | 98 | function checkInitialQueries( $title, $action ) { |
99 | 99 | global $wgOut, $wgRequest, $wgContLang; |
100 | | - if( $wgRequest->getVal( 'printable' ) == 'yes' ){ |
| 100 | + if( $wgRequest->getVal( 'printable' ) === 'yes' ) { |
101 | 101 | $wgOut->setPrintable(); |
102 | 102 | } |
103 | | - |
104 | 103 | $ret = NULL; |
105 | | - |
106 | | - if ( $curid = $wgRequest->getInt( 'curid' ) ) { |
| 104 | + if( $curid = $wgRequest->getInt( 'curid' ) ) { |
107 | 105 | # URLs like this are generated by RC, because rc_title isn't always accurate |
108 | 106 | $ret = Title::newFromID( $curid ); |
109 | | - } elseif ( '' == $title && 'delete' != $action ) { |
| 107 | + } elseif( '' == $title && 'delete' != $action ) { |
110 | 108 | $ret = Title::newMainPage(); |
111 | 109 | } else { |
112 | 110 | $ret = Title::newFromURL( $title ); |
— | — | @@ -115,7 +113,7 @@ |
116 | 114 | $wgContLang->findVariantLink( $title, $ret ); |
117 | 115 | |
118 | 116 | } |
119 | | - if ( ( $oldid = $wgRequest->getInt( 'oldid' ) ) |
| 117 | + if( ( $oldid = $wgRequest->getInt( 'oldid' ) ) |
120 | 118 | && ( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) ) { |
121 | 119 | // Allow oldid to override a changed or missing title. |
122 | 120 | $rev = Revision::newFromId( $oldid ); |
— | — | @@ -147,7 +145,7 @@ |
148 | 146 | # If the user is not logged in, the Namespace:title of the article must be in |
149 | 147 | # the Read array in order for the user to see it. (We have to check here to |
150 | 148 | # catch special pages etc. We check again in Article::view()) |
151 | | - if ( !is_null( $title ) && !$title->userCanRead() ) { |
| 149 | + if( !is_null( $title ) && !$title->userCanRead() ) { |
152 | 150 | $output->loginToUse(); |
153 | 151 | $output->output(); |
154 | 152 | exit; |
— | — | @@ -175,20 +173,20 @@ |
176 | 174 | $title = SpecialPage::getTitleFor( 'Badtitle' ); |
177 | 175 | # Die now before we mess up $wgArticle and the skin stops working |
178 | 176 | throw new ErrorPageError( 'badtitle', 'badtitletext' ); |
179 | | - } else if ( $title->getInterwiki() != '' ) { |
| 177 | + } else if( $title->getInterwiki() != '' ) { |
180 | 178 | if( $rdfrom = $request->getVal( 'rdfrom' ) ) { |
181 | 179 | $url = $title->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) ); |
182 | 180 | } else { |
183 | 181 | $url = $title->getFullURL(); |
184 | 182 | } |
185 | 183 | /* Check for a redirect loop */ |
186 | | - if ( !preg_match( '/^' . preg_quote( $this->getVal('Server'), '/' ) . '/', $url ) && $title->isLocal() ) { |
| 184 | + if( !preg_match( '/^' . preg_quote( $this->getVal('Server'), '/' ) . '/', $url ) && $title->isLocal() ) { |
187 | 185 | $output->redirect( $url ); |
188 | 186 | } else { |
189 | 187 | $title = SpecialPage::getTitleFor( 'Badtitle' ); |
190 | 188 | throw new ErrorPageError( 'badtitle', 'badtitletext' ); |
191 | 189 | } |
192 | | - } else if ( $action == 'view' && !$request->wasPosted() && |
| 190 | + } else if( $action == 'view' && !$request->wasPosted() && |
193 | 191 | ( !isset($this->GET['title']) || $title->getPrefixedDBKey() != $this->GET['title'] ) && |
194 | 192 | !count( array_diff( array_keys( $this->GET ), array( 'action', 'title' ) ) ) ) |
195 | 193 | { |
— | — | @@ -220,7 +218,7 @@ |
221 | 219 | $output->setSquidMaxage( 1200 ); |
222 | 220 | $output->redirect( $targetUrl, '301' ); |
223 | 221 | } |
224 | | - } else if ( NS_SPECIAL == $title->getNamespace() ) { |
| 222 | + } else if( NS_SPECIAL == $title->getNamespace() ) { |
225 | 223 | /* actions that need to be made when we have a special pages */ |
226 | 224 | SpecialPage::executePath( $title ); |
227 | 225 | } else { |
— | — | @@ -307,7 +305,7 @@ |
308 | 306 | // Rewrite environment to redirected article |
309 | 307 | $rarticle = self::articleFromTitle( $target ); |
310 | 308 | $rarticle->loadPageData( $rarticle->pageDataFromTitle( $dbr, $target ) ); |
311 | | - if ( $rarticle->exists() || ( is_object( $file ) && !$file->isLocal() ) ) { |
| 309 | + if( $rarticle->exists() || ( is_object( $file ) && !$file->isLocal() ) ) { |
312 | 310 | $rarticle->setRedirectedFrom( $title ); |
313 | 311 | $article = $rarticle; |
314 | 312 | $title = $target; |
— | — | @@ -361,7 +359,7 @@ |
362 | 360 | $up->doUpdate(); |
363 | 361 | |
364 | 362 | # Commit after every update to prevent lock contention |
365 | | - if ( $dbw->trxLevel() ) { |
| 363 | + if( $dbw->trxLevel() ) { |
366 | 364 | $dbw->commit(); |
367 | 365 | } |
368 | 366 | } |
— | — | @@ -374,12 +372,12 @@ |
375 | 373 | function doJobs() { |
376 | 374 | $jobRunRate = $this->getVal( 'JobRunRate' ); |
377 | 375 | |
378 | | - if ( $jobRunRate <= 0 || wfReadOnly() ) { |
| 376 | + if( $jobRunRate <= 0 || wfReadOnly() ) { |
379 | 377 | return; |
380 | 378 | } |
381 | | - if ( $jobRunRate < 1 ) { |
| 379 | + if( $jobRunRate < 1 ) { |
382 | 380 | $max = mt_getrandmax(); |
383 | | - if ( mt_rand( 0, $max ) > $max * $jobRunRate ) { |
| 381 | + if( mt_rand( 0, $max ) > $max * $jobRunRate ) { |
384 | 382 | return; |
385 | 383 | } |
386 | 384 | $n = 1; |
— | — | @@ -393,7 +391,7 @@ |
394 | 392 | $success = $job->run(); |
395 | 393 | $t += wfTime(); |
396 | 394 | $t = round( $t*1000 ); |
397 | | - if ( !$success ) { |
| 395 | + if( !$success ) { |
398 | 396 | $output .= "Error: " . $job->getLastError() . ", Time: $t ms\n"; |
399 | 397 | } else { |
400 | 398 | $output .= "Success, Time: $t ms\n"; |
— | — | @@ -422,7 +420,7 @@ |
423 | 421 | function performAction( &$output, &$article, &$title, &$user, &$request ) { |
424 | 422 | wfProfileIn( __METHOD__ ); |
425 | 423 | |
426 | | - if ( !wfRunHooks( 'MediaWikiPerformAction', array( $output, $article, $title, $user, $request, $this ) ) ) { |
| 424 | + if( !wfRunHooks( 'MediaWikiPerformAction', array( $output, $article, $title, $user, $request, $this ) ) ) { |
427 | 425 | wfProfileOut( __METHOD__ ); |
428 | 426 | return; |
429 | 427 | } |
Index: trunk/phase3/index.php |
— | — | @@ -47,10 +47,8 @@ |
48 | 48 | OutputPage::setEncodings(); # Not really used yet |
49 | 49 | |
50 | 50 | $maxLag = $wgRequest->getVal( 'maxlag' ); |
51 | | -if ( !is_null( $maxLag ) ) { |
52 | | - if ( !$mediaWiki->checkMaxLag( $maxLag ) ) { |
53 | | - exit; |
54 | | - } |
| 51 | +if( !is_null($maxLag) && !$mediaWiki->checkMaxLag( $maxLag ) ) { |
| 52 | + exit; |
55 | 53 | } |
56 | 54 | |
57 | 55 | # Query string fields |
— | — | @@ -58,7 +56,7 @@ |
59 | 57 | $title = $wgRequest->getVal( 'title' ); |
60 | 58 | |
61 | 59 | $wgTitle = $mediaWiki->checkInitialQueries( $title, $action ); |
62 | | -if ($wgTitle == NULL) { |
| 60 | +if( $wgTitle === NULL ) { |
63 | 61 | unset( $wgTitle ); |
64 | 62 | } |
65 | 63 | |
— | — | @@ -67,7 +65,7 @@ |
68 | 66 | # |
69 | 67 | # Send Ajax requests to the Ajax dispatcher. |
70 | 68 | # |
71 | | -if ( $wgUseAjax && $action == 'ajax' ) { |
| 69 | +if( $wgUseAjax && $action == 'ajax' ) { |
72 | 70 | require_once( $IP . '/includes/AjaxDispatcher.php' ); |
73 | 71 | |
74 | 72 | $dispatcher = new AjaxDispatcher(); |