Code Duplication    Length = 8-9 lines in 3 locations

includes/libs/filebackend/FSFileBackend.php 3 locations

@@ 495-503 (lines=9) @@
492
			}
493
		}
494
		// Add a .htaccess file to the root of the container...
495
		if ( !empty( $params['noAccess'] ) && !file_exists( "{$contRoot}/.htaccess" ) ) {
496
			$this->trapWarnings();
497
			$bytes = file_put_contents( "{$contRoot}/.htaccess", $this->htaccessPrivate() );
498
			$this->untrapWarnings();
499
			if ( $bytes === false ) {
500
				$storeDir = "mwstore://{$this->name}/{$shortCont}";
501
				$status->fatal( 'backend-fail-create', "{$storeDir}/.htaccess" );
502
			}
503
		}
504
505
		return $status;
506
	}
@@ 514-521 (lines=8) @@
511
		$contRoot = $this->containerFSRoot( $shortCont, $fullCont ); // must be valid
512
		$dir = ( $dirRel != '' ) ? "{$contRoot}/{$dirRel}" : $contRoot;
513
		// Unseed new directories with a blank index.html, to allow crawling...
514
		if ( !empty( $params['listing'] ) && is_file( "{$dir}/index.html" ) ) {
515
			$exists = ( file_get_contents( "{$dir}/index.html" ) === $this->indexHtmlPrivate() );
516
			$this->trapWarnings();
517
			if ( $exists && !unlink( "{$dir}/index.html" ) ) { // reverse secure()
518
				$status->fatal( 'backend-fail-delete', $params['dir'] . '/index.html' );
519
			}
520
			$this->untrapWarnings();
521
		}
522
		// Remove the .htaccess file from the root of the container...
523
		if ( !empty( $params['access'] ) && is_file( "{$contRoot}/.htaccess" ) ) {
524
			$exists = ( file_get_contents( "{$contRoot}/.htaccess" ) === $this->htaccessPrivate() );
@@ 523-531 (lines=9) @@
520
			$this->untrapWarnings();
521
		}
522
		// Remove the .htaccess file from the root of the container...
523
		if ( !empty( $params['access'] ) && is_file( "{$contRoot}/.htaccess" ) ) {
524
			$exists = ( file_get_contents( "{$contRoot}/.htaccess" ) === $this->htaccessPrivate() );
525
			$this->trapWarnings();
526
			if ( $exists && !unlink( "{$contRoot}/.htaccess" ) ) { // reverse secure()
527
				$storeDir = "mwstore://{$this->name}/{$shortCont}";
528
				$status->fatal( 'backend-fail-delete', "{$storeDir}/.htaccess" );
529
			}
530
			$this->untrapWarnings();
531
		}
532
533
		return $status;
534
	}