diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2005-03-18 20:31:00 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2005-03-18 20:31:00 +0000 |
commit | 0805a476b32d3e24329eff60f09295a2980a4c0f (patch) | |
tree | aeb6c17877a254245cdfca9d4a3e07544c37a3e1 | |
parent | ba343d94bace606611cd9be7024e72e3098c781d (diff) | |
download | brdo-0805a476b32d3e24329eff60f09295a2980a4c0f.tar.gz brdo-0805a476b32d3e24329eff60f09295a2980a4c0f.tar.bz2 |
- Use format_plural() for search status (items left to index)
-rw-r--r-- | modules/search.module | 9 | ||||
-rw-r--r-- | modules/search/search.module | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/modules/search.module b/modules/search.module index 6405dd438..ee2b83895 100644 --- a/modules/search.module +++ b/modules/search.module @@ -126,8 +126,8 @@ function search_menu($may_cache) { */ function search_admin() { if ($_POST) { - if (variable_get('minimum_word_size', 3) != $_POST['edit']['minimum_word_size'] || - variable_get('remove_short', 3) != $_POST['edit']['remove_short']) { + // If the word length settings change, the index needs to be rebuilt. + if (variable_get('minimum_word_size', 3) != $_POST['edit']['minimum_word_size']) { // Note: ensure logical order of messages system_settings_save(); drupal_set_message(t('The index will be rebuilt.')); @@ -148,8 +148,9 @@ function search_admin() { $total += $status['total']; } } + $count = format_plural($remaining, 'There is 1 item left to index.', 'There are %count items left to index.'); $percentage = ((int)min(100, 100 * ($total - $remaining) / max(1, $total))) . '%'; - $status = '<p><strong>'. t('%percentage of the site has been indexed. There are %count items left to index.', array('%percentage' => $percentage, '%count' => $remaining)) .'</strong></p>'; + $status = '<p><strong>'. t('%percentage of the site has been indexed.', array('%percentage' => $percentage)) .' '. $count .'</strong></p>'; $output = form_group('Indexing status', $status); // Indexing throttle: @@ -157,7 +158,7 @@ function search_admin() { $group = form_select(t('Items to index per cron run'), 'search_cron_limit', variable_get('search_cron_limit', 100), $items, t('The maximum amount of items that will be indexed in one cron run. Set this number lower if your cron is timing out or if PHP is running out of memory.')); $output .= form_group(t('Indexing throttle'), $group); // Indexing settings: - $group = '<em>'. t('<p>Changing the settings below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</p><p>The default settings should be appropriate for the majority of sites.</p>') .'</em>'; + $group = '<em>'. t('<p>Changing the setting below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</p><p>The default settings should be appropriate for the majority of sites.</p>') .'</em>'; $group .= form_textfield(t('Minimum word length to index'), 'minimum_word_size', variable_get('minimum_word_size', 3), 3, 3, t('The number of characters a word has to be to be indexed. Words shorter than this will not be searchable.')); $group .= form_textfield(t('Minimum word length to search for'), 'remove_short', variable_get('remove_short', 3), 3, 3, t('The number of characters a word has to be to be searched for, including wildcard characters.')); $output .= form_group(t('Indexing settings'), $group); diff --git a/modules/search/search.module b/modules/search/search.module index 6405dd438..ee2b83895 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -126,8 +126,8 @@ function search_menu($may_cache) { */ function search_admin() { if ($_POST) { - if (variable_get('minimum_word_size', 3) != $_POST['edit']['minimum_word_size'] || - variable_get('remove_short', 3) != $_POST['edit']['remove_short']) { + // If the word length settings change, the index needs to be rebuilt. + if (variable_get('minimum_word_size', 3) != $_POST['edit']['minimum_word_size']) { // Note: ensure logical order of messages system_settings_save(); drupal_set_message(t('The index will be rebuilt.')); @@ -148,8 +148,9 @@ function search_admin() { $total += $status['total']; } } + $count = format_plural($remaining, 'There is 1 item left to index.', 'There are %count items left to index.'); $percentage = ((int)min(100, 100 * ($total - $remaining) / max(1, $total))) . '%'; - $status = '<p><strong>'. t('%percentage of the site has been indexed. There are %count items left to index.', array('%percentage' => $percentage, '%count' => $remaining)) .'</strong></p>'; + $status = '<p><strong>'. t('%percentage of the site has been indexed.', array('%percentage' => $percentage)) .' '. $count .'</strong></p>'; $output = form_group('Indexing status', $status); // Indexing throttle: @@ -157,7 +158,7 @@ function search_admin() { $group = form_select(t('Items to index per cron run'), 'search_cron_limit', variable_get('search_cron_limit', 100), $items, t('The maximum amount of items that will be indexed in one cron run. Set this number lower if your cron is timing out or if PHP is running out of memory.')); $output .= form_group(t('Indexing throttle'), $group); // Indexing settings: - $group = '<em>'. t('<p>Changing the settings below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</p><p>The default settings should be appropriate for the majority of sites.</p>') .'</em>'; + $group = '<em>'. t('<p>Changing the setting below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</p><p>The default settings should be appropriate for the majority of sites.</p>') .'</em>'; $group .= form_textfield(t('Minimum word length to index'), 'minimum_word_size', variable_get('minimum_word_size', 3), 3, 3, t('The number of characters a word has to be to be indexed. Words shorter than this will not be searchable.')); $group .= form_textfield(t('Minimum word length to search for'), 'remove_short', variable_get('remove_short', 3), 3, 3, t('The number of characters a word has to be to be searched for, including wildcard characters.')); $output .= form_group(t('Indexing settings'), $group); |