diff --git a/core/includes/file.inc b/core/includes/file.inc index ed4bdce..2e1675c 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -582,6 +582,8 @@ function file_save_htaccess($directory, $private = TRUE) { * * @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. @@ -591,8 +593,8 @@ function file_save_htaccess($directory, $private = TRUE) { * @see entity_load() * @see Drupal\entity\EntityFieldQuery */ -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); } /** @@ -600,6 +602,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\Core\File\File * A file entity or FALSE if the file was not found. @@ -607,8 +611,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/system/lib/Drupal/system/Tests/File/DeleteTest.php b/core/modules/system/lib/Drupal/system/Tests/File/DeleteTest.php index 2691806..d2c4167 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/DeleteTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/DeleteTest.php @@ -71,7 +71,7 @@ class DeleteTest extends FileHookTestBase { 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/system/lib/Drupal/system/Tests/File/LoadTest.php b/core/modules/system/lib/Drupal/system/Tests/File/LoadTest.php index 62033a9..29eb49c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/LoadTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/LoadTest.php @@ -82,7 +82,7 @@ class LoadTest extends FileHookTestBase { // 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/system/system.module b/core/modules/system/system.module index de7241f..3b532f4 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -284,7 +284,6 @@ function system_entity_info() { 'label' => 'filename', 'uuid' => 'uuid', ), - 'static cache' => FALSE, ), ); } diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php index a1ad3a6..0a0c4e3 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php @@ -290,7 +290,7 @@ class UserPictureTest extends WebTestBase { $account1 = user_load($this->user->uid, TRUE); $this->assertFalse($account1->picture, 'User object has no picture'); - $file = file_load($account->picture->fid); + $file = file_load($account->picture->fid, TRUE); $this->assertFalse($file, 'File is removed from database'); // Clear out PHP's file stat cache so we see the current value.