Index: branches/REL1_13/phase3/includes/filerepo/FSRepo.php |
— | — | @@ -149,10 +149,8 @@ |
150 | 150 | if ( !wfMkdirParents( $dstDir ) ) { |
151 | 151 | return $this->newFatal( 'directorycreateerror', $dstDir ); |
152 | 152 | } |
153 | | - // In the deleted zone, seed new directories with a blank |
154 | | - // index.html, to prevent crawling |
155 | 153 | if ( $dstZone == 'deleted' ) { |
156 | | - file_put_contents( "$dstDir/index.html", '' ); |
| 154 | + $this->initDeletedDir( $dstDir ); |
157 | 155 | } |
158 | 156 | } |
159 | 157 | |
— | — | @@ -215,6 +213,20 @@ |
216 | 214 | } |
217 | 215 | |
218 | 216 | /** |
| 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 | + /** |
219 | 231 | * Pick a random name in the temp zone and store a file to it. |
220 | 232 | * @param string $originalName The base name of the file as specified |
221 | 233 | * by the user. The file extension will be maintained. |
— | — | @@ -393,8 +405,7 @@ |
394 | 406 | $status->fatal( 'directorycreateerror', $archiveDir ); |
395 | 407 | continue; |
396 | 408 | } |
397 | | - // Seed new directories with a blank index.html, to prevent crawling |
398 | | - file_put_contents( "$archiveDir/index.html", '' ); |
| 409 | + $this->initDeletedDir( $archiveDir ); |
399 | 410 | } |
400 | 411 | // Check if the archive directory is writable |
401 | 412 | // This doesn't appear to work on NTFS |
Property changes on: branches/REL1_13/phase3/includes/filerepo |
___________________________________________________________________ |
Added: svn:mergeinfo |
402 | 413 | Merged /trunk/phase3/includes/filerepo:r41379-41380,43625 |