* Add revText() to get non-public revision if user can, add rev_deleted constant...
authorAaron Schulz <aaron@users.mediawiki.org>
Mon, 5 Feb 2007 23:26:26 +0000 (23:26 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Mon, 5 Feb 2007 23:26:26 +0000 (23:26 +0000)
includes/Revision.php

index 3e7e77e..f5a84ca 100644 (file)
@@ -7,10 +7,11 @@
  * @todo document
  */
 class Revision {
-       const DELETED_TEXT      = 1;
-       const DELETED_COMMENT   = 2;
-       const DELETED_USER      = 4;
-       const DELETED_RESTRICTED = 8;
+       const DELETED_TEXT = 1;
+       const DELETED_COMMENT = 2;
+       const DELETED_USER = 4;
+    const DELETED_RESTRICTED = 8;
+    const DELETED_NAME = 16;
        
        /**
         * Load a page revision from a given revision ID number.
@@ -457,6 +458,18 @@ class Revision {
                }
                return $this->mText;
        }
+       
+       /**
+        * Fetch revision text if it's available to THIS user
+        * @return string
+        */
+       function revText() {
+               if( !$this->userCan( self::DELETED_TEXT ) ) {
+                       return "";
+               } else {
+                       return $this->getRawText();
+               }
+       }
 
        /**
         * @return string