You are here

function node_import_directory in Node import 6

Return the full path where files to import are stored.

Parameters

$reset: Boolean. Reset internal cache.

Return value

String. The directory is created if needed.

Related topics

7 calls to node_import_directory()
NodeImportTestCase::nodeImportCreateTask in tests/NodeImportTestCase.php
Create an import task by going through the form.
node_import_add_form in ./node_import.admin.inc
Creates a new import task by letting the user fill in a wizard.
node_import_add_form_submit_upload_file in ./node_import.admin.inc
node_import_add_form_validate_next in ./node_import.admin.inc
node_import_check_filepath in ./node_import.inc
Check if the value points to a valid filepath.

... See full list

File

./node_import.inc, line 1569
Public API of the Node import module.

Code

function node_import_directory($reset = FALSE) {
  static $path;
  if (!isset($path) || $reset) {
    $path = variable_get('node_import:directory', 'imports');
    if (function_exists('token_replace')) {
      global $user;
      $path = token_replace($path, 'user', user_load($user->uid));
    }
    if (strlen($path) > 0) {
      $parts = array_filter(explode('/', $path));
      $path = '';
      while (!empty($parts)) {
        $path .= array_shift($parts) . '/';
        $path_to_check = file_create_path($path);
        file_check_directory($path_to_check, FILE_CREATE_DIRECTORY, 'node_import:directory');
      }
    }
    $path = rtrim($path, '/');
    $path = file_create_path($path);
  }
  return $path;
}