function coder_upgrade_requirements in Coder 7.2
Same name and namespace in other branches
- 7 coder_upgrade/coder_upgrade.install \coder_upgrade_requirements()
Implements hook_requirements().
File
- coder_upgrade/
coder_upgrade.install, line 71
Code
function coder_upgrade_requirements($phase) {
// Ensure translations don't break at install time.
$t = get_t();
$requirements = array();
// Test writeability to files directory.
if ($phase == 'install') {
if (module_exists('deadwood')) {
$requirements['coder_upgrade_modules'] = array(
'title' => $t('Deadwood module'),
'description' => $t('The Deadwood module must be uninstalled before the Coder Upgrade module can be installed.'),
'severity' => REQUIREMENT_ERROR,
);
}
$dir = coder_upgrade_directory_path('', FALSE);
if (!file_prepare_directory($dir, FILE_CREATE_DIRECTORY)) {
$requirements['coder_upgrade_files'] = array(
'title' => $t('Files directory'),
'description' => $t('Your files directory at %directory can not be written to. Coder Upgrade places converted module code and other files in subdirectories of this directory.', array(
'%directory' => $dir,
)),
'severity' => REQUIREMENT_ERROR,
);
}
}
else {
// @todo Check all of the subdirectories.
$dir = coder_upgrade_directory_path('new', FALSE);
if (!file_prepare_directory($dir, FILE_CREATE_DIRECTORY)) {
$requirements['coder_upgrade_files'] = array(
'title' => $t('Coder Upgrade directory'),
'description' => $t('Your files directory at %directory can not be written to. Coder Upgrade places converted module code in subdirectories of this directory.', array(
'%directory' => $dir,
)),
'severity' => REQUIREMENT_ERROR,
'value' => $t('Not writeable (%dir)', array(
'%dir' => $dir,
)),
);
}
else {
$requirements['coder_upgrade_files'] = array(
'title' => $t('Coder Upgrade directory'),
'value' => $t('Writeable (%dir)', array(
'%dir' => $dir,
)),
);
}
}
return $requirements;
}