Replaced all deprecated Linker methods with proper ones in core(1)
[lhc/web/wiklou.git] / includes / RevisionList.php
index 811870c..53cf699 100644 (file)
@@ -20,6 +20,8 @@
  * @file
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * List for revision table items for a single page
  */
@@ -81,7 +83,7 @@ abstract class RevisionListBase extends ContextSource implements Iterator {
         */
        public function reset() {
                if ( !$this->res ) {
-                       $this->res = $this->doQuery( wfGetDB( DB_SLAVE ) );
+                       $this->res = $this->doQuery( wfGetDB( DB_REPLICA ) );
                } else {
                        $this->res->rewind();
                }
@@ -268,6 +270,14 @@ abstract class RevisionItemBase {
         * This is used to show the list in HTML form, by the special page.
         */
        abstract public function getHTML();
+
+       /**
+        * Returns an instance of LinkRenderer
+        * @return \MediaWiki\Linker\LinkRenderer
+        */
+       protected function getLinkRenderer() {
+               return MediaWikiServices::getInstance()->getLinkRenderer();
+       }
 }
 
 class RevisionList extends RevisionListBase {
@@ -353,13 +363,14 @@ class RevisionItem extends RevisionItemBase {
         * @return string
         */
        protected function getRevisionLink() {
-               $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
-                       $this->revision->getTimestamp(), $this->list->getUser() ) );
+               $date = $this->list->getLanguage()->userTimeAndDate(
+                       $this->revision->getTimestamp(), $this->list->getUser() );
 
                if ( $this->isDeleted() && !$this->canViewContent() ) {
-                       return $date;
+                       return htmlspecialchars( $date );
                }
-               return Linker::linkKnown(
+               $linkRenderer = $this->getLinkRenderer();
+               return $linkRenderer->makeKnownLink(
                        $this->list->title,
                        $date,
                        [],
@@ -381,9 +392,10 @@ class RevisionItem extends RevisionItemBase {
                if ( $this->isDeleted() && !$this->canViewContent() ) {
                        return $this->context->msg( 'diff' )->escaped();
                } else {
-                       return Linker::linkKnown(
+                       $linkRenderer = $this->getLinkRenderer();
+                       return $linkRenderer->makeKnownLink(
                                        $this->list->title,
-                                       $this->list->msg( 'diff' )->escaped(),
+                                       $this->list->msg( 'diff' )->text(),
                                        [],
                                        [
                                                'diff' => $this->revision->getId(),