"deny from all\n", 'index.php' => "isFile() && TransferTempFile::is_temp( $file->getPathname() ) ) { wp_delete_file( $file->getPathname() ); } } } catch ( \UnexpectedValueException ) { // Only the top folder failing to open lands here; an unreadable subfolder is skipped by CATCH_GET_CHILD. return; } } /** Writes the deny rule and index file a folder is missing. */ private static function guard( string $dir, string $root ): bool { foreach ( self::GUARDS as $name => $contents ) { if ( ! file_exists( $dir . '/' . $name ) && ! Filesystem::write( $dir . '/' . $name, $contents, $root ) ) { return false; } } return true; } }