diff --git a/core/includes/file.inc b/core/includes/file.inc index babf465..32c2820 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -1236,7 +1236,7 @@ function file_create_filename($basename, $directory) { * @see hook_file_predelete() * @see hook_file_delete() */ -function file_delete(stdClass $file, $force = FALSE) { +function file_delete(stdClass $file) { if (!file_valid_uri($file->uri)) { if (($realpath = drupal_realpath($file->uri)) !== FALSE) { watchdog('file', 'File %file (%realpath) could not be deleted because it is not a valid URI. This may be caused by improper use of file_delete() or a missing stream wrapper.', array('%file' => $file->uri, '%realpath' => $realpath)); @@ -1248,12 +1248,6 @@ function file_delete(stdClass $file, $force = FALSE) { return FALSE; } - // If any module still has a usage entry in the file_usage table, the file - // will not be deleted, but file_delete() will return a populated array - // that tests as TRUE. - if (!$force && ($references = file_usage_list($file))) { - return $references; - } // Let other modules clean up any references to the file prior to deletion. module_invoke_all('file_predelete', $file); diff --git a/core/modules/simpletest/tests/file.test b/core/modules/simpletest/tests/file.test index 7496902..61df16b 100644 --- a/core/modules/simpletest/tests/file.test +++ b/core/modules/simpletest/tests/file.test @@ -1564,9 +1564,7 @@ class FileDeleteTest extends FileHookTestCase { file_delete($file); $usage = file_usage_list($file); $this->assertEqual($usage['testing']['test'], array(1 => 1), t('Test file is still in use.')); - $this->assertTrue(file_exists($file->uri), t('File still exists on the disk.')); - $this->assertTrue(file_load($file->fid), t('File still exists in the database.')); - + // Clear out the call to hook_file_load(). file_test_reset();