Issue #2067551 by lokapujya, Kartagis, sandipmkhairnar, jlindsey15: /core/lib/Drupal/Core/Routing/MatcherDumper.php will never roll back its transaction.

8.0.x
Nathaniel Catchpole 2013-12-10 13:51:55 +00:00
parent 52d3b49336
commit 51e320178e
1 changed files with 14 additions and 13 deletions

View File

@ -109,19 +109,20 @@ class MatcherDumper implements MatcherDumperInterface {
// Delete any old records in this provider first, then insert the new ones. // Delete any old records in this provider first, then insert the new ones.
// That avoids stale data. The transaction makes it atomic to avoid // That avoids stale data. The transaction makes it atomic to avoid
// unstable router states due to random failures. // unstable router states due to random failures.
$txn = $this->connection->startTransaction(); $transaction = $this->connection->startTransaction();
try {
$this->connection->delete($this->tableName) $this->connection->delete($this->tableName)
->condition('provider', $options['provider']) ->condition('provider', $options['provider'])
->execute(); ->execute();
$insert->execute(); $insert->execute();
// We want to reuse the dumper for multiple providers, so on dump, flush // We want to reuse the dumper for multiple providers, so on dump, flush
// the queued routes. // the queued routes.
$this->routes = NULL; $this->routes = NULL;
} catch (\Exception $e) {
// Transaction ends here. $transaction->rollback();
watchdog_exception('Routing', $e);
throw $e;
}
} }
/** /**