summaryrefslogtreecommitdiff
path: root/includes/filerepo/FSRepo.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2008-12-15 18:02:47 +0100
committerPierre Schmitz <pierre@archlinux.de>2008-12-15 18:02:47 +0100
commit396b28f3d881f5debd888ba9bb9b47c2d478a76f (patch)
tree10d6e1a721ee4ef69def34a57f02d7eb3fc9e31e /includes/filerepo/FSRepo.php
parent0be4d3ccf6c4fe98a72704f9463ecdea2ee5e615 (diff)
update to Mediawiki 1.13.3; some cleanups
Diffstat (limited to 'includes/filerepo/FSRepo.php')
-rw-r--r--includes/filerepo/FSRepo.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/includes/filerepo/FSRepo.php b/includes/filerepo/FSRepo.php
index 08ec1514..eb8df0f5 100644
--- a/includes/filerepo/FSRepo.php
+++ b/includes/filerepo/FSRepo.php
@@ -149,10 +149,8 @@ class FSRepo extends FileRepo {
if ( !wfMkdirParents( $dstDir ) ) {
return $this->newFatal( 'directorycreateerror', $dstDir );
}
- // In the deleted zone, seed new directories with a blank
- // index.html, to prevent crawling
if ( $dstZone == 'deleted' ) {
- file_put_contents( "$dstDir/index.html", '' );
+ $this->initDeletedDir( $dstDir );
}
}
@@ -215,6 +213,20 @@ class FSRepo extends FileRepo {
}
/**
+ * Take all available measures to prevent web accessibility of new deleted
+ * directories, in case the user has not configured offline storage
+ */
+ protected function initDeletedDir( $dir ) {
+ // Add a .htaccess file to the root of the deleted zone
+ $root = $this->getZonePath( 'deleted' );
+ if ( !file_exists( "$root/.htaccess" ) ) {
+ file_put_contents( "$root/.htaccess", "Deny from all\n" );
+ }
+ // Seed new directories with a blank index.html, to prevent crawling
+ file_put_contents( "$dir/index.html", '' );
+ }
+
+ /**
* Pick a random name in the temp zone and store a file to it.
* @param string $originalName The base name of the file as specified
* by the user. The file extension will be maintained.
@@ -393,8 +405,7 @@ class FSRepo extends FileRepo {
$status->fatal( 'directorycreateerror', $archiveDir );
continue;
}
- // Seed new directories with a blank index.html, to prevent crawling
- file_put_contents( "$archiveDir/index.html", '' );
+ $this->initDeletedDir( $archiveDir );
}
// Check if the archive directory is writable
// This doesn't appear to work on NTFS