From: Aryeh Gregor Date: Fri, 24 Apr 2009 17:20:48 +0000 (+0000) Subject: (bug 16950) Show move log when recreating a page X-Git-Tag: 1.31.0-rc.0~42046 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=a1f8c5acb1222761074740af365b5f216f288c9c;p=lhc%2Fweb%2Fwiklou.git (bug 16950) Show move log when recreating a page Showing the move log as well as delete log helps with pages that were moved with no redirect, or moved and then the redirect deleted with a confusing message. Previously, such pages would appear to have never existed to a user trying to create them. Patch by church of emacs, with trivial modifications by me. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0d9b0a41b9..3476fd03ff 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -171,6 +171,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN to Special:Version * Added $wgExtPGAlteredFields to allow extensions to easily alter the data type of columns when using the Postgres backend. +* (bug 16950) Show move log when viewing/creating a deleted page === Bug fixes in 1.15 === diff --git a/includes/Article.php b/includes/Article.php index 339199e47b..eaa4bc2d21 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -883,9 +883,9 @@ class Article { } # Fetch content and check for errors if( !$outputDone ) { - # If the article does not exist and was deleted, show the log + # If the article does not exist and was deleted/moved, show the log if( $this->getID() == 0 ) { - $this->showDeletionLog(); + $this->showLogs(); } $text = $this->getContent(); // For now, check also for ID until getContent actually returns @@ -1062,14 +1062,14 @@ class Article { wfProfileOut( __METHOD__ ); } - protected function showDeletionLog() { + protected function showLogs() { global $wgUser, $wgOut; $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut ); - $pager = new LogPager( $loglist, 'delete', false, $this->mTitle->getPrefixedText() ); + $pager = new LogPager( $loglist, array('move', 'delete'), false, $this->mTitle->getPrefixedText() ); if( $pager->getNumRows() > 0 ) { $pager->mLimit = 10; $wgOut->addHTML( '
' ); - $wgOut->addWikiMsg( 'deleted-notice' ); + $wgOut->addWikiMsg( 'moveddeleted-notice' ); $wgOut->addHTML( $loglist->beginLogEventsList() . $pager->getBody() . @@ -1078,9 +1078,9 @@ class Article { if( $pager->getNumRows() > 10 ) { $wgOut->addHTML( $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'Log' ), - wfMsgHtml( 'deletelog-fulllog' ), + wfMsgHtml( 'log-fulllog' ), array(), - array( 'type' => 'delete', 'page' => $this->mTitle->getPrefixedText() ) + array( 'page' => $this->mTitle->getPrefixedText() ) ) ); } $wgOut->addHTML( '
' ); diff --git a/includes/EditPage.php b/includes/EditPage.php index 3589b52d3a..6dbee62153 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -707,9 +707,9 @@ class EditPage { $wgOut->wrapWikiMsg( '
$1
', 'newarticletextanon' ); } } - # Give a notice if the user is editing a deleted page... + # Give a notice if the user is editing a deleted/moved page... if ( !$this->mTitle->exists() ) { - $this->showDeletionLog( $wgOut ); + $this->showLogs( $wgOut ); } } @@ -2435,20 +2435,20 @@ END } /** - * If there are rows in the deletion log for this page, show them, + * If there are rows in the deletion/move log for this page, show them, * along with a nice little note for the user * * @param OutputPage $out */ - protected function showDeletionLog( $out ) { + protected function showLogs( $out ) { global $wgUser; $loglist = new LogEventsList( $wgUser->getSkin(), $out ); - $pager = new LogPager( $loglist, 'delete', false, $this->mTitle->getPrefixedText() ); + $pager = new LogPager( $loglist, array('move', 'delete'), false, $this->mTitle->getPrefixedText() ); $count = $pager->getNumRows(); if ( $count > 0 ) { $pager->mLimit = 10; $out->addHTML( '
' ); - $out->addWikiMsg( 'recreate-deleted-warn' ); + $out->addWikiMsg( 'recreate-moveddeleted-warn' ); $out->addHTML( $loglist->beginLogEventsList() . $pager->getBody() . @@ -2457,11 +2457,9 @@ END if($count > 10){ $out->addHTML( $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'Log' ), - wfMsgHtml( 'deletelog-fulllog' ), + wfMsgHtml( 'log-fulllog' ), array(), - array( - 'type' => 'delete', - 'page' => $this->mTitle->getPrefixedText() ) ) ); + array( 'page' => $this->mTitle->getPrefixedText() ) ) ); } $out->addHTML( '
' ); return true; diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index 8baf12e305..7acebc05d0 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -541,24 +541,28 @@ class LogPager extends ReverseChronologicalPager { /** * Set the log reader to return only entries of the given type. * Type restrictions enforced here - * @param $type String: A log type ('upload', 'delete', etc) + * @param $type String or array: Log types ('upload', 'delete', etc) */ - private function limitType( $type ) { + private function limitType( $types ) { global $wgLogRestrictions, $wgUser; + // If $types is not an array, make it an array + $types = (array)$types; // Don't even show header for private logs; don't recognize it... - if( isset($wgLogRestrictions[$type]) && !$wgUser->isAllowed($wgLogRestrictions[$type]) ) { - $type = ''; + foreach ( $types as $type ) { + if( isset( $wgLogRestrictions[$type] ) && !$wgUser->isAllowed($wgLogRestrictions[$type]) ) { + $types = array_diff( $types, array( $type ) ); + } } - // Don't show private logs to unpriviledged users. + // Don't show private logs to unprivileged users. // Also, only show them upon specific request to avoid suprises. - $audience = $type ? 'user' : 'public'; + $audience = $types ? 'user' : 'public'; $hideLogs = LogEventsList::getExcludeClause( $this->mDb, $audience ); if( $hideLogs !== false ) { $this->mConds[] = $hideLogs; } - if( $type ) { - $this->type = $type; - $this->mConds['log_type'] = $type; + if( $types ) { + $this->type = $types; + $this->mConds['log_type'] = $types; } } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 0eadd8d9a1..77d4637914 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1213,13 +1213,13 @@ You can go back and edit an existing page, or [[Special:UserLogin|log in or crea 'permissionserrors' => 'Permissions Errors', 'permissionserrorstext' => 'You do not have permission to do that, for the following {{PLURAL:$1|reason|reasons}}:', 'permissionserrorstext-withaction' => 'You do not have permission to $2, for the following {{PLURAL:$1|reason|reasons}}:', -'recreate-deleted-warn' => "'''Warning: You are recreating a page that was previously deleted.''' +'recreate-moveddeleted-warn' => "'''Warning: You are recreating a page that was previously deleted.''' You should consider whether it is appropriate to continue editing this page. -The deletion log for this page is provided here for convenience:", -'deleted-notice' => 'This page has been deleted. -The deletion log for the page is provided below for reference.', -'deletelog-fulllog' => 'View full log', +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.', +'log-fulllog' => 'View full log', 'edit-hook-aborted' => 'Edit aborted by hook. It gave no explanation.', 'edit-gone-missing' => 'Could not update the page.