Move getEarliestTime() to Title
authorAaron Schulz <aaron@users.mediawiki.org>
Tue, 28 Oct 2008 13:42:05 +0000 (13:42 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Tue, 28 Oct 2008 13:42:05 +0000 (13:42 +0000)
includes/Title.php
includes/specials/SpecialUndelete.php

index 42fc685..53ba1d0 100644 (file)
@@ -3020,6 +3020,23 @@ class Title {
                );
        }
 
+       /**
+        * Get the oldest revision timestamp of this page
+        *
+        * @return string, MW timestamp
+        */
+       public function getEarliestRevTime() {
+               $dbr = wfGetDB( DB_SLAVE );
+               if( $this->exists() ) {
+                       $min = $dbr->selectField( 'revision',
+                               'MIN(rev_timestamp)',
+                               array( 'rev_page' => $this->getArticleId() ),
+                               __METHOD__ );
+                       return wfTimestampOrNull( TS_MW, $min );
+               }
+               return null;
+       }
+
        /**
         * Get the number of revisions between the given revision IDs.
         * Used for diffs and other things that really need it.
index a26d27e..9152076 100644 (file)
@@ -1033,7 +1033,7 @@ class UndeleteForm {
                        $wgOut->addHTML("<ul>");
                        $target = urlencode( $this->mTarget );
                        $remaining = $revisions->numRows();
-                       $earliestLiveTime = $this->getEarliestTime( $this->mTargetObj );
+                       $earliestLiveTime = $this->mTargetObj->getEarliestRevTime();
 
                        while( $row = $revisions->fetchObject() ) {
                                $remaining--;
@@ -1179,18 +1179,6 @@ class UndeleteForm {
                return "<li>$checkBox $revdlink $pageLink . . $userLink $data $comment</li>\n";
        }
 
-       private function getEarliestTime( $title ) {
-               $dbr = wfGetDB( DB_SLAVE );
-               if( $title->exists() ) {
-                       $min = $dbr->selectField( 'revision',
-                               'MIN(rev_timestamp)',
-                               array( 'rev_page' => $title->getArticleId() ),
-                               __METHOD__ );
-                       return wfTimestampOrNull( TS_MW, $min );
-               }
-               return null;
-       }
-
        /**
         * Fetch revision text link if it's available to all users
         * @return string