diff --git a/core/modules/comment/comment.admin.inc b/core/modules/comment/comment.admin.inc index 73a5316..b6e0f1b 100644 --- a/core/modules/comment/comment.admin.inc +++ b/core/modules/comment/comment.admin.inc @@ -163,7 +163,13 @@ function comment_admin_overview_submit($form, &$form_state) { if ($operation == 'delete') { $deleted = comment_delete_multiple($cids); if ($deleted != count($cids)) { - drupal_set_message(format_plural(count($cids) - $deleted, '1 comment has been scheduled for deletion on the next cron run. Run cron now to finish deleting this comment immediately.', '@count comments have been scheduled for deletion on the next cron run. Run cron now to finish deleting these comments immediately.', array('@cron' => url('admin/logs/status/run-cron')))); + $cron_url = url('admin/reports/status/run-cron', array('query' => drupal_get_destination())); + if (user_access('administer site configuration')) { + drupal_set_message(format_plural(count($cids) - $deleted, '1 comment has been scheduled for deletion on the next cron run. Run cron now to finish deleting this comment immediately.', '@count comments have been scheduled for deletion on the next cron run. Run cron now to finish deleting these comments immediately.', array('@cron' => $cron_url))); + } + else { + drupal_set_message(format_plural(count($cids) - $deleted, '1 comment has been scheduled for deletion on the next cron run.', '@count comments have been scheduled for deletion on the next cron run.')); + } } } else { @@ -239,7 +245,13 @@ function comment_multiple_delete_confirm_submit($form, &$form_state) { // In case the jobs get enqueued, we warn user. if ($count != $deleted) { - drupal_set_message(format_plural($count - $deleted, '1 comment has been scheduled for deletion on the next cron run. Run cron now to finish deleting this comment immediately.', '@count comments have been scheduled for deletion on the next cron run. Run cron now to finish deleting these comments immediately.', array('@cron' => url('admin/logs/status/run-cron')))); + $cron_url = url('admin/reports/status/run-cron', array('query' => drupal_get_destination())); + if (user_access('administer site configuration')) { + drupal_set_message(format_plural(count($cids) - $deleted, '1 comment has been scheduled for deletion on the next cron run. Run cron now to finish deleting this comment immediately.', '@count comments have been scheduled for deletion on the next cron run. Run cron now to finish deleting these comments immediately.', array('@cron' => $cron_url))); + } + else { + drupal_set_message(format_plural(count($cids) - $deleted, '1 comment has been scheduled for deletion on the next cron run.', '@count comments have been scheduled for deletion on the next cron run.')); + } } } $form_state['redirect'] = 'admin/content/comment'; diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc index 25a76a0..2fdd13e 100644 --- a/core/modules/node/node.admin.inc +++ b/core/modules/node/node.admin.inc @@ -594,7 +594,13 @@ function node_multiple_delete_confirm_submit($form, &$form_state) { // In case the jobs get enqueued, we warn user. if ($count != $deleted) { - drupal_set_message(format_plural($count - $deleted, '1 node has been scheduled for deletion on the next cron run. Run cron now to finish deleting this comment immediately.', '@count nodes have been scheduled for deletion on the next cron run. Run cron now to finish deleting these nodes immediately.', array('@cron' => url('admin/logs/status/run-cron')))); + $cron_url = url('admin/reports/status/run-cron', array('query' => drupal_get_destination())); + if (user_access('administer site configuration')) { + drupal_set_message(format_plural($count - $deleted, '1 node has been scheduled for deletion on the next cron run. Run cron now to finish deleting this node immediately.', '@count nodes have been scheduled for deletion on the next cron run. Run cron now to finish deleting these nodes immediately.', array('@cron' => $cron_url))); + } + else { + drupal_set_message(format_plural($count - $deleted, '1 node has been scheduled for deletion on the next cron run.', '@count nodes have been scheduled for deletion on the next cron run.')); + } } } $form_state['redirect'] = 'admin/content'; diff --git a/core/modules/system/system.module b/core/modules/system/system.module index bbae41c..a38480f 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -16,6 +16,11 @@ define('DRUPAL_MAXIMUM_TEMP_FILE_AGE', 21600); define('DRUPAL_CRON_DEFAULT_THRESHOLD', 10800); /** + * Default threshold item count for bulk queue operations. + */ +define('DRUPAL_QUEUE_DEFAULT_THRESHOLD', 20); + +/** * New users will be set to the default time zone at registration. */ define('DRUPAL_USER_TIMEZONE_DEFAULT', 0); @@ -3053,20 +3058,23 @@ function system_queue_worker($data) { /** * Splits large datasets into smaller subsets for processing. * - * When the dataset is larger than the allowed threshold defined by the - * 'queue_bulk_threshold' configuration variable, a subset is returned and the - * remaining items are added to the queue for later processing. + * When the dataset is larger than the allowed threshold, the first subset is + * returned and the remaining items are added to the queue for later + * processing. * * @param $callback * The callback for the job being added. * @param $items * An array of items to be processed. + * @param $threshold + * (optional) Number of items to process per job. If NULL, the configuration + * variable 'queue_default_threshold' will be used. Defaults to NULL. * * @return * A subset of items to be processed that does not exceed the bulk threshold. */ -function system_workers_bulk_split($callback, $items) { - $threshold = variable_get('queue_bulk_threshold', 20); +function system_workers_bulk_split($callback, $items, $threshold = NULL) { + $threshold = $threshold ? $threshold : variable_get('queue_bulk_threshold', DRUPAL_QUEUE_DEFAULT_THRESHOLD); if (count($items) > $threshold) { $jobs = array_chunk($items, $threshold);