From ba113e12e5ceb6af6d0fb50c5b1a5dd07d32874c Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 17 Jan 2008 00:29:05 +0000 Subject: [PATCH] Slap some prettier warnings on too-big deletions. --- includes/Article.php | 31 +++++++++++++++++++------------ languages/messages/MessagesEn.php | 2 ++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index eace63491a..595a690fba 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1942,20 +1942,9 @@ class Article { $wgOut->showPermissionsErrorPage( $permission_errors ); return; } - - # Hack for big sites - if( $this->isBigDeletion() ) { - $permission_errors = $this->mTitle->getUserPermissionsErrors( - 'bigdelete', $wgUser ); - - if( count( $permission_errors ) > 0 ) { - $wgOut->showPermissionsErrorPage( $permission_errors ); - return; - } - } $wgOut->setPagetitle( wfMsg( 'confirmdelete' ) ); - + # Better double-check that it hasn't been deleted yet! $dbw = wfGetDB( DB_MASTER ); $conds = $this->mTitle->pageCond(); @@ -1965,6 +1954,17 @@ class Article { return; } + # Hack for big sites + $bigHistory = $this->isBigDeletion(); + if( $bigHistory && !$this->mTitle->userCan( 'bigdelete' ) ) { + global $wgLang, $wgDeleteRevisionsLimit; + $wgOut->addWikiText( "
\n" . + wfMsg( 'delete-toobig', + $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) . + "
\n" ); + return; + } + if( $confirm ) { $this->doDelete( $reason ); if( $wgRequest->getCheck( 'wpWatch' ) ) { @@ -1983,6 +1983,13 @@ class Article { if( $hasHistory && !$confirm ) { $skin=$wgUser->getSkin(); $wgOut->addHTML( '' . wfMsg( 'historywarning' ) . ' ' . $skin->historyLink() . '' ); + if( $bigHistory ) { + global $wgLang, $wgDeleteRevisionsLimit; + $wgOut->addWikiText( "
\n" . + wfMsg( 'delete-warning-toobig', + $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) . + "
\n" ); + } } return $this->confirmDelete( '', $reason ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 930ac9912c..a80dd1a494 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1917,6 +1917,8 @@ See $2 for a record of recent deletions.', ** Author request ** Copyright violation ** Vandalism', +'delete-toobig' => 'This page has a large edit history, over $1 revisions. Deletion of such pages has been restricted to prevent accidental disruption of the site.', +'delete-warning-toobig' => 'This page has a large edit history, over $1 revisions. Deleting it may disrupt database operations; proceed with caution.', 'rollback' => 'Roll back edits', 'rollback_short' => 'Rollback', 'rollbacklink' => 'rollback', -- 2.20.1