You are here

public function DownloadLogger::clear in Commerce File 8.2

Clears the download log for the given license.

Parameters

\Drupal\commerce_license\Entity\LicenseInterface $license: The license.

Overrides DownloadLoggerInterface::clear

File

src/DownloadLogger.php, line 69

Class

DownloadLogger
Provides a service responsible for logging licensed file downloads.

Namespace

Drupal\commerce_file

Code

public function clear(LicenseInterface $license) {
  $this->connection
    ->delete(self::TABLE_NAME)
    ->condition('license_id', $license
    ->id())
    ->execute();
  Cache::invalidateTags($license
    ->getCacheTagsToInvalidate());
  if (isset($this->downloadCounts[$license
    ->id()])) {
    unset($this->downloadCounts[$license
      ->id()]);
  }
}