Issue #3043907 by alexpott, dawehner, starlightE, cilefen: DatabaseCacheBackend::ensureBinExists() does not properly handle exceptions

merge-requests/1119/head
catch 2019-05-30 23:34:52 +01:00
parent 44ffb271f1
commit 2bb3bba520
10 changed files with 20 additions and 20 deletions

View File

@ -3,7 +3,7 @@
namespace Drupal\Core\Batch;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Database\DatabaseException;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Drupal\Core\Access\CsrfTokenGenerator;
@ -174,7 +174,7 @@ class BatchStorage implements BatchStorageInterface {
// If another process has already created the batch table, attempting to
// recreate it will throw an exception. In this case just catch the
// exception and do nothing.
catch (SchemaObjectExistsException $e) {
catch (DatabaseException $e) {
return TRUE;
}
return FALSE;

View File

@ -5,7 +5,7 @@ namespace Drupal\Core\Cache;
use Drupal\Component\Assertion\Inspector;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Database\DatabaseException;
/**
* Defines a default cache implementation.
@ -410,7 +410,7 @@ class DatabaseBackend implements CacheBackendInterface {
// If another process has already created the cache table, attempting to
// recreate it will throw an exception. In this case just catch the
// exception and do nothing.
catch (SchemaObjectExistsException $e) {
catch (DatabaseException $e) {
return TRUE;
}
return FALSE;

View File

@ -3,7 +3,7 @@
namespace Drupal\Core\Cache;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Database\DatabaseException;
/**
* Cache tags invalidations checksum implementation that uses the database.
@ -155,7 +155,7 @@ class DatabaseCacheTagsChecksum implements CacheTagsChecksumInterface, CacheTags
// If another process has already created the cachetags table, attempting to
// recreate it will throw an exception. In this case just catch the
// exception and do nothing.
catch (SchemaObjectExistsException $e) {
catch (DatabaseException $e) {
return TRUE;
}
return FALSE;

View File

@ -4,7 +4,7 @@ namespace Drupal\Core\Config;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Database\DatabaseException;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
/**
@ -169,7 +169,7 @@ class DatabaseStorage implements StorageInterface {
// If another process has already created the config table, attempting to
// recreate it will throw an exception. In this case just catch the
// exception and do nothing.
catch (SchemaObjectExistsException $e) {
catch (DatabaseException $e) {
return TRUE;
}
catch (\Exception $e) {

View File

@ -2,7 +2,7 @@
namespace Drupal\Core\Flood;
use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Database\DatabaseException;
use Symfony\Component\HttpFoundation\RequestStack;
use Drupal\Core\Database\Connection;
@ -159,7 +159,7 @@ class DatabaseBackend implements FloodInterface {
// If another process has already created the table, attempting to create
// it will throw an exception. In this case just catch the exception and do
// nothing.
catch (SchemaObjectExistsException $e) {
catch (DatabaseException $e) {
return TRUE;
}
return FALSE;

View File

@ -4,8 +4,8 @@ namespace Drupal\Core\Lock;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\DatabaseException;
use Drupal\Core\Database\IntegrityConstraintViolationException;
use Drupal\Core\Database\SchemaObjectExistsException;
/**
* Defines the database lock backend. This is the default backend in Drupal.
@ -186,7 +186,7 @@ class DatabaseLockBackend extends LockBackendAbstract {
// If another process has already created the semaphore table, attempting to
// recreate it will throw an exception. In this case just catch the
// exception and do nothing.
catch (SchemaObjectExistsException $e) {
catch (DatabaseException $e) {
return TRUE;
}
return FALSE;

View File

@ -9,8 +9,8 @@ use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\DatabaseException;
use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Database\SchemaObjectExistsException;
/**
* Provides a menu tree storage using the database.
@ -1168,7 +1168,7 @@ class MenuTreeStorage implements MenuTreeStorageInterface {
return TRUE;
}
}
catch (SchemaObjectExistsException $e) {
catch (DatabaseException $e) {
// If another process has already created the config table, attempting to
// recreate it will throw an exception. In this case just catch the
// exception and do nothing.

View File

@ -4,7 +4,7 @@ namespace Drupal\Core\Path;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Database\DatabaseException;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Database\Query\Condition;
@ -380,7 +380,7 @@ class AliasStorage implements AliasStorageInterface {
// If another process has already created the table, attempting to recreate
// it will throw an exception. In this case just catch the exception and do
// nothing.
catch (SchemaObjectExistsException $e) {
catch (DatabaseException $e) {
return TRUE;
}
return FALSE;

View File

@ -3,7 +3,7 @@
namespace Drupal\Core\Queue;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Database\DatabaseException;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
/**
@ -250,7 +250,7 @@ class DatabaseQueue implements ReliableQueueInterface, QueueGarbageCollectionInt
// If another process has already created the queue table, attempting to
// recreate it will throw an exception. In this case just catch the
// exception and do nothing.
catch (SchemaObjectExistsException $e) {
catch (DatabaseException $e) {
return TRUE;
}
return FALSE;

View File

@ -2,7 +2,7 @@
namespace Drupal\Core\Routing;
use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Database\DatabaseException;
use Drupal\Core\State\StateInterface;
use Symfony\Component\Routing\RouteCollection;
@ -179,7 +179,7 @@ class MatcherDumper implements MatcherDumperInterface {
return TRUE;
}
}
catch (SchemaObjectExistsException $e) {
catch (DatabaseException $e) {
// If another process has already created the config table, attempting to
// recreate it will throw an exception. In this case just catch the
// exception and do nothing.