r97551 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97550‎ | r97551 | r97552 >
Date:20:20, 19 September 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Don't try and delete ForeignAPIFile or ForeignDBFile

Add a space before the error message so it's not cramped up next to the page name

Add a success error message (explicit is better than guessing)
Modified paths:
  • /trunk/phase3/maintenance/deleteBatch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/deleteBatch.php
@@ -86,8 +86,10 @@
8787 if ( $page->getNamespace() == NS_FILE ) {
8888 $art = new ImagePage( $page );
8989 $img = wfFindFile( $art->mTitle );
90 - if ( !$img || !$img->delete( $reason ) ) {
91 - $this->output( "FAILED to delete image file... " );
 90+ if ( !$img
 91+ || $img instanceof ForeignDBFile || $img instanceof ForeignAPIFile
 92+ || !$img->delete( $reason ) ) {
 93+ $this->output( " FAILED to delete image file... " );
9294 }
9395 } else {
9496 $art = new Article( $page );
@@ -95,7 +97,7 @@
9698 $success = $art->doDeleteArticle( $reason );
9799 $dbw->commit();
98100 if ( $success ) {
99 - $this->output( "\n" );
 101+ $this->output( " Deleted!\n" );
100102 } else {
101103 $this->output( " FAILED to delete article\n" );
102104 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r97552Followup r97551, use isLocal, more dynamic!reedy20:27, 19 September 2011
r976351.18wmf1: MFT r96760, r96765, r97551, r97552, r97622catrope15:54, 20 September 2011
r97673REL1_18 MFT r96760, r76765, r96810, r97551, r97552, r97575, r97607, r97608, r...reedy22:36, 20 September 2011

Comments

#Comment by Reedy (talk | contribs)   20:21, 19 September 2011

Tagging 1.18wmf1 cause it's useful (and found to be an issue doing bug 30867)

Could go into 1.17wmf1, but as that's going to be rotting soon, there's possibly not much benefit from doing so

#Comment by Aaron Schulz (talk | contribs)   20:23, 19 September 2011

Can you check $img->isLocal()?

#Comment by Reedy (talk | contribs)   20:26, 19 September 2011
	function isLocal() {
		$repo = $this->getRepo();
		return $repo && $repo->isLocal();
	}

That'd be saner

Status & tagging log