function BatchStorage::cleanup

Cleans up failed or old batches.

Overrides BatchStorageInterface::cleanup

File

core/lib/Drupal/Core/Batch/BatchStorage.php, line 108

Class

BatchStorage

Namespace

Drupal\Core\Batch

Code

public function cleanup() {
  try {
    // Cleanup the batch table and the queue for failed batches.
    $this->connection
      ->delete('batch')
      ->condition('timestamp', REQUEST_TIME - 864000, '<')
      ->execute();
  } catch (\Exception $e) {
    $this->catchException($e);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.