r91817 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91816‎ | r91817 | r91818 >
Date:07:00, 10 July 2011
Author:ialex
Status:ok (Comments)
Tags:
Comment:
Now that the hooks ArticleDelete and ArticleDeleteComplete are called from WikiPage::doDeleteArticle() and not anymore from Article::doDelete(), let's call the former and handle ourself the output
Modified paths:
  • /trunk/extensions/Nuke/Nuke.i18n.php (modified) (history)
  • /trunk/extensions/Nuke/Nuke_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Nuke/Nuke_body.php
@@ -39,7 +39,7 @@
4040
4141 if( $pages ) {
4242 return $this->doDelete( $pages, $reason );
43 - }
 43+ }
4444 }
4545 else {
4646 $this->listForm( $target, $reason, $wgRequest->getInt( 'limit' ) );
@@ -244,16 +244,25 @@
245245 * @param string $reason
246246 */
247247 protected function doDelete( array $pages, $reason ) {
 248+ global $wgOut;
 249+
 250+ $res = array();
248251 foreach( $pages as $page ) {
249252 $title = Title::newFromURL( $page );
250 - $file = $title->getNamespace() == NS_IMAGE ? wfLocalFile( $title ) : false;
 253+ $file = $title->getNamespace() == NS_FILE ? wfLocalFile( $title ) : false;
251254 if ( $file ) {
252255 $oldimage = null; // Must be passed by reference
253 - FileDeleteForm::doDelete( $title, $file, $oldimage, $reason, false );
 256+ $ok = FileDeleteForm::doDelete( $title, $file, $oldimage, $reason, false )->isOK();
254257 } else {
255 - $article = new Article( $title );
256 - $article->doDelete( $reason );
 258+ $article = new Article( $title, 0 );
 259+ $ok = $article->doDeleteArticle( $reason );
257260 }
 261+ if ( $ok ) {
 262+ $res[] = wfMsgExt( 'nuke-deleted', array( 'parseinline' ), $title->getPrefixedText() );
 263+ } else {
 264+ $res[] = wfMsgExt( 'nuke-not-deleted', array( 'parseinline' ), $title->getPrefixedText() );
 265+ }
258266 }
 267+ $wgOut->addHTML( "<ul>\n<li>" .implode( "</li>\n<li>", $res ) . "</li>\n</ul>\n" );
259268 }
260269 }
Index: trunk/extensions/Nuke/Nuke.i18n.php
@@ -30,7 +30,9 @@
3131 'nuke-userorip' => 'Username, IP address or blank:',
3232 'nuke-maxpages' => 'Maximum number of pages:',
3333 'nuke-multiplepeople'=> 'multiple users',
34 - 'nuke-editby' => 'Created by [[Special:Contributions/$1|$1]]'
 34+ 'nuke-editby' => 'Created by [[Special:Contributions/$1|$1]]',
 35+ 'nuke-deleted' => "Page '''$1''' has been deleted.",
 36+ 'nuke-not-deleted' => "Page [[$1]] '''could not''' be deleted.",
3537 );
3638
3739 /** Message documentation (Message documentation)

Follow-up revisions

RevisionCommit summaryAuthorDate
r91860Per SPQRobin, fix for r91817: escape the link so that in renders properly on ...ialex07:59, 11 July 2011

Comments

#Comment by Nikerabbit (talk | contribs)   07:44, 10 July 2011

Is there no error message besides true/false?

#Comment by SPQRobin (talk | contribs)   22:49, 10 July 2011

I have not tested it, but won't [[$1]] fail for categories, so [[:$1]] should be used?

#Comment by IAlex (talk | contribs)   07:59, 11 July 2011

Done in r91860.

Status & tagging log