function l10n_update_update_7200 in Localization update 7.2
Migration to 7.x-2.x branch.
File
- ./
l10n_update.install, line 482 - Install file for l10n remote updates.
Code
function l10n_update_update_7200() {
// Make sure the 'translations' stream wrapper class gets registered.
if (!class_exists('TranslationsStreamWrapper')) {
registry_rebuild();
}
// If no translation directory was set, set one here. We try different
// alternative paths as the default may not always be writable.
if (!variable_get('l10n_update_download_store', '')) {
$directories = array(
variable_get('l10n_update_download_store', L10N_UPDATE_DEFAULT_TRANSLATION_PATH),
variable_get('file_public_path', conf_path() . '/files') . '/translations',
'sites/default/files/translations',
);
$directory_created = FALSE;
foreach ($directories as $directory) {
if (file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
variable_set('l10n_update_download_store', $directory);
$directory_created = TRUE;
break;
}
}
if (!$directory_created) {
watchdog('l10n_update', 'The directory %directory does not exist or is not writable.', array(
'%directory' => $directories[0],
), WATCHDOG_ERROR);
drupal_set_message(t('The directory %directory does not exist or is not writable.', array(
'%directory' => $directories[0],
)), 'error');
}
}
// Translation source 'Remote server only' is no longer supported. Use 'Remote
// and local' instead.
$mode = variable_get('l10n_update_check_mode', 3);
if ($mode == 1) {
variable_set('l10n_update_check_mode', 3);
}
// Daily cron updates are no longer supported. Use weekly instead.
$frequency = variable_get('l10n_update_check_frequency', '0');
if ($frequency == '1') {
variable_set('l10n_update_check_frequency', '7');
}
// Clean up deprecated variables.
variable_del('l10n_update_default_server');
variable_del('l10n_update_default_server_url');
variable_del('l10n_update_rebuild_projects');
}