You are here

function css_injector_requirements in CSS Injector 7.2

Same name and namespace in other branches
  1. 7 css_injector.install \css_injector_requirements()

Implements hook_requirements().

We'll use this to prevent installation of the module if the file directory is not available and writable.

File

./css_injector.install, line 120
css_injector.install

Code

function css_injector_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $requirements['css_injector_cache_dir'] = array(
      'title' => t('CSS injector cache dir'),
      'severity' => REQUIREMENT_OK,
      'value' => t('Exists'),
    );
    if (!css_injector_prepare_directory()) {
      $requirements['css_injector_cache_dir']['description'] = t('The CSS injector cache directory, %path could not be created due to a misconfigured files directory. Please ensure that the files directory is correctly configured and that the webserver has permission to create directories.', array(
        '%path' => file_uri_target(CSS_INJECTOR_DIRECTORY_URI),
      ));
      $requirements['css_injector_cache_dir']['severity'] = REQUIREMENT_ERROR;
      $requirements['css_injector_cache_dir']['value'] = t('Unable to create');
    }
  }
  return $requirements;
}