You are here

public function SimplesitemapQueue::createItems in Simple XML sitemap 8.3

Same name and namespace in other branches
  1. 4.x src/Queue/SimpleSitemapQueue.php \Drupal\simple_sitemap\Queue\SimpleSitemapQueue::createItems()

File

src/Queue/SimplesitemapQueue.php, line 77

Class

SimplesitemapQueue
Class SimplesitemapQueue @package Drupal\simple_sitemap\Queue

Namespace

Drupal\simple_sitemap\Queue

Code

public function createItems($data_sets) {
  $try_again = FALSE;
  try {
    $id = $this
      ->doCreateItems($data_sets);
  } catch (\Exception $e) {

    // If there was an exception, try to create the table.
    if (!($try_again = $this
      ->ensureTableExists())) {

      // If the exception happened for other reason than the missing table,
      // propagate the exception.
      throw $e;
    }
  }

  // Now that the table has been created, try again if necessary.
  if ($try_again) {
    $id = $this
      ->doCreateItems($data_sets);
  }
  return $id;
}