You are here

function omega_tools_cache_get in Omega Tools 7.3

@todo

1 call to omega_tools_cache_get()
omega_tools_cache_load in ./omega_tools.module
@todo

File

./omega_tools.module, line 143

Code

function omega_tools_cache_get($name) {
  ctools_include('object-cache');
  $cache = ctools_object_cache_get('omega_tools', $name);
  if (!$cache) {
    $themes = list_themes();
    if (isset($themes[$name])) {
      $path = drupal_get_path('theme', $name);
      $info = drupal_parse_info_file($path . '/' . $name . '.info');
      $cache = new stdClass();
      $cache->new = FALSE;
      $cache->machine_name = $name;
      $cache->automated = file_prepare_directory($path, NULL) && file_prepare_directory(dirname($path), NULL);
      $cache->destination = $path;
      $cache->name = $info['name'];
      $cache->info = $info;
      $cache->status = $themes[$name]->status;
      $cache->default = variable_get('theme_default') == $name;
      $cache->locked = ctools_object_cache_test('omega_tools', $name);
      $cache->path = 'temporary://omega-tools/' . $name . '-' . substr(hash('sha256', serialize($cache) . microtime()), 0, 8);
      file_unmanaged_delete_recursive($cache->path);
      omega_tools_copy_recursive($cache->destination, $cache->path);
    }
  }
  return $cache;
}