Merge "Handle missing namespace prefix in XML dumps more gracefully"
[lhc/web/wiklou.git] / includes / actions / HistoryAction.php
index 767a163..d1be7d4 100644 (file)
@@ -24,6 +24,8 @@
  */
 
 use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\FakeResultWrapper;
 
 /**
  * This class handles printing the history page for an article. In order to
@@ -146,6 +148,9 @@ class HistoryAction extends FormlessAction {
                                $out->setStatusCode( 404 );
                        }
                        $out->addWikiMsg( 'nohistory' );
+
+                       $dbr = wfGetDB( DB_REPLICA );
+
                        # show deletion/move log if there is an entry
                        LogEventsList::showLogExtract(
                                $out,
@@ -153,7 +158,7 @@ class HistoryAction extends FormlessAction {
                                $this->getTitle(),
                                '',
                                [ 'lim' => 10,
-                                       'conds' => [ "log_action != 'revision'" ],
+                                       'conds' => [ 'log_action != ' . $dbr->addQuotes( 'revision' ) ],
                                        'showIfEmpty' => false,
                                        'msgKey' => [ 'moveddeleted-notice' ]
                                ]
@@ -428,7 +433,10 @@ class HistoryPager extends ReverseChronologicalPager {
                        $queryInfo['options'],
                        $this->tagFilter
                );
-               Hooks::run( 'PageHistoryPager::getQueryInfo', [ &$this, &$queryInfo ] );
+
+               // Avoid PHP 7.1 warning of passing $this by reference
+               $historyPager = $this;
+               Hooks::run( 'PageHistoryPager::getQueryInfo', [ &$historyPager, &$queryInfo ] );
 
                return $queryInfo;
        }