* Added WikiPage::getParserOutput() and changed Article::getParserOutput() to use it
[lhc/web/wiklou.git] / includes / RevisionList.php
index dfb85ee..5a9bbad 100644 (file)
@@ -8,7 +8,7 @@ abstract class RevisionListBase {
         */
        var $title;
        /**
-        * @var RequestContext
+        * @var IContextSource
         */
        var $context;
 
@@ -16,10 +16,10 @@ abstract class RevisionListBase {
 
        /**
         * Construct a revision list for a given title
-        * @param $context RequestContext
+        * @param $context IContextSource
         * @param $title Title
         */
-       function __construct( RequestContext $context, Title $title ) {
+       function __construct( IContextSource $context, Title $title ) {
                $this->context = $context;
                $this->title = $title;
        }
@@ -184,19 +184,19 @@ abstract class RevisionItemBase {
        }
 
        /**
-        * Get the date, formatted with $wgLang
+        * Get the date, formatted in user's languae
         */
        public function formatDate() {
-               global $wgLang;
-               return $wgLang->date( $this->getTimestamp() );
+               return $this->list->context->getLang()->userDate( $this->getTimestamp(),
+                       $this->list->context->getUser() );
        }
 
        /**
-        * Get the time, formatted with $wgLang
+        * Get the time, formatted in user's languae
         */
        public function formatTime() {
-               global $wgLang;
-               return $wgLang->time( $this->getTimestamp() );
+               return $this->list->context->getLang()->userTime( $this->getTimestamp(),
+                       $this->list->context->getUser() );
        }
 
        /**
@@ -250,19 +250,19 @@ class RevisionList extends RevisionListBase {
         * @return mixed
         */
        public function doQuery( $db ) {
-               $conds = array(
-                       'rev_page' => $this->title->getArticleID(),
-                       'rev_page = page_id'
-               );
+               $conds = array( 'rev_page' => $this->title->getArticleID() );
                if ( $this->ids !== null ) {
                        $conds['rev_id'] = array_map( 'intval', $this->ids );
                }
                return $db->select(
-                       array( 'revision', 'page' ),
-                       '*',
+                       array( 'revision', 'page', 'user' ),
+                       array_merge( Revision::selectFields(), Revision::selectUserFields() ),
                        $conds,
                        __METHOD__,
-                       array( 'ORDER BY' => 'rev_id DESC' )
+                       array( 'ORDER BY' => 'rev_id DESC' ),
+                       array(
+                               'page' => Revision::pageJoinCond(),
+                               'user' => Revision::userJoinCond() )
                );
        }
 
@@ -296,15 +296,15 @@ class RevisionItem extends RevisionItemBase {
        }
 
        public function getAuthorNameField() {
-               return 'rev_user_text';
+               return 'user_name'; // see Revision::selectUserFields()
        }
 
        public function canView() {
-               return $this->revision->userCan( Revision::DELETED_RESTRICTED );
+               return $this->revision->userCan( Revision::DELETED_RESTRICTED, $this->context->getUser() );
        }
 
        public function canViewContent() {
-               return $this->revision->userCan( Revision::DELETED_TEXT );
+               return $this->revision->userCan( Revision::DELETED_TEXT, $this->context->getUser() );
        }
 
        public function isDeleted() {