Commit da7d7a95 authored by webchick's avatar webchick

Issue #2143093 by vijaycs85, Gábor Hojtsy | ti2m: Remove translation update...

Issue #2143093 by vijaycs85, Gábor Hojtsy | ti2m: Remove translation update for uninstalled modules and themes.
parent d50b1695
......@@ -4,7 +4,6 @@ javascript:
directory: languages
translation:
use_source: remote_and_local
check_disabled_modules: false
default_filename: '%project-%version.%language.po'
default_server_pattern: 'http://ftp.drupal.org/files/translations/%core/%project/%project-%version.%language.po'
overwrite_customized: false
......
......@@ -24,9 +24,6 @@ locale.settings:
use_source:
type: string
label: 'Translation source'
check_disabled_modules:
type: boolean
label: 'Check for updates of disabled modules and themes'
default_filename:
type: string
label: 'Default translation filename pattern'
......
......@@ -38,12 +38,6 @@ public function buildForm(array $form, array &$form_state) {
'#description' => t('Select how frequently you want to check for new interface translations for your currently installed modules and themes. <a href="@url">Check updates now</a>.', array('@url' => url('admin/reports/translations/check'))),
);
$form['check_disabled_modules'] = array(
'#type' => 'checkbox',
'#title' => t('Check for updates of disabled modules and themes'),
'#default_value' => $config->get('translation.check_disabled_modules'),
);
if ($directory = $config->get('translation.path')) {
$description = t('Translation files are stored locally in the %path directory. You can change this directory on the <a href="@url">File system</a> configuration page.', array('%path' => $directory, '@url' => url('admin/config/media/file-system')));
}
......@@ -111,28 +105,26 @@ public function submitForm(array &$form, array &$form_state) {
case LOCALE_TRANSLATION_OVERWRITE_ALL:
$config
->set('translation.overwrite_customized', TRUE)
->set('translation.overwrite_not_customized', TRUE);
->set('translation.overwrite_not_customized', TRUE)
->save();
break;
case LOCALE_TRANSLATION_OVERWRITE_NON_CUSTOMIZED:
$config
->set('translation.overwrite_customized', FALSE)
->set('translation.overwrite_not_customized', TRUE);
->set('translation.overwrite_not_customized', TRUE)
->save();
break;
case LOCALE_TRANSLATION_OVERWRITE_NONE:
$config
->set('translation.overwrite_customized', FALSE)
->set('translation.overwrite_not_customized', FALSE);
->set('translation.overwrite_not_customized', FALSE)
->save();
break;
}
$config
->set('translation.check_disabled_modules', $values['check_disabled_modules'])
->save();
// Invalidate the cached translation status when the configuration setting of
// 'use_source' and 'check_disabled_modules' change.
if ($form['use_source']['#default_value'] != $form_state['values']['use_source'] ||
$form['check_disabled_modules']['#default_value'] != $form_state['values']['check_disabled_modules']) {
// 'use_source' changes.
if ($form['use_source']['#default_value'] != $form_state['values']['use_source']) {
locale_translation_clear_status();
}
......
......@@ -60,28 +60,6 @@ function testUpdateProjects() {
$this->assertEqual($projects['locale_test']['name'] , 'locale_test', format_string('%key found in project info.', array('%key' => 'interface translation project')));
}
/**
* Check if a list of translatable projects can include hidden projects.
*/
function testUpdateProjectsHidden() {
module_load_include('compare.inc', 'locale');
\Drupal::config('locale.settings');
// Make the test modules look like a normal custom module.
\Drupal::state()->set('locale.test_system_info_alter', TRUE);
$this->resetAll();
// Set test condition: include disabled modules when building a project list.
$edit = array(
'check_disabled_modules' => TRUE,
);
$this->drupalPostForm('admin/config/regional/translate/settings', $edit, t('Save configuration'));
$projects = locale_translation_project_list();
$this->assertTrue(isset($projects['locale_test_translate']), 'Disabled module found');
$this->assertTrue(isset($projects['locale_test']), 'Enabled module found');
}
/**
* Checks if local or remote translation sources are detected.
*
......
......@@ -142,10 +142,6 @@ function locale_translation_project_list() {
$project_info = new ProjectInfo();
$project_info->processInfoList($projects, $module_data, 'module', TRUE, $additional_whitelist);
$project_info->processInfoList($projects, $theme_data, 'theme', TRUE, $additional_whitelist);
if ($config->get('translation.check_disabled_modules')) {
$project_info->processInfoList($projects, $module_data, 'module', FALSE, $additional_whitelist);
$project_info->processInfoList($projects, $theme_data, 'theme', FALSE, $additional_whitelist);
}
// Allow other modules to alter projects before fetching and comparing.
drupal_alter('locale_translation_projects', $projects);
......
......@@ -330,9 +330,8 @@ function locale_cron_fill_queue() {
$query->join('locale_project', 'p', 'p.name = f.project');
$query->condition('f.last_checked', $last, '<');
$query->fields('f', array('project', 'langcode'));
if (!$config->get('translation.check_disabled_modules')) {
$query->condition('p.status', 1);
}
// Only currently installed / enabled components should be checked for.
$query->condition('p.status', 1);
$files = $query->execute()->fetchAll();
foreach ($files as $file) {
$updates[$file->project][] = $file->langcode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment