diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-03-21 20:28:28 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-03-21 20:28:28 +0000 |
commit | e1799e761b909775da0141e70e06e351d31bf362 (patch) | |
tree | 0db0538bcffcb6cad32f2cac97f31c3fe27093b7 /modules/system/system.api.php | |
parent | f505b6a97800a52f6bfc39ddccbb06077291fefe (diff) | |
download | brdo-e1799e761b909775da0141e70e06e351d31bf362.tar.gz brdo-e1799e761b909775da0141e70e06e351d31bf362.tar.bz2 |
- Patch #747464 by andypost: wrong usage of hook_file_references().
Diffstat (limited to 'modules/system/system.api.php')
-rw-r--r-- | modules/system/system.api.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php index 936ca9079..bd42f2292 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -1724,11 +1724,11 @@ function hook_file_move($file, $source) { * @see upload_file_references() */ function hook_file_references($file) { - // If upload.module is still using a file, do not let other modules delete it. - $file_used = (bool) db_query_range('SELECT 1 FROM {upload} WHERE fid = :fid', 0, 1, array(':fid' => $file->fid))->fetchField(); - if ($file_used) { + // If user.module is still using a file, do not let other modules delete it. + $count = (int) db_query('SELECT COUNT(picture) FROM {users} WHERE picture = :fid', array(':fid' => $file->fid))->fetchField(); + if ($count) { // Return the name of the module and how many references it has to the file. - return array('upload' => $count); + return array('user' => $count); } } |