summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelle Sebreghts2016-10-06 06:17:47 (GMT)
committerJelle Sebreghts2016-10-06 06:17:47 (GMT)
commit40f93f74561e009767185708db1e2b7c927d273e (patch)
tree2f25d3fc392bce68a808123ef08ec9b6d186993f
parent9bb9067ababc1e3512253cc5b3665e1921d5bd7d (diff)
Fixed issue #2811847: cannot update database going from 1.3 to 1.47.x-1.5
-rw-r--r--webform_multifile.install7
1 files changed, 7 insertions, 0 deletions
diff --git a/webform_multifile.install b/webform_multifile.install
index 488cd6e..5b50974 100644
--- a/webform_multifile.install
+++ b/webform_multifile.install
@@ -46,6 +46,13 @@ function webform_multifile_update_7001(&$sandbox) {
$q->range($sandbox['current'], 50);
module_load_include('inc', 'webform_multifile', 'safe_unserialize');
foreach ($q->execute()->fetchAll() as $data) {
+ // Check to see if this data is already JSON. Can happen when the update
+ // gets interrupted: https://www.drupal.org/node/2811847.
+ $json = drupal_json_decode($data->data);
+ if (json_last_error() === JSON_ERROR_NONE) {
+ $sandbox['current']++;
+ continue;
+ }
$data->data = drupal_json_encode(safe_unserialize($data->data));
db_update('webform_submitted_data')
->fields(array('data' => $data->data))