diff --git a/lib/Drupal/search_api/Entity/Index.php b/lib/Drupal/search_api/Entity/Index.php index ac9d5b0..9ce7333 100644 --- a/lib/Drupal/search_api/Entity/Index.php +++ b/lib/Drupal/search_api/Entity/Index.php @@ -219,11 +219,13 @@ class Index extends ConfigEntityBase implements IndexInterface { public function __construct(array $values, $entity_type) { // Perform default instance construction. parent::__construct($values, $entity_type); - // Check if the tracker plugin ID is unconfigured. + + // Check if the tracker plugin ID is not configured. if ($this->trackerPluginId === NULL) { // Set tracker plugin ID to the default tracker. $this->trackerPluginId = \Drupal::config('search_api.settings')->get('default_tracker'); } + // Merge in default options. $this->options += array( 'cron_limit' => \Drupal::configFactory()->get('search_api.settings')->get('cron_limit'), @@ -232,7 +234,7 @@ class Index extends ConfigEntityBase implements IndexInterface { } /** - * Clones an index object. + * {@inheritdoc} */ public function __clone() { // Prevent the datasource, tracker and server instance from being cloned. @@ -302,9 +304,7 @@ class Index extends ConfigEntityBase implements IndexInterface { * {@inheritdoc} */ public function hasValidDatasource() { - // Get the datasource plugin definition. $datasource_plugin_definition = \Drupal::service('search_api.datasource.plugin.manager')->getDefinition($this->datasourcePluginId); - // Determine whether the datasource is valid. return !empty($datasource_plugin_definition); } @@ -334,9 +334,7 @@ class Index extends ConfigEntityBase implements IndexInterface { * {@inheritdoc} */ public function hasValidTracker() { - // Get the tracker plugin manager. $tracker_plugin_definition = \Drupal::service('plugin.manager.search_api.tracker')->getDefinition($this->getTrackerId()); - // Determine whether the tracker is valid. return !empty($tracker_plugin_definition); } @@ -840,6 +838,7 @@ class Index extends ConfigEntityBase implements IndexInterface { */ public function resetCaches() { $this->datasourcePluginInstance = NULL; + $this->trackerPluginInstance = NULL; $this->server = NULL; $this->fields = NULL; $this->fulltextFields = NULL; @@ -891,7 +890,7 @@ class Index extends ConfigEntityBase implements IndexInterface { // $this->queueItems(); } } - // Only check if there is a datasource + // Only check if there is a datasource. if ($this->hasValidDatasource()) { // If the index is new (so no update) and the status is enabled, start tracking // If the index is not new but the original status is disabled and the new status, start tracking diff --git a/lib/Drupal/search_api/Plugin/SearchApi/Tracker/DefaultTracker.php b/lib/Drupal/search_api/Plugin/SearchApi/Tracker/DefaultTracker.php index b85d6d4..629ef38 100644 --- a/lib/Drupal/search_api/Plugin/SearchApi/Tracker/DefaultTracker.php +++ b/lib/Drupal/search_api/Plugin/SearchApi/Tracker/DefaultTracker.php @@ -64,7 +64,6 @@ class DefaultTracker extends TrackerPluginBase { * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - /** @var $connection \Drupal\Core\Database\Connection */ $connection = $container->get('database'); // Create the plugin instance. return new static($connection, $configuration, $plugin_id, $plugin_definition); @@ -171,7 +170,7 @@ class DefaultTracker extends TrackerPluginBase { // Mark operation as successful. $success = TRUE; } - catch (Exception $ex) { + catch (\Exception $ex) { // Log exception to watchdog. watchdog_exception('Search API', $ex); // Rollback any changes made to the database. @@ -215,7 +214,7 @@ class DefaultTracker extends TrackerPluginBase { // Mark operation as successful. $success = TRUE; } - catch (Exception $ex) { + catch (\Exception $ex) { // Log exception to watchdog. watchdog_exception('Search API', $ex); // Rollback any changes made to the database. @@ -257,7 +256,7 @@ class DefaultTracker extends TrackerPluginBase { // Mark operation as successful. $success = TRUE; } - catch (Exception $ex) { + catch (\Exception $ex) { // Log exception to watchdog. watchdog_exception('Search API', $ex); // Rollback any changes made to the database. @@ -303,7 +302,7 @@ class DefaultTracker extends TrackerPluginBase { // Mark operation as successful. $success = TRUE; } - catch (Exception $ex) { + catch (\Exception $ex) { // Log exception to watchdog. watchdog_exception('Search API', $ex); // Rollback any changes made to the database. @@ -413,7 +412,7 @@ class DefaultTracker extends TrackerPluginBase { // Mark operation as successful. $success = TRUE; } - catch (Exception $ex) { + catch (\Exception $ex) { // Log exception to watchdog. watchdog_exception('Search API', $ex); // Rollback any changes made to the database.