r91208 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91207‎ | r91208 | r91209 >
Date:19:44, 30 June 2011
Author:aaron
Status:ok
Tags:
Comment:
* Marked WikiCategoryPage::hasViewableContent() as "public"
* Renamed WikiPage::getID -> WikiPage::getId
* Fixed undefined $changed var from r91180
* Various doc tweaks
Modified paths:
  • /trunk/phase3/includes/WikiCategoryPage.php (modified) (history)
  • /trunk/phase3/includes/WikiPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WikiPage.php
@@ -13,21 +13,24 @@
1414 * @internal documentation reviewed 15 Mar 2010
1515 */
1616 class WikiPage extends Page {
 17+ /**
 18+ * @var Title
 19+ * @protected
 20+ */
 21+ public $mTitle = null;
 22+
1723 /**@{{
1824 * @protected
19 - * Fields are public for backwards-compatibility. Use accessors.
20 - * In the past, this class was part of Article.php and everything was public.
2125 */
22 - public $mTitle = null; // !< Title object
23 - public $mCounter = -1; // !< Not loaded
24 - public $mDataLoaded = false; // !<
25 - public $mIsRedirect = false; // !<
26 - public $mLatest = false; // !<
27 - public $mPreparedEdit = false; // !<
 26+ public $mCounter = -1; // !< Integer (-1 means "not loaded")
 27+ public $mDataLoaded = false; // !< Boolean
 28+ public $mIsRedirect = false; // !< Boolean
 29+ public $mLatest = false; // !< Boolean
 30+ public $mPreparedEdit = false; // !< Array
2831 public $mRedirectTarget = null; // !< Title object
2932 public $mLastRevision = null; // !< Revision object
30 - public $mTimestamp = ''; // !<
31 - public $mTouched = '19700101000000'; // !<
 33+ public $mTimestamp = ''; // !< String
 34+ public $mTouched = '19700101000000'; // !< String
3235 /**@}}*/
3336
3437 /**
@@ -78,7 +81,7 @@
7982 $dbr = wfGetDB( DB_SLAVE );
8083 $row = $dbr->selectRow( 'redirect',
8184 array( 'rd_namespace', 'rd_title', 'rd_fragment', 'rd_interwiki' ),
82 - array( 'rd_from' => $this->getID() ),
 85+ array( 'rd_from' => $this->getId() ),
8386 __METHOD__
8487 );
8588
@@ -118,7 +121,7 @@
119122 $dbw = wfGetDB( DB_MASTER );
120123 $dbw->replace( 'redirect', array( 'rd_from' ),
121124 array(
122 - 'rd_from' => $this->getID(),
 125+ 'rd_from' => $this->getId(),
123126 'rd_namespace' => $rt->getNamespace(),
124127 'rd_title' => $rt->getDBkey(),
125128 'rd_fragment' => $rt->getFragment(),
@@ -331,7 +334,7 @@
332335 /**
333336 * @return int Page ID
334337 */
335 - public function getID() {
 338+ public function getId() {
336339 return $this->mTitle->getArticleID();
337340 }
338341
@@ -359,7 +362,7 @@
360363 */
361364 public function getCount() {
362365 if ( -1 == $this->mCounter ) {
363 - $id = $this->getID();
 366+ $id = $this->getId();
364367
365368 if ( $id == 0 ) {
366369 $this->mCounter = 0;
@@ -447,7 +450,7 @@
448451 }
449452
450453 # New or non-existent articles have no user information
451 - $id = $this->getID();
 454+ $id = $this->getId();
452455 if ( 0 == $id ) {
453456 return;
454457 }
@@ -683,7 +686,7 @@
684687 }
685688
686689 if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
687 - if ( $this->getID() == 0 ) {
 690+ if ( $this->getId() == 0 ) {
688691 $text = false;
689692 } else {
690693 $text = $this->getRawText();
@@ -1850,8 +1853,8 @@
18511854 }
18521855
18531856 # Don't update page view counters on views from bot users (bug 14044)
1854 - if ( !$wgDisableCounters && !$user->isAllowed( 'bot' ) && $this->getID() ) {
1855 - $wgDeferredUpdateList[] = new ViewCountUpdate( $this->getID() );
 1857+ if ( !$wgDisableCounters && !$user->isAllowed( 'bot' ) && $this->getId() ) {
 1858+ $wgDeferredUpdateList[] = new ViewCountUpdate( $this->getId() );
18561859 $wgDeferredUpdateList[] = new SiteStatsUpdate( 1, 0, 0 );
18571860 }
18581861
@@ -1954,7 +1957,7 @@
19551958 }
19561959 }
19571960
1958 - $id = $this->getID();
 1961+ $id = $this->getId();
19591962 $title = $this->mTitle->getPrefixedDBkey();
19601963 $shortTitle = $this->mTitle->getDBkey();
19611964
@@ -1980,11 +1983,12 @@
19811984 $wgDeferredUpdateList[] = new SiteStatsUpdate( 0, 1, $good, $total );
19821985 $wgDeferredUpdateList[] = new SearchUpdate( $id, $title, $text );
19831986
1984 - # If this is another user's talk page, update newtalk
1985 - # Don't do this if $changed = false otherwise some idiot can null-edit a
1986 - # load of user talk pages and piss people off, nor if it's a minor edit
1987 - # by a properly-flagged bot.
1988 - if ( $this->mTitle->getNamespace() == NS_USER_TALK && $shortTitle != $user->getTitleKey() && $changed
 1987+ # If this is another user's talk page, update newtalk.
 1988+ # Don't do this if $options['changed'] = false (null-edits) nor if
 1989+ # it's a minor edit and the user doesn't want notifications for those.
 1990+ if ( $options['changed']
 1991+ && $this->mTitle->getNamespace() == NS_USER_TALK
 1992+ && $shortTitle != $user->getTitleKey()
19891993 && !( $revision->isMinor() && $user->isAllowed( 'nominornewtalk' ) )
19901994 ) {
19911995 if ( wfRunHooks( 'ArticleEditUpdateNewTalk', array( &$this ) ) ) {
Index: trunk/phase3/includes/WikiCategoryPage.php
@@ -19,7 +19,7 @@
2020 * In use defined as: either the actual page exists
2121 * or the category currently has members.
2222 */
23 - function hasViewableContent() {
 23+ public function hasViewableContent() {
2424 if ( parent::hasViewableContent() ) {
2525 return true;
2626 } else {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r91180Fixes for r88113 and some realted changes:...ialex15:26, 30 June 2011

Status & tagging log