function css_injector_requirements in CSS Injector 7
Same name and namespace in other branches
- 7.2 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 111 - Install, update and uninstall functions for the css_injector module.
Code
function css_injector_requirements($phase) {
$status = REQUIREMENT_OK;
$dir = 'public://css_injector';
if (!file_prepare_directory($dir, FILE_MODIFY_PERMISSIONS)) {
if (!file_prepare_directory($dir, FILE_CREATE_DIRECTORY)) {
$status = REQUIREMENT_ERROR;
}
}
$requirements = array(
'css_injector' => array(
'title' => t('CSS Injector directory writable'),
'description' => $status == REQUIREMENT_OK ? t('CSS Injector Directory %dir is writable', array(
'%dir' => $dir,
)) : t('Directory %dir is not writable', array(
'%dir' => $dir,
)),
'severity' => $status,
'value' => $status == REQUIREMENT_OK ? t('Writable') : t('Not writable'),
),
);
return $requirements;
}