Skip to content
Snippets Groups Projects
Commit 9214227a authored by baldwinlouie's avatar baldwinlouie
Browse files

Issue #3005205: Add ability to notify instance owners

parent 82172828
No related branches found
No related tags found
No related merge requests found
......@@ -331,7 +331,7 @@ function aws_cloud_get_instances_to_notify() {
$config = \Drupal::config('aws_cloud.settings');
$frequency = $config->get('aws_cloud_notification_frequency');
$instances = [];
$results = \Drupal::database()->query("select id, user_id, instance_id, launch_time from {aws_cloud_instance} aws_cloud_instance where aws_cloud_instance.instance_state = :state and unix_timestamp(str_to_date(launch_time, '%Y-%m-%dT%T')) < unix_timestamp(date_sub(current_date(), INTERVAL :day DAY))", [':state' => 'running', ':day' => $config->get('aws_cloud_notification_criteria')])->fetchAll();
$results = \Drupal::database()->query("select id, user_id, instance_id, launch_time from {aws_cloud_instance} aws_cloud_instance where aws_cloud_instance.user_id > 0 and aws_cloud_instance.instance_state = :state and unix_timestamp(str_to_date(launch_time, '%Y-%m-%dT%T')) < unix_timestamp(date_sub(current_date(), INTERVAL :day DAY))", [':state' => 'running', ':day' => $config->get('aws_cloud_notification_criteria')])->fetchAll();
foreach ($results as $result) {
$notified = \Drupal::state()->get('aws_cloud_instance_last_notified_' . $result->id);
$instance = Instance::load($result->id);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment