From bc20609885a7f95e8fdea88f01d9a58b7b0ca1eb Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Sat, 19 Sep 2009 15:49:54 +0000 Subject: [PATCH] Follow up to r56639: Remove some existence check duplication and fix ApiUpload for changed return format of getExistsWarning. --- includes/api/ApiUpload.php | 7 ++----- includes/specials/SpecialUpload.php | 5 ----- includes/upload/UploadBase.php | 22 ---------------------- 3 files changed, 2 insertions(+), 32 deletions(-) diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index ef0687bb0e..b55ae18946 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -262,12 +262,9 @@ class ApiUpload extends ApiBase { if( isset( $warnings['exists'] ) ) { $warning = $warnings['exists']; unset( $warnings['exists'] ); - $warnings[$warning[0]] = $warning[1]->getName(); + $warnings[$warning['warning']] = $warning['file']->getName(); } - - if( isset( $warnings['filewasdeleted'] ) ) - $warnings['filewasdeleted'] = $warnings['filewasdeleted']->getName(); - + $result['result'] = 'Warning'; $result['warnings'] = $warnings; diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index e69e73a450..62a45a0a32 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -512,11 +512,6 @@ class UploadForm extends SpecialPage { } elseif( $warning == 'duplicate-archive' ) { $titleText = Title::makeTitle( NS_FILE, $args )->getPrefixedText(); $msg = Xml::tags( 'li', null, wfMsgExt( 'file-deleted-duplicate', array( 'parseinline' ), array( $titleText ) ) ); - } elseif( $warning == 'filewasdeleted' ) { - $ltitle = SpecialPage::getTitleFor( 'Log' ); - $llink = $sk->makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ), - 'type=delete&page=' . $args->getPrefixedUrl() ); - $msg = "\t
  • " . wfMsgWikiHtml( 'filewasdeleted', $llink ) . "
  • \n"; } else { if( is_bool( $args ) ) $args = array(); diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index 8795d76340..4c96005a77 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -318,15 +318,6 @@ abstract class UploadBase { if( $exists !== false ) $warnings['exists'] = $exists; - // Check whether this may be a thumbnail - if( $exists !== false && $exists[0] != 'thumb' - && self::isThumbName( $filename ) ){ - // Make the title - $nt = $this->getTitle(); - $warnings['file-thumbnail-no'] = substr( $filename, 0, - strpos( $nt->getText() , '-' ) +1 ); - } - // Check dupes against existing files $hash = File::sha1Base36( $this->mTempPath ); $dupes = RepoGroup::singleton()->findBySha1( $hash ); @@ -344,19 +335,6 @@ abstract class UploadBase { if ( $archivedImage->getID() > 0 ) $warnings['duplicate-archive'] = $archivedImage->getName(); - $filenamePrefixBlacklist = self::getFilenamePrefixBlacklist(); - foreach( $filenamePrefixBlacklist as $prefix ) { - if ( substr( $partname, 0, strlen( $prefix ) ) == $prefix ) { - $warnings['filename-bad-prefix'] = $prefix; - break; - } - } - - # If the file existed before and was deleted, warn the user of this - # Don't bother doing so if the file exists now, however - if( $localFile->wasDeleted() && !$localFile->exists() ) - $warnings['filewasdeleted'] = $localFile->getTitle(); - return $warnings; } -- 2.20.1