You are here

function css_gzip_requirements in CSS Gzip 6

Implementation of hook_requirements().

Parameters

$phase: The phase in which hook_requirements is run

File

./css_gzip.install, line 47

Code

function css_gzip_requirements($phase) {
  $requirements = array();
  $t = get_t();
  $directory = file_directory_path();
  $is_writable = is_dir($directory) && is_writable($directory) && variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC;
  switch ($phase) {
    case 'runtime':
      if (!$is_writable) {
        $requirements['css_gzip'] = array(
          'title' => $t('CSS Gzip'),
          'description' => $t('Files directory is not writable AND/OR public download method is disabled'),
          'severity' => $phase == 'install' ? REQUIREMENT_WARNING : REQUIREMENT_ERROR,
          'value' => $t('Server Configuration Error'),
        );
      }
      else {
        $requirements['css_gzip'] = array(
          'title' => $t('CSS Gzip'),
          'severity' => REQUIREMENT_OK,
          'value' => $t('Files directory is writable and server is using public downloads'),
        );
      }
      break;
  }
  return $requirements;
}