While working on https://www.drupal.org/project/feeds/issues/3042774 , I observed that there is a piece of code in file : FeedsEnclosure.php at line : 125

else {
        // If file is not to be copied, check whether file already exists,
        // as file_save() won't do that for us (compare file_copy() and
        // file_save())
        $existing_files = file_load_multiple([], ['uri' => $file->getFileUri()]);
        if ($existing_files) {
          return reset($existing_files);
        }
        $file->save();
      }

According to which we are trying to get file ids using file URI , but if we see the file_load_multiple definition it says:

function file_load_multiple(array $fids = NULL, $reset = FALSE) {
  @trigger_error('file_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\file\Entity\File::loadMultiple(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
  if ($reset) {
    \Drupal::entityManager()->getStorage('file')->resetCache($fids);
  }
  return File::loadMultiple($fids);
}

So according to the code we only have two arguments accepted by file_load_multiple i.e $fid of type array and $reset of type boolean. But while calling we are sending second argument as array , which will throw a error and will not work.

Comments

yogen.prasad created an issue. See original summary.

yogen.prasad’s picture

StatusFileSize
new687 bytes
yogen.prasad’s picture

Status: Active » Needs review
megachriz’s picture

It seems that FeedsEnclosure isn't used anywhere in the Feeds code. Looks like dead code. Perhaps the class should be removed completely.

megachriz’s picture

Let's see what happens if I just remove the class.

  • MegaChriz committed c8bfec5 on 8.x-3.x
    Issue #3047843 by yogen.prasad, MegaChriz: Removed unused FeedsEnclosure...
megachriz’s picture

Status: Needs review » Fixed

No test failures. Okay, let's just remove the class and wait for any angry users. 😈

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.