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