You are here

function minisite_site_asset_info in Mini site 7

Fetch minisite information.

1 call to minisite_site_asset_info()
minisite_site_save in ./minisite.module
Save and extract minisite.

File

includes/minisite.site.inc, line 259
minisite.site.inc

Code

function minisite_site_asset_info($fid, $tree = TRUE) {
  if (empty($fid)) {
    return FALSE;
  }
  $file = file_load($fid);
  if (!$file) {
    return FALSE;
  }

  // Check if minisite is archive.
  $archive = MinisiteArchive::open($file);
  if (!$archive) {
    return FALSE;
  }
  $minisite_tree = $archive
    ->filesTree();

  // Ignore __MACOSX folder.
  unset($minisite_tree['__MACOSX']);
  $root_files = array_keys($minisite_tree);
  $top_folder = $root_files[0];
  $minisite_path = MINISITE_ASSETPATH . '/' . minisite_site_hash($file);
  if ($tree === TRUE) {
    $minisite_listing = $minisite_tree;
  }
  else {
    $minisite_listing = $archive
      ->filesList();
  }
  return [
    $minisite_path,
    $top_folder,
    $minisite_listing,
  ];
}