check that $wgArticle is an instance of the Article class in Skin::pageStats() per...
[lhc/web/wiklou.git] / includes / WatchedItem.php
index 6398639..2d2d34f 100644 (file)
@@ -1,28 +1,30 @@
 <?php
 /**
- *
+ * @file
+ * @ingroup Watchlist
  */
 
 /**
- *
+ * @ingroup Watchlist
  */
 class WatchedItem {
-       var $mTitle, $mUser;
+       var $mTitle, $mUser, $id, $ns, $ti;
 
        /**
         * Create a WatchedItem object with the given user and title
-        * @todo document
-        * @access private
+        * @param $user User: the user to use for (un)watching
+        * @param $title Title: the title we're going to (un)watch
+        * @return WatchedItem object
         */
-       static function fromUserTitle( $user, $title ) {
+       public static function fromUserTitle( $user, $title ) {
                $wl = new WatchedItem;
                $wl->mUser = $user;
                $wl->mTitle = $title;
                $wl->id = $user->getId();
-# Patch (also) for email notification on page changes T.Gries/M.Arndt 11.09.2004
-# TG patch: here we do not consider pages and their talk pages equivalent - why should we ?
-# The change results in talk-pages not automatically included in watchlists, when their parent page is included
-#              $wl->ns = $title->getNamespace() & ~1;
+               # Patch (also) for email notification on page changes T.Gries/M.Arndt 11.09.2004
+               # TG patch: here we do not consider pages and their talk pages equivalent - why should we ?
+               # The change results in talk-pages not automatically included in watchlists, when their parent page is included
+               # $wl->ns = $title->getNamespace() & ~1;
                $wl->ns = $title->getNamespace();
 
                $wl->ti = $title->getDBkey();
@@ -31,8 +33,9 @@ class WatchedItem {
 
        /**
         * Is mTitle being watched by mUser?
+        * @return bool
         */
-       function isWatched() {
+       public function isWatched() {
                # Pages and their talk pages are considered equivalent for watching;
                # remember that talk namespaces are numbered as page namespace+1.
                $fname = 'WatchedItem::isWatched';
@@ -45,9 +48,11 @@ class WatchedItem {
        }
 
        /**
-        * @todo document
+        * Given a title and user (assumes the object is setup), add the watch to the
+        * database.
+        * @return bool (always true)
         */
-       function addWatch() {
+       public function addWatch() {
                $fname = 'WatchedItem::addWatch';
                wfProfileIn( $fname );
 
@@ -76,7 +81,11 @@ class WatchedItem {
                return true;
        }
 
-       function removeWatch() {
+       /**
+        * Same as addWatch, only the opposite.
+        * @return bool
+        */
+       public function removeWatch() {
                $fname = 'WatchedItem::removeWatch';
 
                $success = false;
@@ -114,14 +123,17 @@ class WatchedItem {
         * Check if the given title already is watched by the user, and if so
         * add watches on a new title. To be used for page renames and such.
         *
-        * @param Title $ot Page title to duplicate entries from, if present
-        * @param Title $nt Page title to add watches on
+        * @param $ot Title: page title to duplicate entries from, if present
+        * @param $nt Title: page title to add watches on
         */
-       static function duplicateEntries( $ot, $nt ) {
+       public static function duplicateEntries( $ot, $nt ) {
                WatchedItem::doDuplicateEntries( $ot->getSubjectPage(), $nt->getSubjectPage() );
                WatchedItem::doDuplicateEntries( $ot->getTalkPage(), $nt->getTalkPage() );
        }
 
+       /**
+        * Handle duplicate entries. Backend for duplicateEntries().
+        */
        private static function doDuplicateEntries( $ot, $nt ) {
                $fname = "WatchedItem::duplicateEntries";
                $oldnamespace = $ot->getNamespace();