/**
  * Implements hook_cron().
  */
 public static function hookCron()
 {
     $handle_content_expiry = ConfigHandler::getHandleContentExpiry();
     if ($handle_content_expiry != 2) {
         $result = DbHandler::selectExpired();
     } else {
         $result = DbHandler::selectExpiredNonFlagged();
     }
     // $nids = array();
     // Create NodeTypesConfigHandler once for whole cycle.
     $config_handler = new NodeTypesConfigHandler();
     foreach ($result as $record) {
         // Try to handle the record.
         try {
             // $nids[] = $record->nid;
             $node_type = $record->type;
             $action_type = $config_handler->getActionType($node_type);
             $nid = $record->nid;
             DbHandler::setExpired($nid);
             // $node = node_load($record->nid);
             // rules_invoke_event('node_expired', $node);
             ActionsHandler::doAction($action_type, $nid);
         } catch (\Exception $e) {
             // TODO: Add configurable logging.
         }
     }
 }