You are here

function asset_check_directory in Asset 5

Same name and namespace in other branches
  1. 6 inc/asset.routines.inc \asset_check_directory()

Wrapper for file_check_directory that also checks/adds a matching asset

6 calls to asset_check_directory()
asset_asset_type in ./asset.module
Implementation of hook_asset_type().
asset_update_4 in ./asset.install
Give directories their own asset type.
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_submit in ./asset_wizard.inc
Submit callback for asset_wizard_form().
asset_wizard_form_validate in ./asset_wizard.inc
Validate callback for asset_wizard_form().

... See full list

File

./asset.module, line 740

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;
}