You are here

function _patterns_import_check_dirs in Patterns 7.2

Same name and namespace in other branches
  1. 7 includes/forms/import.inc \_patterns_import_check_dirs()

Helper function to be called in one of the import validation handlers.

2 calls to _patterns_import_check_dirs()
patterns_import_validate in includes/forms/import.inc
_patterns_io_import_pre_checkings in includes/io/import.inc
@file Importing Patterns from a file or using an URL.

File

includes/forms/import.inc, line 11
Importing Patterns from a file or using an URL.

Code

function _patterns_import_check_dirs($dir = NULL) {

  // Check Patterns Directory.
  if (!_patterns_io_is_patterns_dir_ready($dir, FILE_CREATE_DIRECTORY)) {
    $message = t("Destination folder does not exist or is not writable: %path<br />", array(
      '%path' => $dir,
    ));

    // TODO: move this out for performance
    $link = l(t('status report'), 'admin/reports/status');
    $message .= t('You might want to check the !link to ensure your files directory exists and is writable.', array(
      '!link' => $link,
    ));
    form_set_error('pattern_file', $message);
    return FALSE;
  }
}