diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 913f75a3bfcb4d4dee021cb6b95045b0ab276c25..75c4f84df78527197ecdc1b83716671c54e93809 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -104,6 +104,8 @@ function file_entity_view_mode_info() { * * @param array $fids * (optional) An array of entity IDs. If omitted, all entities are loaded. + * @param $reset + * Whether to reset the internal file_load_multiple() cache. * * @return array * An array of file entities, indexed by fid. @@ -113,8 +115,8 @@ function file_entity_view_mode_info() { * @see entity_load() * @see Drupal\Core\Entity\Query\EntityQueryInterface */ -function file_load_multiple(array $fids = NULL) { - return entity_load_multiple('file', $fids); +function file_load_multiple(array $fids = NULL, $reset = FALSE) { + return entity_load_multiple('file', $fids, $reset); } /** @@ -122,6 +124,8 @@ function file_load_multiple(array $fids = NULL) { * * @param $fid * A file ID. + * @param $reset + * Whether to reset the internal file_load_multiple() cache. * * @return Drupal\file\File * A file entity or FALSE if the file was not found. @@ -129,8 +133,8 @@ function file_load_multiple(array $fids = NULL) { * @see hook_file_load() * @see file_load_multiple() */ -function file_load($fid) { - $files = file_load_multiple(array($fid)); +function file_load($fid, $reset = FALSE) { + $files = file_load_multiple(array($fid), $reset); return reset($files); } diff --git a/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php b/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php index d7f2a6ba418abfae9d146aa095140c6dddcc32e6..e811c58778cfff0d2b0173ed136bac793ea22d72 100644 --- a/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php +++ b/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php @@ -21,7 +21,6 @@ * module = "file", * controller_class = "Drupal\file\FileStorageController", * base_table = "file_managed", - * static_cache = FALSE, * entity_keys = { * "id" = "fid", * "label" = "filename", diff --git a/core/modules/file/lib/Drupal/file/Tests/DeleteTest.php b/core/modules/file/lib/Drupal/file/Tests/DeleteTest.php index 6adafdb48823e2a94db6902cf873d7987d6cd90e..ca2f712e79a531b862c390ba02e137a12e156520 100644 --- a/core/modules/file/lib/Drupal/file/Tests/DeleteTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/DeleteTest.php @@ -71,7 +71,7 @@ function testInUse() { drupal_cron_run(); // system_cron() loads - $this->assertFileHooksCalled(array('load', 'delete')); + $this->assertFileHooksCalled(array('delete')); $this->assertFalse(file_exists($file->uri), t('File has been deleted after its last usage was removed.')); $this->assertFalse(file_load($file->fid), t('File was removed from the database.')); } diff --git a/core/modules/file/lib/Drupal/file/Tests/LoadTest.php b/core/modules/file/lib/Drupal/file/Tests/LoadTest.php index 833c26074b25b64ab76d65d4dc5034a13f4fd505..aaaec27ba33908b1763ea79b79452a8aa4a70c12 100644 --- a/core/modules/file/lib/Drupal/file/Tests/LoadTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/LoadTest.php @@ -82,7 +82,7 @@ function testMultiple() { // Load by fid. file_test_reset(); $by_fid_files = file_load_multiple(array($file->fid)); - $this->assertFileHookCalled('load'); + $this->assertFileHooksCalled(array()); $this->assertEqual(1, count($by_fid_files), t('file_load_multiple() returned an array of the correct size.')); $by_fid_file = reset($by_fid_files); $this->assertTrue($by_fid_file->file_test['loaded'], t('file_test_file_load() was able to modify the file during load.')); diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php index 8447031753b20d19a18d5f0bbf852ddc31e0adb3..77646992f0b0fe1ef968c571fe5223774dad68a6 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php @@ -78,7 +78,7 @@ function testCreateDeletePicture() { drupal_cron_run(); // Verify that the image has been deleted. - $this->assertFalse(file_load($file->fid), 'File was removed from the database.'); + $this->assertFalse(file_load($file->fid, TRUE), 'File was removed from the database.'); // Clear out PHP's file stat cache so we see the current value. clearstatcache(TRUE, $file->uri); $this->assertFalse(is_file($file->uri), 'File was removed from the file system.'); @@ -122,6 +122,6 @@ function saveUserPicture($image) { // Load actual user data from database. $account = user_load($this->web_user->uid, TRUE); - return file_load($account->user_picture[LANGUAGE_NOT_SPECIFIED][0]['fid']); + return file_load($account->user_picture[LANGUAGE_NOT_SPECIFIED][0]['fid'], TRUE); } }