You are here

public function MediaFeedsRemoteProvider::save in Media Feeds 7

Same name and namespace in other branches
  1. 7.2 includes/MediaFeedsRemoteProvider.inc \MediaFeedsRemoteProvider::save()

Save the file or return an existing one.

Overrides MediaFeedsProvider::save

File

includes/MediaFeedsRemoteProvider.inc, line 39
Map files using the remote_stream_wrapper module.

Class

MediaFeedsRemoteProvider
Class for mapping values using the remote_stream_wrapper_module.

Code

public function save() {

  // Make sure no file with tha URI exists.
  $existing = remote_stream_wrapper_file_load_by_uri($this->uri);
  if ($existing) {
    return $existing;
  }

  // Save the file.
  $file = $this
    ->getFileObject();
  file_save($file);
  return $file;
}