From 71a97237b552a98dd45cf2f14f714bc4e36a8ff4 Mon Sep 17 00:00:00 2001 From: Alex Z Date: Mon, 14 Sep 2009 18:10:13 +0000 Subject: [PATCH] Replace the user rename log display for non-existent userpages with a hook (followup to r56251). Update for Renameuser extension to follow. Also make docs for LogEventsList::showLogExtract() actually useful --- RELEASE-NOTES | 5 +++-- docs/hooks.txt | 3 +++ includes/Article.php | 7 ++----- includes/LogEventsList.php | 20 ++++++++++---------- languages/messages/MessagesEn.php | 2 -- maintenance/language/messages.inc | 1 - 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 384c4602b8..74617376c5 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -222,8 +222,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN excerpt from the block log. * (bug 19646) New hook: ImgAuthBeforeStream for tests and functionality before file is streamed to user, but only when using img_auth -* Note on non-existing user and user talk pages if user does not exist and show - renameuser log if the user has been renamed +* Note on non-existing user and user talk pages if user does not exist +* New hook ShowMissingArticle so extensions can modify the output for + non-existent pages. === Bug fixes in 1.16 === diff --git a/docs/hooks.txt b/docs/hooks.txt index eae869197e..11a0e50e34 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1231,6 +1231,9 @@ $term : Search term string 'SetupAfterCache': Called in Setup.php, after cache objects are set +'ShowMissingArticle': Called when generating the output for a non-existent page +$article: The article object corresponding to the page + 'ShowRawCssJs': Customise the output of raw CSS and JavaScript in page views $text: Text being shown $title: Title of the custom script/stylesheet page diff --git a/includes/Article.php b/includes/Article.php index 5999ea4cdd..cb32a14126 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1201,20 +1201,17 @@ class Article { public function showMissingArticle() { global $wgOut, $wgRequest, $wgUser; - # Show info in user (talk) namespace. Does the user exist and if not, has he been renamed. + # Show info in user (talk) namespace. Does the user exist? if ( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) { $id = User::idFromName( $this->mTitle->getBaseText() ); $ip = User::isIP( $this->mTitle->getBaseText() ); if ( $id == 0 && !$ip ) { # User does not exist $wgOut->wrapWikiMsg( '
$1
', array( 'userpage-userdoesnotexist-view', $this->mTitle->getBaseText() ) ); - - # Show rename log because user does not exist. - $parent = $this->mTitle->getNsText() . ":" . $this->mTitle->getBaseText(); - LogEventsList::showLogExtract( $wgOut, 'renameuser', $parent, '', 10, array(), false, 'renamed-notice' ); } } + wfRunHooks( 'ShowMissingArticle', array( $this ) ); # Show delete and move logs LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle->getPrefixedText(), '', 10, array( "log_action != 'revision'" ), false, 'moveddeleted-notice'); diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index 7c209f9a24..04063a9feb 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -569,10 +569,10 @@ class LogEventsList { * Show log extract. Either with text and a box (set $msgKey) or without (don't set $msgKey) * @param $out OutputPage or String-by-reference * @param $types String or Array - * @param $page String - * @param $user String + * @param $page String The page title to show log entries for + * @param $user String The user who made the log entries * @param $lim Integer Limit of items to show, default is 50 - * @param $conds Array + * @param $conds Array Extra conditions for the query * @param $showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty * if set to true (default), "No matching items in log" is displayed if loglist is empty * @param $msgKey String if you want a nice box with a message, set this to the key of the message @@ -663,13 +663,13 @@ class LogPager extends ReverseChronologicalPager { /** * constructor * @param $list LogEventsList - * @param $types String or Array - * @param $user String - * @param $title String - * @param $pattern String - * @param $conds Array - * @param $year Integer - * @param $month Integer + * @param $types String or Array log types to show + * @param $user String The user who made the log entries + * @param $title String The page title the log entries are for + * @param $pattern String Do a prefix search rather than an exact title match + * @param $conds Array Extra conditions for the query + * @param $year Integer The year to start from + * @param $month Integer The month to start from */ public function __construct( $list, $types = array(), $user = '', $title = '', $pattern = '', $conds = array(), $year = false, $month = false, $tagFilter = '' ) diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index a898ba32c7..b4749ef2bc 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1342,8 +1342,6 @@ You should consider whether it is appropriate to continue editing this page. The deletion and move log for this page are provided here for convenience:", 'moveddeleted-notice' => 'This page has been deleted. The deletion and move log for the page are provided below for reference.', -'renamed-notice' => 'This user has been renamed. -The rename log is provided below for reference.', 'log-fulllog' => 'View full log', 'edit-hook-aborted' => 'Edit aborted by hook. It gave no explanation.', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 43bd0c0ffa..d1ef3c3126 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -589,7 +589,6 @@ $wgMessageStructure = array( 'permissionserrorstext-withaction', 'recreate-moveddeleted-warn', 'moveddeleted-notice', - 'renamed-notice', 'log-fulllog', 'edit-hook-aborted', 'edit-gone-missing', -- 2.20.1