From 8d2ef61a4a8db442c0c4f3e39d598191e13d9a0f Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 10 Jun 2008 16:49:21 +0000 Subject: [PATCH] * We no longer just give up on a missing upload base directory; it's now created automatically if we have sufficient permissions! (Note that upload_directory_missing and upload_directory_read_only still have crappy output as they show a non-obvious internal path in the output.) --- RELEASE-NOTES | 3 +++ includes/filerepo/FSRepo.php | 6 ++++++ languages/messages/MessagesEn.php | 1 + 3 files changed, 10 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8a04839f26..a7c596ff54 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -360,6 +360,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN extension tables using uppercase letters or digits in their names. * (bug 12311) Fix regression with lists at start of undeletion preview * (bug 14496) Fix regression with parseinline on Special:Upload. +* We no longer just give up on a missing upload base directory; it's now + created automatically if we have sufficient permissions! + === API changes in 1.13 === diff --git a/includes/filerepo/FSRepo.php b/includes/filerepo/FSRepo.php index 68b990e53c..08ec151438 100644 --- a/includes/filerepo/FSRepo.php +++ b/includes/filerepo/FSRepo.php @@ -125,6 +125,9 @@ class FSRepo extends FileRepo { * same contents as the source */ function storeBatch( $triplets, $flags = 0 ) { + if ( !wfMkdirParents( $this->directory ) ) { + return $this->newFatal( 'upload_directory_missing', $this->directory ); + } if ( !is_writable( $this->directory ) ) { return $this->newFatal( 'upload_directory_read_only', $this->directory ); } @@ -255,6 +258,9 @@ class FSRepo extends FileRepo { */ function publishBatch( $triplets, $flags = 0 ) { // Perform initial checks + if ( !wfMkdirParents( $this->directory ) ) { + return $this->newFatal( 'upload_directory_missing', $this->directory ); + } if ( !is_writable( $this->directory ) ) { return $this->newFatal( 'upload_directory_read_only', $this->directory ); } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 0adbc09ac9..837014360d 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1577,6 +1577,7 @@ Pages on [[Special:Watchlist|your watchlist]] are '''bold'''.", 'reuploaddesc' => 'Cancel upload and return to the upload form', 'uploadnologin' => 'Not logged in', 'uploadnologintext' => 'You must be [[Special:Userlogin|logged in]] to upload files.', +'upload_directory_missing' => 'The upload directory ($1) is missing and could not be created by the webserver.', 'upload_directory_read_only' => 'The upload directory ($1) is not writable by the webserver.', 'uploaderror' => 'Upload error', 'upload-summary' => '', # only translate this message to other languages if you have to change it -- 2.20.1