You are here

function _patterns_io_check_htaccess in Patterns 7

Same name and namespace in other branches
  1. 7.2 includes/io/io.inc \_patterns_io_check_htaccess()

Checks if a .htaccess file exists to prevent downloads of pattern files.

File

includes/io/io.inc, line 341
Functions related to input/output operations.

Code

function _patterns_io_check_htaccess() {
  $path = patterns_path_get_files_dir();
  if (!is_file($path . '/.htaccess')) {
    $content = '# Prevent downloading site patterns
<FilesMatch "\\.xml$">
  Order allow,deny
</FilesMatch>
';
    file_save_data($content, $path . '/.htaccess');
  }
}