r40860 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40859‎ | r40860 | r40861 >
Date:17:40, 15 September 2008
Author:demon
Status:old
Tags:
Comment:
Minor cleanup (docs, visibilities, formatting)
Modified paths:
  • /trunk/phase3/includes/WatchedItem.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WatchedItem.php
@@ -8,22 +8,23 @@
99 * @ingroup Watchlist
1010 */
1111 class WatchedItem {
12 - var $mTitle, $mUser;
 12+ var $mTitle, $mUser, $id, $ns, $ti;
1313
1414 /**
1515 * Create a WatchedItem object with the given user and title
16 - * @todo document
17 - * @access private
 16+ * @param User $user The user to use for (un)watching
 17+ * @param Title $title The title we're going to (un)watch
 18+ * @return WatchedItem object
1819 */
19 - static function fromUserTitle( $user, $title ) {
 20+ public static function fromUserTitle( $user, $title ) {
2021 $wl = new WatchedItem;
2122 $wl->mUser = $user;
2223 $wl->mTitle = $title;
2324 $wl->id = $user->getId();
24 -# Patch (also) for email notification on page changes T.Gries/M.Arndt 11.09.2004
25 -# TG patch: here we do not consider pages and their talk pages equivalent - why should we ?
26 -# The change results in talk-pages not automatically included in watchlists, when their parent page is included
27 -# $wl->ns = $title->getNamespace() & ~1;
 25+ # Patch (also) for email notification on page changes T.Gries/M.Arndt 11.09.2004
 26+ # TG patch: here we do not consider pages and their talk pages equivalent - why should we ?
 27+ # The change results in talk-pages not automatically included in watchlists, when their parent page is included
 28+ # $wl->ns = $title->getNamespace() & ~1;
2829 $wl->ns = $title->getNamespace();
2930
3031 $wl->ti = $title->getDBkey();
@@ -32,8 +33,9 @@
3334
3435 /**
3536 * Is mTitle being watched by mUser?
 37+ * @return bool
3638 */
37 - function isWatched() {
 39+ public function isWatched() {
3840 # Pages and their talk pages are considered equivalent for watching;
3941 # remember that talk namespaces are numbered as page namespace+1.
4042 $fname = 'WatchedItem::isWatched';
@@ -46,9 +48,11 @@
4749 }
4850
4951 /**
50 - * @todo document
 52+ * Given a title and user (assumes the object is setup), add the watch to the
 53+ * database.
 54+ * @return bool (always true)
5155 */
52 - function addWatch() {
 56+ public function addWatch() {
5357 $fname = 'WatchedItem::addWatch';
5458 wfProfileIn( $fname );
5559
@@ -77,7 +81,11 @@
7882 return true;
7983 }
8084
81 - function removeWatch() {
 85+ /**
 86+ * Same as addWatch, only the opposite.
 87+ * @return bool
 88+ */
 89+ public function removeWatch() {
8290 $fname = 'WatchedItem::removeWatch';
8391
8492 $success = false;
@@ -118,11 +126,14 @@
119127 * @param $ot Title: page title to duplicate entries from, if present
120128 * @param $nt Title: page title to add watches on
121129 */
122 - static function duplicateEntries( $ot, $nt ) {
 130+ public static function duplicateEntries( $ot, $nt ) {
123131 WatchedItem::doDuplicateEntries( $ot->getSubjectPage(), $nt->getSubjectPage() );
124132 WatchedItem::doDuplicateEntries( $ot->getTalkPage(), $nt->getTalkPage() );
125133 }
126134
 135+ /**
 136+ * Handle duplicate entries. Backend for duplicateEntries().
 137+ */
127138 private static function doDuplicateEntries( $ot, $nt ) {
128139 $fname = "WatchedItem::duplicateEntries";
129140 $oldnamespace = $ot->getNamespace();

Status & tagging log