r60414 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60413‎ | r60414 | r60415 >
Date:20:03, 26 December 2009
Author:ialex
Status:ok
Tags:
Comment:
Whitespaces fixes:
* removed trailing spaces
* removed some useless whitespaces
* fixed some indentation
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -207,7 +207,7 @@
208208 * the shortcut in Article::followContent()
209209 *
210210 * @return Return the text of this revision
211 - */
 211+ */
212212 public function getContent() {
213213 global $wgUser, $wgContLang, $wgOut, $wgMessageCache;
214214 wfProfileIn( __METHOD__ );
@@ -237,7 +237,7 @@
238238 * Get the text of the current revision. No side-effects...
239239 *
240240 * @return Return the text of the current revision
241 - */
 241+ */
242242 public function getRawText() {
243243 // Check process cache for current revision
244244 if( $this->mContentLoaded && $this->mOldId == 0 ) {
@@ -728,9 +728,9 @@
729729 }
730730
731731 /**
732 - * This is the default action of the index.php entry point: just view the
 732+ * This is the default action of the index.php entry point: just view the
733733 * page of the given title.
734 - */
 734+ */
735735 public function view() {
736736 global $wgUser, $wgOut, $wgRequest, $wgContLang;
737737 global $wgEnableParserCache, $wgStylePath, $wgParser;
@@ -940,7 +940,7 @@
941941 */
942942 public function showDiffPage() {
943943 global $wgOut, $wgRequest, $wgUser;
944 -
 944+
945945 $diff = $wgRequest->getVal( 'diff' );
946946 $rcid = $wgRequest->getVal( 'rcid' );
947947 $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
@@ -962,10 +962,10 @@
963963 }
964964
965965 /**
966 - * Show a page view for a page formatted as CSS or JavaScript. To be called by
 966+ * Show a page view for a page formatted as CSS or JavaScript. To be called by
967967 * Article::view() only.
968968 *
969 - * This is hooked by SyntaxHighlight_GeSHi to do syntax highlighting of these
 969+ * This is hooked by SyntaxHighlight_GeSHi to do syntax highlighting of these
970970 * page views.
971971 */
972972 public function showCssOrJsPage() {
@@ -993,7 +993,7 @@
994994 $policy = $this->getRobotPolicy( 'view' );
995995 return $policy['index'] . ',' . $policy['follow'];
996996 }
997 -
 997+
998998 /**
999999 * Get the robot policy to be used for the current view
10001000 * @param $action String the action= GET parameter
@@ -1001,7 +1001,7 @@
10021002 * TODO: actions other than 'view'
10031003 */
10041004 public function getRobotPolicy( $action ){
1005 -
 1005+
10061006 global $wgOut, $wgArticleRobotPolicies, $wgNamespaceRobotPolicies;
10071007 global $wgDefaultRobotPolicy, $wgRequest;
10081008
@@ -1085,8 +1085,8 @@
10861086 }
10871087
10881088 /**
1089 - * If this request is a redirect view, send "redirected from" subtitle to
1090 - * $wgOut. Returns true if the header was needed, false if this is not a
 1089+ * If this request is a redirect view, send "redirected from" subtitle to
 1090+ * $wgOut. Returns true if the header was needed, false if this is not a
10911091 * redirect view. Handles both local and remote redirects.
10921092 */
10931093 public function showRedirectedFromHeader() {
@@ -1134,7 +1134,7 @@
11351135 }
11361136
11371137 /**
1138 - * Show a header specific to the namespace currently being viewed, like
 1138+ * Show a header specific to the namespace currently being viewed, like
11391139 * [[MediaWiki:Talkpagetext]]. For Article::view().
11401140 */
11411141 public function showNamespaceHeader() {
@@ -1168,8 +1168,8 @@
11691169 }
11701170
11711171 /**
1172 - * If patrol is possible, output a patrol UI box. This is called from the
1173 - * footer section of ordinary page views. If patrol is not possible or not
 1172+ * If patrol is possible, output a patrol UI box. This is called from the
 1173+ * footer section of ordinary page views. If patrol is not possible or not
11741174 * desired, does nothing.
11751175 */
11761176 public function showPatrolFooter() {
@@ -1199,10 +1199,10 @@
12001200 ) .
12011201 '</div>'
12021202 );
1203 - }
 1203+ }
