You are here

acsf_theme.module in Acquia Cloud Site Factory Connector 8.2

Same filename and directory in other branches
  1. 8 acsf_theme/acsf_theme.module

Manages VCS-based themes on Acquia Cloud Site Factory.

File

acsf_theme/acsf_theme.module
View source
<?php

/**
 * @file
 * Manages VCS-based themes on Acquia Cloud Site Factory.
 */

/**
 * Implements hook_cron().
 */
function acsf_theme_cron() {

  // Don't execute on non-ACSF systems.
  if (!empty($GLOBALS['gardens_site_settings'])) {

    // When none of the notification sending succeeded then this variable will
    // contain a timestamp when the next time the cron should run to avoid
    // hammering the factory.
    $cron_next_run = \Drupal::service('acsf.variable_storage')
      ->get('acsf_theme_cron_wait_until', 0);
    if ($cron_next_run < \Drupal::time()
      ->getRequestTime()) {
      $batch_size = \Drupal::service('acsf.variable_storage')
        ->get('acsf_theme_notification_batch_size', 10);
      $success = \Drupal::service('acsf.theme_notification')
        ->processNotifications($batch_size);
      if ($success < 0) {
        $cron_delay = \Drupal::service('acsf.variable_storage')
          ->get('acsf_theme_cron_delay', 600);
        \Drupal::service('acsf.variable_storage')
          ->set('acsf_theme_cron_wait_until', time() + $cron_delay);
      }
    }
  }
}

/**
 * Implements hook_acsf_registry().
 */
function acsf_theme_acsf_registry() {
  return [
    'events' => [
      [
        'type' => 'site_duplication_scrub',
        'class' => '\\Drupal\\acsf\\Event\\AcsfThemeDuplicationScrubbingHandler',
        'weight' => 0,
      ],
    ],
  ];
}

Functions