X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Factions%2FHistoryAction.php;h=7460340a96474c3b0e07c6f4e1e15f7b774566fd;hb=bad0cb2a9f53b67e49d84323d835a5040676fd1e;hp=767a163e020d6070c51f66ce28b9a20ffa288017;hpb=87bfd03d13ce0cc0cdd1d93538b3c42cbf628d29;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 767a163e02..7460340a96 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -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; } @@ -772,9 +780,11 @@ class HistoryPager extends ReverseChronologicalPager { $s .= ' . . ' . $s2; } - Hooks::run( 'PageHistoryLineEnding', [ $this, &$row, &$s, &$classes ] ); + $attribs = [ 'data-mw-revid' => $rev->getId() ]; + + Hooks::run( 'PageHistoryLineEnding', [ $this, &$row, &$s, &$classes, &$attribs ] ); + $attribs = wfArrayFilterByKey( $attribs, [ Sanitizer::class, 'isReservedDataAttribute' ] ); - $attribs = []; if ( $classes ) { $attribs['class'] = implode( ' ', $classes ); }