12041204
12051205 /**
1206 - * Show the error text for a missing article. For articles in the MediaWiki
 1206+ * Show the error text for a missing article. For articles in the MediaWiki
12071207 * namespace, show the default message text. To be called from Article::view().
12081208 */
12091209 public function showMissingArticle() {
@@ -1225,13 +1225,13 @@
12261226 array( 'lim' => 10,
12271227 'conds' => array( "log_action != 'revision'" ),
12281228 'showIfEmpty' => false,
1229 - 'msgKey' => array( 'moveddeleted-notice' ) )
 1229+ 'msgKey' => array( 'moveddeleted-notice' ) )
12301230 );
12311231
12321232 # Show error message
12331233 $oldid = $this->getOldID();
12341234 if( $oldid ) {
1235 - $text = wfMsgNoTrans( 'missing-article',
 1235+ $text = wfMsgNoTrans( 'missing-article',
12361236 $this->mTitle->getPrefixedText(),
12371237 wfMsgNoTrans( 'missingarticle-rev', $oldid ) );
12381238 } elseif ( $this->mTitle->getNamespace() === NS_MEDIAWIKI ) {
@@ -1241,7 +1241,7 @@
12421242 $createErrors = $this->mTitle->getUserPermissionsErrors( 'create', $wgUser );
12431243 $editErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser );
12441244 $errors = array_merge( $createErrors, $editErrors );
1245 -
 1245+
12461246 if ( !count($errors) )
12471247 $text = wfMsgNoTrans( 'noarticletext' );
12481248 else
@@ -1257,7 +1257,7 @@
12581258 }
12591259
12601260 /**
1261 - * If the revision requested for view is deleted, check permissions.
 1261+ * If the revision requested for view is deleted, check permissions.
12621262 * Send either an error message or a warning header to $wgOut.
12631263 * Returns true if the view is allowed, false if not.
12641264 */
@@ -1322,9 +1322,9 @@
13231323 }
13241324
13251325 /**
1326 - * Try to fetch an expired entry from the parser cache. If it is present,
1327 - * output it and return true. If it is not present, output nothing and
1328 - * return false. This is used as a callback function for
 1326+ * Try to fetch an expired entry from the parser cache. If it is present,
 1327+ * output it and return true. If it is not present, output nothing and
 1328+ * return false. This is used as a callback function for
13291329 * PoolCounter::executeProtected().
13301330 */
13311331 public function tryDirtyCache() {
@@ -1358,7 +1358,7 @@
13591359 $wgOut->enableClientCache( false );
13601360 $wgOut->setRobotPolicy( 'noindex,nofollow' );
13611361 $wgOut->addWikiText(
1362 - '<div class="errorbox">' .
 1362+ '<div class="errorbox">' .
13631363 $status->getWikiText( false, 'view-pool-error' ) .
13641364 '</div>'
13651365 );
@@ -1575,7 +1575,7 @@
15761576 * Giving 0 indicates the new page flag should be set
15771577 * on.
15781578 * @param $lastRevIsRedirect Boolean: if given, will optimize adding and
1579 - * removing rows in redirect table.
 1579+ * removing rows in redirect table.
15801580 * @return bool true on success, false on failure
15811581 * @private
15821582 */
@@ -1616,9 +1616,9 @@
16171617 *
16181618 * @param $dbw Database
16191619 * @param $redirectTitle a title object pointing to the redirect target,
1620 - * or NULL if this is not a redirect
 1620+ * or NULL if this is not a redirect
16211621 * @param $lastRevIsRedirect If given, will optimize adding and
1622 - * removing rows in redirect table.
 1622+ * removing rows in redirect table.
16231623 * @return bool true on success, false on failure
16241624 * @private
16251625 */
@@ -2159,7 +2159,6 @@
21602160 /**
21612161 * User-interface handler for the "watch" action
21622162 */
2163 -
21642163 public function watch() {
21652164 global $wgUser, $wgOut;
21662165 if( $wgUser->isAnon() ) {
@@ -2257,7 +2256,7 @@
22582257 */
22592258 public function updateRestrictions( $limit = array(), $reason = '', &$cascade = 0, $expiry = array() ) {
22602259 global $wgUser, $wgContLang;
2261 -
 2260+
22622261 $restrictionTypes = $this->mTitle->getRestrictionTypes();
22632262
22642263 $id = $this->mTitle->getArticleID();
@@ -2640,7 +2639,7 @@
26412640 //return $dbr->selectField( 'revision', 'COUNT(*)',
26422641 // array( 'rev_page' => $this->getId() ), __METHOD__ );
26432642 return $dbr->estimateRowCount( 'revision', '*',
2644 - array( 'rev_page' => $this->getId() ), __METHOD__ );
 2643+ array( 'rev_page' => $this->getId() ), __METHOD__ );
26452644 }
26462645
26472646 /**
@@ -2707,7 +2706,7 @@
27082707 $wgOut->setSubtitle( wfMsgHtml( 'delete-backlink', $deleteBackLink ) );
27092708 $wgOut->setRobotPolicy( 'noindex,nofollow' );
27102709 $wgOut->addWikiMsg( 'confirmdeletetext' );
2711 -
 2710+
27122711 wfRunHooks( 'ArticleConfirmDelete', array( $this, $wgOut, &$reason ) );
27132712
27142713 if( $wgUser->isAllowed( 'suppressrevision' ) ) {
@@ -3060,10 +3059,10 @@
30613060 $user_text = $dbw->addQuotes( $current->getRawUserText() );
30623061 $s = $dbw->selectRow( 'revision',
30633062 array( 'rev_id', 'rev_timestamp', 'rev_deleted' ),
3064 - array( 'rev_page' => $current->getPage(),
 3063+ array( 'rev_page' => $current->getPage(),
30653064 "rev_user != {$user} OR rev_user_text != {$user_text}"
30663065 ), __METHOD__,
3067 - array( 'USE INDEX' => 'page_timestamp',
 3066+ array( 'USE INDEX' => 'page_timestamp',
30683067 'ORDER BY' => 'rev_timestamp DESC' )
30693068 );
30703069 if( $s === false ) {
@@ -3495,7 +3494,7 @@
34963495 $r = "\n\t\t\t\t<div id=\"mw-{$infomsg}\">" .
34973496 wfMsgExt(
34983497 $infomsg,
3499 - array( 'parseinline', 'replaceafter' ),
 3498+ array( 'parseinline', 'replaceafter' ),
35003499 $td,
35013500 $userlinks,
35023501 $revision->getID(),
@@ -3698,7 +3697,6 @@
36993698 *
37003699 * @param $title a title object
37013700 */
3702 -
37033701 public static function onArticleCreate( $title ) {
37043702 # Update existence markers on article/talk tabs...
37053703 if( $title->isTalkPage() ) {
@@ -3980,7 +3978,7 @@
39813979 $this->mParserOutput = $this->getOutputFromWikitext( $text, $cache, $parserOptions );
39823980 $wgOut->addParserOutput( $this->mParserOutput );
39833981 }
3984 -
 3982+
39853983 /**
39863984 * This does all the heavy lifting for outputWikitext, except it returns the parser
39873985 * output instead of sending it straight to $wgOut. Makes things nice and simple for,
@@ -4103,8 +4101,10 @@
41044102 }
41054103 $insertRows = array();
41064104 foreach( $insertCats as $cat ) {
4107 - $insertRows[] = array( 'cat_id' => $dbw->nextSequenceValue( 'category_cat_id_seq' ),
4108 - 'cat_title' => $cat );
 4105+ $insertRows[] = array(
 4106+ 'cat_id' => $dbw->nextSequenceValue( 'category_cat_id_seq' ),
 4107+ 'cat_title' => $cat
 4108+ );
41094109 }
41104110 $dbw->insert( 'category', $insertRows, __METHOD__, 'IGNORE' );
41114111
@@ -4135,10 +4135,11 @@
41364136 );
41374137 }
41384138 }
4139 -
 4139+
41404140 /** Lightweight method to get the parser output for a page, checking the parser cache
4141 - * and so on. Doesn't consider most of the stuff that Article::view is forced to
4142 - * consider, so it's not appropriate to use there. */
 4141+ * and so on. Doesn't consider most of the stuff that Article::view is forced to
 4142+ * consider, so it's not appropriate to use there.
 4143+ */
41434144 function getParserOutput( $oldid = null ) {
41444145 global $wgEnableParserCache, $wgUser, $wgOut;
41454146
@@ -4146,8 +4147,8 @@
41474148 $useParserCache = $wgEnableParserCache &&
41484149 intval( $wgUser->getOption( 'stubthreshold' ) ) == 0 &&
41494150 $this->exists() &&
4150 - $oldid === null;
4151 -
 4151+ $oldid === null;
 4152+
41524153 wfDebug( __METHOD__.': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
41534154 if ( $wgUser->getOption( 'stubthreshold' ) ) {
41544155 wfIncrStats( 'pcache_miss_stub' );
@@ -4161,7 +4162,7 @@
41624163 if ( $parserOutput === false ) {
41634164 // Cache miss; parse and output it.
41644165 $rev = Revision::newFromTitle( $this->getTitle(), $oldid );
4165 -
 4166+
41664167 return $this->getOutputFromWikitext( $rev->getText(), $useParserCache );
41674168 } else {
41684169 return $parserOutput;

Status & tagging log