Page MenuHomePhabricator
Paste P5785

Show protection log rule on protected pages that do not exist
ArchivedPublic

Authored by Mainframe98 on Jul 22 2017, 3:36 PM.
public static function onBeforeDisplayNoArticleText( Article $article ) {
$title = $article->getTitle();
// Only display the log entry if the page actually is protected
if ( $title->isProtected() ) {
// $outputPage on LogEventsList::showLogExtract is a reference parameter,
// so it must be passed by means of a variable
$outputPage = $article->getContext()->getOutput();
LogEventsList::showLogExtract(
$outputPage,
[ 'protect' ],
$title,
'',
[
'lim' => 1,
'showIfEmpty' => false,
'msgKey' => [ 'titleprotectedwarning' ]
]
);
}
return true;
}