From 1e40bfe6d04cf72e2ed62f80a1fef5841a1266a2 Mon Sep 17 00:00:00 2001 From: Matthias Mullie Date: Tue, 29 Oct 2013 12:15:18 +0100 Subject: [PATCH] Give extensions a chance to hide their (unrelated) log entries Change-Id: Id8b0f29d6e2ac9d7cab8f3d1efcb202062a6ad0b --- HISTORY | 2 ++ docs/hooks.txt | 7 +++++++ includes/Article.php | 9 +++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/HISTORY b/HISTORY index 88cc906d4f..0e7de0c3ed 100644 --- a/HISTORY +++ b/HISTORY @@ -122,6 +122,8 @@ production. correctly. * (bug 45803) Whitespace within == Headline == syntax and within headings is now non-significant and not preserved in the HTML output. +* Added Article::MissingArticleConditions hook to give extensions a chance to + hide their (unrelated) log entries. === Bug fixes in 1.21 === * (bug 40353) SpecialDoubleRedirect should support interwiki redirects. diff --git a/docs/hooks.txt b/docs/hooks.txt index 1cd112b53e..d56886c93c 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -461,6 +461,13 @@ types. &$tokenTypes: supported token types in format 'type' => callback function used to retrieve this type of tokens. +'Article::MissingArticleConditions': Before fetching deletion & move log entries +to display a message of a non-existing page being deleted/moved, give extensions +a chance to hide their (unrelated) log entries. +&$conds: Array of query conditions (all of which have to be met; conditions will +AND in the final query) +$logTypes: Array of log types being queried + 'ArticleAfterFetchContent': After fetching content of an article from the database. DEPRECATED, use ArticleAfterFetchContentObject instead. $article: the article (object) being loaded from the database diff --git a/includes/Article.php b/includes/Article.php index 1619e09527..854f7f1113 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1201,10 +1201,15 @@ class Article implements Page { wfRunHooks( 'ShowMissingArticle', array( $this ) ); + // Give extensions a chance to hide their (unrelated) log entries + $logTypes = array( 'delete', 'move' ); + $conds = array( "log_action != 'revision'" ); + wfRunHooks( 'Article::MissingArticleConditions', array( &$conds, $logTypes ) ); + # Show delete and move logs - LogEventsList::showLogExtract( $outputPage, array( 'delete', 'move' ), $this->getTitle(), '', + LogEventsList::showLogExtract( $outputPage, $logTypes, $this->getTitle(), '', array( 'lim' => 10, - 'conds' => array( "log_action != 'revision'" ), + 'conds' => $conds, 'showIfEmpty' => false, 'msgKey' => array( 'moveddeleted-notice' ) ) ); -- 2.20.1