Merge "Add Hebrew aliases for some special pages"
[lhc/web/wiklou.git] / includes / api / ApiComparePages.php
index 4ba30ab..e096915 100644 (file)
@@ -307,10 +307,8 @@ class ApiComparePages extends ApiBase {
                foreach ( [ 'from', 'to' ] as $prefix ) {
                        if ( $params["{$prefix}rev"] !== null ) {
                                $rev = $this->getRevisionById( $params["{$prefix}rev"] );
-                               if ( $rev ) {
-                                       if ( $rev->hasSlot( $role ) ) {
-                                               return $rev->getSlot( $role, RevisionRecord::RAW )->getModel();
-                                       }
+                               if ( $rev && $rev->hasSlot( $role ) ) {
+                                       return $rev->getSlot( $role, RevisionRecord::RAW )->getModel();
                                }
                        }
                }
@@ -564,7 +562,7 @@ class ApiComparePages extends ApiBase {
         */
        private function setVals( &$vals, $prefix, $rev ) {
                if ( $rev ) {
-                       $title = $rev->getPageAsLinkTarget();
+                       $title = Title::newFromLinkTarget( $rev->getPageAsLinkTarget() );
                        if ( isset( $this->props['ids'] ) ) {
                                $vals["{$prefix}id"] = $title->getArticleID();
                                $vals["{$prefix}revid"] = $rev->getId();
@@ -605,7 +603,7 @@ class ApiComparePages extends ApiBase {
                                                $vals["{$prefix}comment"] = $comment->text;
                                        }
                                        $vals["{$prefix}parsedcomment"] = Linker::formatComment(
-                                               $comment->text, Title::newFromLinkTarget( $title )
+                                               $comment->text, $title
                                        );
                                }
                        }