Index: trunk/phase3/includes/WatchedItem.php |
— | — | @@ -8,22 +8,23 @@ |
9 | 9 | * @ingroup Watchlist |
10 | 10 | */ |
11 | 11 | class WatchedItem { |
12 | | - var $mTitle, $mUser; |
| 12 | + var $mTitle, $mUser, $id, $ns, $ti; |
13 | 13 | |
14 | 14 | /** |
15 | 15 | * 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 |
18 | 19 | */ |
19 | | - static function fromUserTitle( $user, $title ) { |
| 20 | + public static function fromUserTitle( $user, $title ) { |
20 | 21 | $wl = new WatchedItem; |
21 | 22 | $wl->mUser = $user; |
22 | 23 | $wl->mTitle = $title; |
23 | 24 | $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; |
28 | 29 | $wl->ns = $title->getNamespace(); |
29 | 30 | |
30 | 31 | $wl->ti = $title->getDBkey(); |
— | — | @@ -32,8 +33,9 @@ |
33 | 34 | |
34 | 35 | /** |
35 | 36 | * Is mTitle being watched by mUser? |
| 37 | + * @return bool |
36 | 38 | */ |
37 | | - function isWatched() { |
| 39 | + public function isWatched() { |
38 | 40 | # Pages and their talk pages are considered equivalent for watching; |
39 | 41 | # remember that talk namespaces are numbered as page namespace+1. |
40 | 42 | $fname = 'WatchedItem::isWatched'; |
— | — | @@ -46,9 +48,11 @@ |
47 | 49 | } |
48 | 50 | |
49 | 51 | /** |
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) |
51 | 55 | */ |
52 | | - function addWatch() { |
| 56 | + public function addWatch() { |
53 | 57 | $fname = 'WatchedItem::addWatch'; |
54 | 58 | wfProfileIn( $fname ); |
55 | 59 | |
— | — | @@ -77,7 +81,11 @@ |
78 | 82 | return true; |
79 | 83 | } |
80 | 84 | |
81 | | - function removeWatch() { |
| 85 | + /** |
| 86 | + * Same as addWatch, only the opposite. |
| 87 | + * @return bool |
| 88 | + */ |
| 89 | + public function removeWatch() { |
82 | 90 | $fname = 'WatchedItem::removeWatch'; |
83 | 91 | |
84 | 92 | $success = false; |
— | — | @@ -118,11 +126,14 @@ |
119 | 127 | * @param $ot Title: page title to duplicate entries from, if present |
120 | 128 | * @param $nt Title: page title to add watches on |
121 | 129 | */ |
122 | | - static function duplicateEntries( $ot, $nt ) { |
| 130 | + public static function duplicateEntries( $ot, $nt ) { |
123 | 131 | WatchedItem::doDuplicateEntries( $ot->getSubjectPage(), $nt->getSubjectPage() ); |
124 | 132 | WatchedItem::doDuplicateEntries( $ot->getTalkPage(), $nt->getTalkPage() ); |
125 | 133 | } |
126 | 134 | |
| 135 | + /** |
| 136 | + * Handle duplicate entries. Backend for duplicateEntries(). |
| 137 | + */ |
127 | 138 | private static function doDuplicateEntries( $ot, $nt ) { |
128 | 139 | $fname = "WatchedItem::duplicateEntries"; |
129 | 140 | $oldnamespace = $ot->getNamespace(); |