From 92d229978163baa23d0399c5723d087dd92f534d Mon Sep 17 00:00:00 2001
From: David Rothstein <drothstein@gmail.com>
Date: Sun, 10 Mar 2013 15:50:59 -0400
Subject: [PATCH] Issue #1586542 followup by andypost: Workaround for an issue
 where system update #7061 fails due to a memory leak and can't be run again.

---
 modules/system/system.install | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/system/system.install b/modules/system/system.install
index 341a1f24afef..1b037b82bac6 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -2759,12 +2759,14 @@ function system_update_7061(&$sandbox) {
     // Retrieve a list of node revisions that have uploaded files attached.
     // DISTINCT queries are expensive, especially when paged, so we store the
     // data in its own table for the duration of the update.
-    $table = array(
-      'description' => t('Stores temporary data for system_update_7061.'),
-      'fields' => array('vid' => array('type' => 'int')),
-      'primary key' => array('vid'),
-    );
-    db_create_table('system_update_7061', $table);
+    if (!db_table_exists('system_update_7061')) {
+      $table = array(
+        'description' => t('Stores temporary data for system_update_7061.'),
+        'fields' => array('vid' => array('type' => 'int')),
+        'primary key' => array('vid'),
+      );
+      db_create_table('system_update_7061', $table);
+    }
     $query = db_select('upload', 'u');
     $query->distinct();
     $query->addField('u','vid');
-- 
GitLab