function spamicide_requirements in Spamicide 7
Same name and namespace in other branches
- 8 spamicide.install \spamicide_requirements()
- 5 spamicide.module \spamicide_requirements()
- 6 spamicide.install \spamicide_requirements()
Implements hook_requirements(). @todo add creation of spamicide directory here
File
- ./
spamicide.install, line 17 - This module provides yet another tool to eliminate spam.
Code
function spamicide_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time.
$t = get_t();
if ($phase == 'runtime' || $phase == 'install') {
$path = 'public://' . variable_get('spamicide_dir', 'spamicide');
//was file_default_scheme()
if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY)) {
if (!is_dir($path)) {
$requirements['spamicide_directory'] = array(
'title' => $t('Spamicide Directory'),
'value' => $t('%p is not a directory or is not readable by the webserver.', array(
'%p' => $path,
)),
'severity' => REQUIREMENT_ERROR,
);
}
elseif (!is_writable($path)) {
$requirements['spamicide_directory'] = array(
'title' => $t('Spamicide Directory'),
'value' => $t('%p is not writeable by the webserver.', array(
'%p' => $path,
)),
'severity' => REQUIREMENT_ERROR,
);
}
else {
$requirements['spamicide_directory'] = array(
'title' => $t('Spamicide 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' => $path,
)),
'severity' => REQUIREMENT_ERROR,
);
}
}
$requirements['spamicide_attempt_counter'] = array(
'title' => $t('Spamicide'),
'value' => $t('Already blocked @counter form submissions', array(
'@counter' => variable_get('spamicide_attempt_counter', 0),
)),
'severity' => REQUIREMENT_INFO,
);
}
return $requirements;
}