comparison 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
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
2 2
3 namespace Drupal\migrate_drupal; 3 namespace Drupal\migrate_drupal;
4 4
5 use Drupal\Core\Database\Connection; 5 use Drupal\Core\Database\Connection;
6 use Drupal\Core\Database\Database; 6 use Drupal\Core\Database\Database;
7 use Drupal\Core\Database\DatabaseExceptionWrapper;
7 use Drupal\migrate\Exception\RequirementsException; 8 use Drupal\migrate\Exception\RequirementsException;
8 use Drupal\migrate\Plugin\RequirementsInterface; 9 use Drupal\migrate\Plugin\RequirementsInterface;
9 10
10 /** 11 /**
11 * Configures the appropriate migrations for a given source Drupal database. 12 * Configures the appropriate migrations for a given source Drupal database.
54 ->execute(); 55 ->execute();
55 foreach ($results as $result) { 56 foreach ($results as $result) {
56 $system_data[$result['type']][$result['name']] = $result; 57 $system_data[$result['type']][$result['name']] = $result;
57 } 58 }
58 } 59 }
59 catch (\Exception $e) { 60 catch (DatabaseExceptionWrapper $e) {
60 // The table might not exist for example in tests. 61 // The table might not exist for example in tests.
61 } 62 }
62 return $system_data; 63 return $system_data;
63 } 64 }
64 65
187 } 188 }
188 } 189 }
189 // For Drupal 8 (and we're predicting beyond) the schema version is in the 190 // For Drupal 8 (and we're predicting beyond) the schema version is in the
190 // key_value store. 191 // key_value store.
191 elseif ($connection->schema()->tableExists('key_value')) { 192 elseif ($connection->schema()->tableExists('key_value')) {
192 $result = $connection 193 try {
193 ->query("SELECT value FROM {key_value} WHERE collection = :system_schema and name = :module", [':system_schema' => 'system.schema', ':module' => 'system']) 194 $result = $connection
194 ->fetchField(); 195 ->query("SELECT value FROM {key_value} WHERE collection = :system_schema and name = :module", [
195 $version_string = unserialize($result); 196 ':system_schema' => 'system.schema',
197 ':module' => 'system',
198 ])
199 ->fetchField();
200 $version_string = unserialize($result);
201 }
202 catch (DatabaseExceptionWrapper $e) {
203 $version_string = FALSE;
204 }
196 } 205 }
197 else { 206 else {
198 $version_string = FALSE; 207 $version_string = FALSE;
199 } 208 }
200 209