r56640 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56639‎ | r56640 | r56641 >
Date:15:49, 19 September 2009
Author:btongminh
Status:ok
Tags:
Comment:
Follow up to r56639: Remove some existence check duplication and fix ApiUpload for changed return format of getExistsWarning.
Modified paths:
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)
  • /trunk/phase3/includes/upload/UploadBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadBase.php
@@ -318,15 +318,6 @@
319319 if( $exists !== false )
320320 $warnings['exists'] = $exists;
321321
322 - // Check whether this may be a thumbnail
323 - if( $exists !== false && $exists[0] != 'thumb'
324 - && self::isThumbName( $filename ) ){
325 - // Make the title
326 - $nt = $this->getTitle();
327 - $warnings['file-thumbnail-no'] = substr( $filename, 0,
328 - strpos( $nt->getText() , '-' ) +1 );
329 - }
330 -
331322 // Check dupes against existing files
332323 $hash = File::sha1Base36( $this->mTempPath );
333324 $dupes = RepoGroup::singleton()->findBySha1( $hash );
@@ -344,19 +335,6 @@
345336 if ( $archivedImage->getID() > 0 )
346337 $warnings['duplicate-archive'] = $archivedImage->getName();
347338
348 - $filenamePrefixBlacklist = self::getFilenamePrefixBlacklist();
349 - foreach( $filenamePrefixBlacklist as $prefix ) {
350 - if ( substr( $partname, 0, strlen( $prefix ) ) == $prefix ) {
351 - $warnings['filename-bad-prefix'] = $prefix;
352 - break;
353 - }
354 - }
355 -
356 - # If the file existed before and was deleted, warn the user of this
357 - # Don't bother doing so if the file exists now, however
358 - if( $localFile->wasDeleted() && !$localFile->exists() )
359 - $warnings['filewasdeleted'] = $localFile->getTitle();
360 -
361339 return $warnings;
362340 }
363341
Index: trunk/phase3/includes/api/ApiUpload.php
@@ -262,12 +262,9 @@
263263 if( isset( $warnings['exists'] ) ) {
264264 $warning = $warnings['exists'];
265265 unset( $warnings['exists'] );
266 - $warnings[$warning[0]] = $warning[1]->getName();
 266+ $warnings[$warning['warning']] = $warning['file']->getName();
267267 }
268 -
269 - if( isset( $warnings['filewasdeleted'] ) )
270 - $warnings['filewasdeleted'] = $warnings['filewasdeleted']->getName();
271 -
 268+
272269 $result['result'] = 'Warning';
273270 $result['warnings'] = $warnings;
274271
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -512,11 +512,6 @@
513513 } elseif( $warning == 'duplicate-archive' ) {
514514 $titleText = Title::makeTitle( NS_FILE, $args )->getPrefixedText();
515515 $msg = Xml::tags( 'li', null, wfMsgExt( 'file-deleted-duplicate', array( 'parseinline' ), array( $titleText ) ) );
516 - } elseif( $warning == 'filewasdeleted' ) {
517 - $ltitle = SpecialPage::getTitleFor( 'Log' );
518 - $llink = $sk->makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ),
519 - 'type=delete&page=' . $args->getPrefixedUrl() );
520 - $msg = "\t<li>" . wfMsgWikiHtml( 'filewasdeleted', $llink ) . "</li>\n";
521516 } else {
522517 if( is_bool( $args ) )
523518 $args = array();

Follow-up revisions

RevisionCommit summaryAuthorDate
r56734Merge r56631, fix for bug 20677....werdna21:01, 21 September 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r56639Fix several messages generated by SpecialUpload::getExistsWarning which were ...btongminh15:42, 19 September 2009

Status & tagging log