From dc5991ce9ccc238780dccf978d9143f3a7fea1b8 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Tue, 12 Oct 2010 03:03:41 +0000
Subject: [PATCH] - Patch #938560 by Damien Tournoud: fixed {system} records of
 installed modules are removed.

---
 modules/system/system.module | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/system/system.module b/modules/system/system.module
index 57c3c7240734..7466480c4315 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -2184,9 +2184,11 @@ function system_update_files_database(&$files, $type) {
   }
 
   if (count($delete) > 0) {
-    // Delete all missing files from the system table
+    // Delete all missing files from the system table, but only if the plugin
+    // has never been installed.
     db_delete('system')
       ->condition($delete)
+      ->condition('schema_version', -1)
       ->execute();
   }
 
-- 
GitLab