summaryrefslogtreecommitdiff
path: root/modules/system/system.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-08-22 13:52:59 +0000
committerDries Buytaert <dries@buytaert.net>2010-08-22 13:52:59 +0000
commit4a7bb638fb3243a35dd2ce82a4cafc78d2f6b9d2 (patch)
tree3e17684510b739dafb359a17a1d26027fe168ec6 /modules/system/system.module
parentb36d4959ef2244298fd28d02575c88b0259555b4 (diff)
downloadbrdo-4a7bb638fb3243a35dd2ce82a4cafc78d2f6b9d2.tar.gz
brdo-4a7bb638fb3243a35dd2ce82a4cafc78d2f6b9d2.tar.bz2
- 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.
Diffstat (limited to 'modules/system/system.module')
-rw-r--r--modules/system/system.module10
1 files changed, 8 insertions, 2 deletions
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);
}
}
}