diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-09-28 02:34:42 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-09-28 02:34:42 +0000 |
commit | 7874654909fcbe0c3dad8f5533a2db19b8dd1c94 (patch) | |
tree | 1a4f9fa008ffd07acb6c3d96410f6d949dd619df /includes | |
parent | 45bca33bc2dd42e6a5a30956f6577e8df25c72c4 (diff) | |
download | brdo-7874654909fcbe0c3dad8f5533a2db19b8dd1c94.tar.gz brdo-7874654909fcbe0c3dad8f5533a2db19b8dd1c94.tar.bz2 |
- Patch #924554 by quicksketch, paul.lovvik: an exception is being thrown in the file_usage_delete() function if the corresponding file is not in the 'file_usage()' table.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/file.inc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/includes/file.inc b/includes/file.inc index 1d4343da0..769493a61 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -661,7 +661,7 @@ function file_usage_delete(stdClass $file, $module, $type = NULL, $id = NULL, $c $result = $query->execute(); // If the row has more than the specified count decrement it by that number. - if (!$result) { + if (!$result && $count > 0) { $query = db_update('file_usage') ->condition('module', $module) ->condition('fid', $file->fid); @@ -670,9 +670,7 @@ function file_usage_delete(stdClass $file, $module, $type = NULL, $id = NULL, $c ->condition('type', $type) ->condition('id', $id); } - if ($count) { - $query->expression('count', 'count - :count', array(':count' => $count)); - } + $query->expression('count', 'count - :count', array(':count' => $count)); $query->execute(); } } |