r40979 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40978‎ | r40979 | r40980 >
Date:13:33, 18 September 2008
Author:werdna
Status:old
Tags:
Comment:
Don't allow people to nominate a page already in a queue, and allow hooks to abort nomination (used in abuse filter). Includes some i18n changes whose code hasn't been committed yet.
Modified paths:
  • /trunk/extensions/DeleteQueue/DeleteQueue.i18n.php (modified) (history)
  • /trunk/extensions/DeleteQueue/DeleteQueueInterface.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DeleteQueue/DeleteQueue.i18n.php
@@ -15,18 +15,23 @@
1616 'deletequeue-desc' => 'Creates a [[Special:DeleteQueue|queue-based system for managing deletion]]',
1717
1818 // Landing page
 19+ 'deletequeue-action-queued' => 'Deletion',
1920 'deletequeue-action' => 'Suggest deletion',
2021 'deletequeue-action-title' => "Suggest deletion of \"$1\"",
2122 'deletequeue-action-text' => "{{SITENAME}} has a number of processes for deleting pages:
2223 *If you believe that this page warrants ''speedy deletion'', you may suggest that [{{fullurl:{{FULLPAGENAME}}|action=delnom&queue=speedy}} here].
2324 *If this page does not warrant speedy deletion, but ''deletion will likely be uncontroversial'', you should [{{fullurl:{{FULLPAGENAME}}|action=delnom&queue=prod}} propose uncontested deletion].
2425 *If this page's deletion is ''likely to be contested'', you should [{{fullurl:{{FULLPAGENAME}}|action=delnom&queue=deletediscuss}} open a discussion].",
 26+ 'deletequeue-action-text-queued' => "You may view the following pages for this deletion case:
 27+* [{{fullurl:{{FULLPAGENAME}}|action=delviewvotes}} View current endorsements and objections].
 28+* [{{fullurl:{{FULLPAGENAME}}|action=delvote}} Endorse or object to this page's deletion].",
2529
2630 // Permissions errors
2731 'deletequeue-permissions-noedit' => "You must be able to edit a page to be able to affect its deletion status.",
2832
2933 // Nomination forms
3034 'deletequeue-generic-reasons' => "* Generic reasons\n ** Vandalism\n ** Spam\n ** Maintenance\n ** Out of project scope",
 35+ 'deletequeue-nom-alreadyqueued' => 'This page is already in a deletion queue.',
3136
3237 // Speedy deletion
3338 'deletequeue-speedy-title' => 'Mark "$1" for speedy deletion',
@@ -60,6 +65,7 @@
6166 'right-prod-review' => 'Review uncontested deletion proposals',
6267 'right-deletediscuss-nominate' => 'Start deletion discussions',
6368 'right-deletediscuss-review' => 'Close deletion discussions',
 69+ 'right-deletequeue-vote' => 'Endorse or object to deletions',
6470
6571 // Queue names
6672 'deletequeue-queue-speedy' => 'Speedy deletion',
@@ -126,7 +132,6 @@
127133 'deletequeue-role-vote-object' => 'objector to deletion',
128134
129135 // Endorsement and objection
130 - 'deletequeue-vote-tab' => 'Endorse/Object to deletion',
131136 'deletequeue-vote-title' => 'Endorse or object to deletion of "$1"',
132137 'deletequeue-vote-text' => "You may use this form to endorse or object to the deletion of \"'''$1'''\".
133138 This action will override any previous endorsements/objections you have given to deletion of this page.
Index: trunk/extensions/DeleteQueue/DeleteQueueInterface.php
@@ -90,19 +90,33 @@
9191 $reason2 = $wgRequest->getText( 'wpExtra' );
9292
9393 $reason = self::formatReason( $reason1, $reason2 );
 94+
 95+ // Allow hooks to terminate
 96+ $error = '';
 97+ if (!wfRunHooks( 'AbortDeleteQueueNominate', array($wgUser, $article, $queue, $reason, &$error) ) ) {
 98+ $wgOut->addWikitext( $error );
 99+ return false;
 100+ }
94101
95102 // Transaction
96103 $dbw = wfGetDB( DB_MASTER );
97104 $dbw->begin();
98 -
99 - $log = new LogPage( 'delete' );
100 - $log->addEntry( "nominate", $article->mTitle, $reason, wfMsgNoTrans( 'deletequeue-queue-'.$queue) );
101 -
 105+
102106 // Set in database.
103107 $dqi = DeleteQueueItem::newFromArticle( $article );
 108+
 109+ if ($dqi->getQueue()) {
 110+ $dbw->rollback();
 111+ $wgOut->addWikiMsg( 'deletequeue-nom-alreadyqueued' );
 112+ return false;
 113+ }
 114+
104115 $dqi->setQueue( $queue, $reason );
105116 $dqi->addRole( 'nominator' );
106117
 118+ $log = new LogPage( 'delete' );
 119+ $log->addEntry( "nominate", $article->mTitle, $reason, wfMsgNoTrans( 'deletequeue-queue-'.$queue) );
 120+
107121 $dbw->commit();
108122
109123 $wgOut->redirect( $article->mTitle->getLocalUrl() );