You are here

function UpdateHelper::lastRun in Evercurrent 8

Same name and namespace in other branches
  1. 8.2 src/UpdateHelper.php \Drupal\evercurrent\UpdateHelper::lastRun()

Get interval since last try.

Return value

string

File

src/UpdateHelper.php, line 269
Contains Drupal\evercurrent\UpdateHelper.

Class

UpdateHelper
Class UpdateHelper.

Namespace

Drupal\evercurrent

Code

function lastRun() {
  $last = \Drupal::state()
    ->get('evercurrent_last_run') ?: 0;
  if ($last > 0) {
    $last_time = \Drupal::service('date.formatter')
      ->formatInterval(time() - $last);
  }
  else {
    $last_time = t('Never.');
  }
  return t('%last_time', [
    '%last_time' => $last_time,
  ]);
}