public function FeedsFileFetcher::sourceSave in Feeds 7
Same name and namespace in other branches
- 7.2 plugins/FeedsFileFetcher.inc \FeedsFileFetcher::sourceSave()
Override parent::sourceSave().
Overrides FeedsPlugin::sourceSave
File
- plugins/
FeedsFileFetcher.inc, line 106 - Home of the FeedsFileFetcher and related classes.
Class
- FeedsFileFetcher
- Fetches data via HTTP.
Code
public function sourceSave(FeedsSource $source) {
$source_config = $source
->getConfigFor($this);
// If a new file is present, delete the old one and replace it with the new
// one.
if (isset($source_config['file'])) {
$file = $source_config['file'];
if (isset($source_config['fid'])) {
$this
->deleteFile($source_config['fid'], $source->feed_nid);
}
$file->status = FILE_STATUS_PERMANENT;
file_save($file);
file_usage_add($file, 'feeds', get_class($this), $source->feed_nid);
$source_config['fid'] = $file->fid;
unset($source_config['file']);
$source
->setConfigFor($this, $source_config);
}
}