You are here

function asset_check_directory in Asset 6

Same name and namespace in other branches
  1. 5 asset.module \asset_check_directory()

Wrapper for file_check_directory that also checks/adds a matching asset

8 calls to asset_check_directory()
asset_asset_type in inc/asset.api.inc
Implementation of hook_asset_type().
asset_import_form_submit in contrib/asset_import/asset_import.module
asset_wizard_form_asset_selection in ./asset_wizard.inc
Form builder for step 1 of the asset wizard. This step is the most intensive so it has been separated out for clarity.
asset_wizard_form_asset_selection in inc/asset_wizard.inc
Form builder for step 1 of the asset wizard. This step is the most intensive so it has been separated out for clarity.
asset_wizard_form_submit in ./asset_wizard.inc
Submit callback for asset_wizard_form().

... See full list

File

inc/asset.routines.inc, line 114

Code

function asset_check_directory(&$directory, $mode = 0, $form_item = NULL, $form_values = array()) {
  $return = file_check_directory(file_create_path($directory), $mode, $form_item);
  if ($return && $mode && !empty($form_values)) {
    $asset = asset_load(array(
      'dirname' => $form_values['parent'],
      'filename' => $form_values['title'],
    ));
    if (!$asset) {
      $asset = new stdClass();
      $asset->filepath = $directory;
      $asset->filesize = 0;
      $asset->type = 'directory';
      asset_save($asset, $form_values);
    }
  }
  return $return;
}