Don't move the destination to the archive until we have checked that the source file...
authorTim Starling <tstarling@users.mediawiki.org>
Fri, 6 Jul 2007 21:50:43 +0000 (21:50 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Fri, 6 Jul 2007 21:50:43 +0000 (21:50 +0000)
includes/filerepo/FSRepo.php

index a75ba7a..dc40444 100644 (file)
@@ -214,6 +214,11 @@ class FSRepo extends FileRepo {
                $dstDir = dirname( $dstPath );
                if ( !is_dir( $dstDir ) ) wfMkdirParents( $dstDir );
 
+               // Check if the source is missing before we attempt to move the dest to archive
+               if ( !is_file( $srcPath ) ) {
+                       return new WikiErrorMsg( 'filenotfound', wfEscapeWikiText( $srcPath ) );
+               }
+
                if( is_file( $dstPath ) ) {
                        $archiveDir = dirname( $archivePath );
                        if ( !is_dir( $archiveDir ) ) wfMkdirParents( $archiveDir );