function l10n_update_requirements in Localization update 6
Same name and namespace in other branches
- 7.2 l10n_update.install \l10n_update_requirements()
- 7 l10n_update.install \l10n_update_requirements()
Implementation of hook_requirements().
File
- ./
l10n_update.install, line 186 - Install file for l10n remote updates.
Code
function l10n_update_requirements($phase) {
$requirements = array();
if ($phase == 'runtime' && variable_get('l10n_update_check_frequency', 0)) {
if (l10n_update_get_projects() && l10n_update_language_list()) {
$requirements['l10n_update']['title'] = t('Translation update status');
if (l10n_update_available_updates()) {
$destination = drupal_get_destination();
$requirements['l10n_update']['severity'] = REQUIREMENT_WARNING;
$requirements['l10n_update']['value'] = t('There are available updates');
$requirements['l10n_update']['description'] = t('There are new or updated translations available for currently installed modules and themes. To check for updates, you can visit the <a href="@check_manually">translation update page</a>.', array(
'@check_manually' => url('admin/build/translate/update', array(
'query' => $destination,
)),
));
}
else {
$requirements['l10n_update']['severity'] = REQUIREMENT_OK;
$requirements['l10n_update']['value'] = t('All your translations are up to date');
}
}
else {
$requirements['l10n_update']['title'] = t('Translation update status');
$requirements['l10n_update']['value'] = t('No update data available');
$requirements['l10n_update']['severity'] = REQUIREMENT_WARNING;
//$requirements['update_core']['reason'] = UPDATE_UNKNOWN;
$requirements['l10n_update']['description'] = _l10n_update_no_data();
}
}
if ($phase == 'runtime') {
// Test the contents of the .htaccess file in the translations directory.
$directory = variable_get('l10n_update_download_store', '');
if ($directory) {
l10n_update_ensure_htaccess();
$htaccess_file = $directory . '/.htaccess';
// Check for the string which was added to the recommended .htaccess file
// in the latest security update.
if (!file_exists($htaccess_file) || !($contents = @file_get_contents($htaccess_file)) || strpos($contents, 'Drupal_Security_Do_Not_Remove_See_SA_2013_003') === FALSE) {
$requirements['l10n_update_htaccess'] = array(
'title' => t('Translations directory'),
'value' => t('Not fully protected'),
'severity' => REQUIREMENT_ERROR,
'description' => t('See <a href="@url">@url</a> for information about the recommended .htaccess file which should be added to the %directory directory to help protect against arbitrary code execution.', array(
'@url' => 'http://drupal.org/SA-CORE-2013-003',
'%directory' => $directory,
)),
);
}
}
}
return $requirements;
}