diff core/modules/migrate_drupal/src/MigrationConfigurationTrait.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
line wrap: on
line diff
--- a/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php	Thu Feb 28 13:11:55 2019 +0000
+++ b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php	Thu May 09 15:34:47 2019 +0100
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Database\Connection;
 use Drupal\Core\Database\Database;
+use Drupal\Core\Database\DatabaseExceptionWrapper;
 use Drupal\migrate\Exception\RequirementsException;
 use Drupal\migrate\Plugin\RequirementsInterface;
 
@@ -56,7 +57,7 @@
         $system_data[$result['type']][$result['name']] = $result;
       }
     }
-    catch (\Exception $e) {
+    catch (DatabaseExceptionWrapper $e) {
       // The table might not exist for example in tests.
     }
     return $system_data;
@@ -189,10 +190,18 @@
     // For Drupal 8 (and we're predicting beyond) the schema version is in the
     // key_value store.
     elseif ($connection->schema()->tableExists('key_value')) {
-      $result = $connection
-        ->query("SELECT value FROM {key_value} WHERE collection = :system_schema  and name = :module", [':system_schema' => 'system.schema', ':module' => 'system'])
-        ->fetchField();
-      $version_string = unserialize($result);
+      try {
+        $result = $connection
+          ->query("SELECT value FROM {key_value} WHERE collection = :system_schema  and name = :module", [
+            ':system_schema' => 'system.schema',
+            ':module' => 'system',
+          ])
+          ->fetchField();
+        $version_string = unserialize($result);
+      }
+      catch (DatabaseExceptionWrapper $e) {
+        $version_string = FALSE;
+      }
     }
     else {
       $version_string = FALSE;