public function FeedsImportBatch::getFilePath in Feeds 6
Same name and namespace in other branches
- 7 includes/FeedsBatch.inc \FeedsImportBatch::getFilePath()
Return value
A path to a file containing the raw content as a source.
Throws
Exception If an unexpected problem occurred.
1 method overrides FeedsImportBatch::getFilePath()
- FeedsFileBatch::getFilePath in plugins/
FeedsFileFetcher.inc - Implementation of FeedsImportBatch::getFilePath().
File
- includes/
FeedsBatch.inc, line 193
Class
- FeedsImportBatch
- A FeedsImportBatch wraps the actual content retrieved from a FeedsSource. On import, it is created on the fetching stage and passed through the parsing and processing stage where it is normalized and consumed.
Code
public function getFilePath() {
if (!isset($this->file_path)) {
$dir = file_directory_path() . '/feeds';
if (!file_check_directory($dir, TRUE)) {
throw new Exception(t('Feeds directory either cannot be created or is not writable.'));
}
$dest = file_destination($dir . '/' . get_class($this) . '_' . drupal_get_token($this->url) . '_' . time(), FILE_EXISTS_RENAME);
$this->file_path = file_save_data($this
->getRaw(), $dest);
if ($this->file_path === 0) {
throw new Exception(t('Cannot write content to %dest', array(
'%dest' => $dest,
)));
}
}
return $this->file_path;
}