From ea0e005bea120de78cf67ae28df1d178915df3e2 Mon Sep 17 00:00:00 2001 From: Alex Barth <alex_b@53995.no-reply.drupal.org> Date: Wed, 28 Apr 2010 21:10:49 +0000 Subject: [PATCH] #725392 nicholasThompson: FeedsBatch does not check feeds folder exists before uploading. --- CHANGELOG.txt | 2 ++ includes/FeedsBatch.inc | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ced6d5ea..f21fcbab 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,8 @@ Feeds 6.x 1.0 xxxxxxxxxxxxxxxxxxxx ---------------------------------- +- #725392 nicholasThompson: FeedsBatch does not check feeds folder exists before + uploading. - #776972 lyricnz: Messages use plural when describing single item. - #701390 frega, morningtime, Mixologic, alex_b et. al.: Fix RSS 1.0 parsing and add basic test framework for common_syndication_parser. diff --git a/includes/FeedsBatch.inc b/includes/FeedsBatch.inc index b27b648e..4860f89f 100644 --- a/includes/FeedsBatch.inc +++ b/includes/FeedsBatch.inc @@ -89,7 +89,11 @@ class FeedsImportBatch extends FeedsBatch { */ public function getFilePath() { if (!isset($this->file_path)) { - $dest = file_destination(file_directory_path() .'/feeds/'. get_class($this) .'_'. md5($this->url) .'_'. time(), FILE_EXISTS_RENAME); + $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) .'_'. md5($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))); -- GitLab