From 4a7bb638fb3243a35dd2ce82a4cafc78d2f6b9d2 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 22 Aug 2010 13:52:59 +0000 Subject: - Patch #353458 by quicksketch, drewish, jpetso, sun, noahb, aaron, chx, mikey_p, dhthwy: hook_file_references() was not designed for a highly flexible field storage. --- modules/system/system.module | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'modules/system/system.module') diff --git a/modules/system/system.module b/modules/system/system.module index 85175c9f0..be167a888 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -2819,8 +2819,14 @@ function system_cron() { )); foreach ($result as $row) { if ($file = file_load($row->fid)) { - if (!file_delete($file)) { - watchdog('file system', 'Could not delete temporary file "%path" during garbage collection', array('%path' => $file->uri), WATCHDOG_ERROR); + $references = file_usage_list($file); + if (empty($references)) { + if (!file_delete($file)) { + watchdog('file system', 'Could not delete temporary file "%path" during garbage collection', array('%path' => $file->uri), WATCHDOG_ERROR); + } + } + else { + watchdog('file system', 'Did not delete temporary file "%path" during garbage collection, because it is in use by the following modules: %modules.', array('%path' => $file->uri, '%modules' => implode(', ', array_keys($references))), WATCHDOG_INFO); } } } -- cgit v1.2.3