function imagecache_requirements in ImageCache 6.2
Same name and namespace in other branches
- 5.2 imagecache.install \imagecache_requirements()
- 5 imagecache.module \imagecache_requirements()
File
- ./
imagecache.install, line 3
Code
function imagecache_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time.
$t = get_t();
if ($phase == 'runtime') {
$imagecache_directory = file_create_path() . '/imagecache';
if (!file_check_directory($imagecache_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
if (!is_dir($imagecache_directory)) {
$requirements['imagecache_directory'] = array(
'title' => $t('ImageCache Directory'),
'value' => $t('%p is not a directory or is not readable by the webserver.', array(
'%p' => $imagecache_directory,
)),
'severity' => REQUIREMENT_ERROR,
);
}
elseif (!is_writable($imagecache_directory)) {
$requirements['imagecache_directory'] = array(
'title' => $t('ImageCache Directory'),
'value' => $t('%p is not writeable by the webserver.', array(
'%p' => $imagecache_directory,
)),
'severity' => REQUIREMENT_ERROR,
);
}
else {
$requirements['imagecache_directory'] = array(
'title' => $t('ImageCache Directory'),
'value' => $t('An unknown error occured.'),
'description' => $t('An unknown error occured trying to verify %p is a directory and is writable.', array(
'%p' => $imagecache_directory,
)),
'severity' => REQUIREMENT_ERROR,
);
}
}
if (!is_writable(file_directory_temp())) {
$requirements['imagecache_directory'] = array(
'title' => $t('ImageCache Temp Directory'),
'value' => $t('%p is not writeable by the webserver.', array(
'%p' => file_directory_temp(),
)),
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}