r44570 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44569‎ | r44570 | r44571 >
Date:08:38, 14 December 2008
Author:tstarling
Status:ok
Tags:
Comment:
Backported r43625 again, apparently it got left out of r43669 somehow.
Modified paths:
  • /branches/REL1_13/phase3/includes/filerepo (modified) (history)
  • /branches/REL1_13/phase3/includes/filerepo/FSRepo.php (modified) (history)

Diff [purge]

Index: branches/REL1_13/phase3/includes/filerepo/FSRepo.php
@@ -149,10 +149,8 @@
150150 if ( !wfMkdirParents( $dstDir ) ) {
151151 return $this->newFatal( 'directorycreateerror', $dstDir );
152152 }
153 - // In the deleted zone, seed new directories with a blank
154 - // index.html, to prevent crawling
155153 if ( $dstZone == 'deleted' ) {
156 - file_put_contents( "$dstDir/index.html", '' );
 154+ $this->initDeletedDir( $dstDir );
157155 }
158156 }
159157
@@ -215,6 +213,20 @@
216214 }
217215
218216 /**
 217+ * Take all available measures to prevent web accessibility of new deleted
 218+ * directories, in case the user has not configured offline storage
 219+ */
 220+ protected function initDeletedDir( $dir ) {
 221+ // Add a .htaccess file to the root of the deleted zone
 222+ $root = $this->getZonePath( 'deleted' );
 223+ if ( !file_exists( "$root/.htaccess" ) ) {
 224+ file_put_contents( "$root/.htaccess", "Deny from all\n" );
 225+ }
 226+ // Seed new directories with a blank index.html, to prevent crawling
 227+ file_put_contents( "$dir/index.html", '' );
 228+ }
 229+
 230+ /**
219231 * Pick a random name in the temp zone and store a file to it.
220232 * @param string $originalName The base name of the file as specified
221233 * by the user. The file extension will be maintained.
@@ -393,8 +405,7 @@
394406 $status->fatal( 'directorycreateerror', $archiveDir );
395407 continue;
396408 }
397 - // Seed new directories with a blank index.html, to prevent crawling
398 - file_put_contents( "$archiveDir/index.html", '' );
 409+ $this->initDeletedDir( $archiveDir );
399410 }
400411 // Check if the archive directory is writable
401412 // This doesn't appear to work on NTFS
Property changes on: branches/REL1_13/phase3/includes/filerepo
___________________________________________________________________
Added: svn:mergeinfo
402413 Merged /trunk/phase3/includes/filerepo:r41379-41380,43625

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r43625* Add a .htaccess to deleted images directory for additional protection...brion19:01, 17 November 2008
r43669Backported r43621, r43622, r43623, r43624, r43625, r43627, r43660, r43661. Ne...tstarling11:36, 18 November 2008

Status & tagging log