You are here

public function GroupUserUpdateProcessor::updateDue in Lightweight Directory Access Protocol (LDAP) 8.3

Same name and namespace in other branches
  1. 8.4 ldap_user/src/Processor/GroupUserUpdateProcessor.php \Drupal\ldap_user\Processor\GroupUserUpdateProcessor::updateDue()

Check whether updates are due.

Return value

bool Whether to update.

File

ldap_user/src/Processor/GroupUserUpdateProcessor.php, line 69

Class

GroupUserUpdateProcessor
Provides functionality to generically update existing users.

Namespace

Drupal\ldap_user\Processor

Code

public function updateDue() {
  $lastRun = $this->state
    ->get('ldap_user_cron_last_group_user_update', 1);
  $result = FALSE;
  switch ($this->config
    ->get('userUpdateCronInterval')) {
    case 'always':
      $result = TRUE;
      break;
    case 'daily':
      $result = strtotime('today -1 day') - $lastRun >= 0;
      break;
    case 'weekly':
      $result = strtotime('today -7 day') - $lastRun >= 0;
      break;
    case 'monthly':
      $result = strtotime('today -30 day') - $lastRun >= 0;
      break;
  }
  return $result;
}