node_cron()
Implements hook_cron().
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.) 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); } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!node!node.module/function/node_cron/8.1.x