summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxjm2015-05-07 17:54:59 -0700
committerxjm2015-05-07 17:54:59 -0700
commit1bc53594319247573e8a7d267ced588a9d1c73e9 (patch)
tree665af5f39ef5050d2d06a91b953b9df547d0a33b
parent608f81bf5845851375c164fe4a660e33dfcd4649 (diff)
Issue #2484667 by joshi.rohit100, Berdir: Do not run query in node_cron() if search.module is not enabled
-rw-r--r--core/modules/node/node.module28
1 files changed, 15 insertions, 13 deletions
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 4550a6d..d33d6b2 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -622,19 +622,21 @@ function node_cron() {
// Calculate the oldest and newest node created times, for use in search
// rankings. (Note that field aliases have to be variables passed by
// reference.)
- $min_alias = 'min_created';
- $max_alias = 'max_created';
- $result = \Drupal::entityQueryAggregate('node')
- ->aggregate('created', 'MIN', NULL, $min_alias)
- ->aggregate('created', 'MAX', NULL, $max_alias)
- ->execute();
- if (isset($result[0])) {
- // Make an array with definite keys and store it in the state system.
- $array = array(
- 'min_created' => $result[0][$min_alias],
- 'max_created' => $result[0][$max_alias],
- );
- \Drupal::state()->set('node.min_max_update_time', $array);
+ if (\Drupal::moduleHandler()->moduleExists('search')) {
+ $min_alias = 'min_created';
+ $max_alias = 'max_created';
+ $result = \Drupal::entityQueryAggregate('node')
+ ->aggregate('created', 'MIN', NULL, $min_alias)
+ ->aggregate('created', 'MAX', NULL, $max_alias)
+ ->execute();
+ if (isset($result[0])) {
+ // Make an array with definite keys and store it in the state system.
+ $array = array(
+ 'min_created' => $result[0][$min_alias],
+ 'max_created' => $result[0][$max_alias],
+ );
+ \Drupal::state()->set('node.min_max_update_time', $array);
+ }
}
}