From: Tim Starling Date: Mon, 23 Jul 2007 17:21:20 +0000 (+0000) Subject: Seed subdirs in the deleted zone with a blank index.html file, to prevent crawling. X-Git-Tag: 1.31.0-rc.0~51982 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=4e95b575a6d495f3fde0085947a85ecbdd9dcba1;p=lhc%2Fweb%2Fwiklou.git Seed subdirs in the deleted zone with a blank index.html file, to prevent crawling. --- diff --git a/includes/filerepo/FSRepo.php b/includes/filerepo/FSRepo.php index d5a6783e05..d3d1b70c92 100644 --- a/includes/filerepo/FSRepo.php +++ b/includes/filerepo/FSRepo.php @@ -142,8 +142,15 @@ class FSRepo extends FileRepo { $dstPath = "$root/$dstRel"; $dstDir = dirname( $dstPath ); - if ( !is_dir( $dstDir ) && !wfMkdirParents( $dstDir ) ) { - return $this->newFatal( 'directorycreateerror', $dstDir ); + if ( !is_dir( $dstDir ) ) { + 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", '' ); + } } if ( self::isVirtualUrl( $srcPath ) ) { @@ -375,9 +382,13 @@ class FSRepo extends FileRepo { } $archivePath = "{$this->deletedDir}/$archiveRel"; $archiveDir = dirname( $archivePath ); - if ( !wfMkdirParents( $archiveDir ) ) { - $status->fatal( 'directorycreateerror', $archiveDir ); - continue; + if ( !is_dir( $archiveDir ) ) { + if ( !wfMkdirParents( $archiveDir ) ) { + $status->fatal( 'directorycreateerror', $archiveDir ); + continue; + } + // Seed new directories with a blank index.html, to prevent crawling + file_put_contents( "$archiveDir/index.html", '' ); } // Check if the archive directory is writable // This doesn't appear to work on NTFS