You are here

public function Basic::trackAllItemsDeleted in Search API 8

Removes all items from the tracker, or only those of a specific datasource.

Parameters

string|null $datasource_id: (optional) If given, only items of that datasource are removed.

Overrides TrackerInterface::trackAllItemsDeleted

File

src/Plugin/search_api/tracker/Basic.php, line 345

Class

Basic
Provides a tracker implementation which uses a FIFO-like processing order.

Namespace

Drupal\search_api\Plugin\search_api\tracker

Code

public function trackAllItemsDeleted($datasource_id = NULL) {
  try {
    $delete = $this
      ->createDeleteStatement();
    if ($datasource_id) {
      $delete
        ->condition('datasource', $datasource_id);
    }
    $delete
      ->execute();
  } catch (\Exception $e) {
    $this
      ->logException($e);
  }
}