Hi,

the FeedsHTTPBatch files are stored in /files/ instead of /files/feeds/, due to a small "bug" in FeedsBatch.inc:

      $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);

The problem is that file_check_directory trims all starting and trailing slashes "/".

The solution looks like this (see my comments):

      // morningtime: removed trailing /
      $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.'));
      }

      // morningtime: re-added trailing / 
      $dest = file_destination($dir . '/' . get_class($this) .'_'. drupal_get_token($this->url) .'_'. time(), FILE_EXISTS_RENAME); 

Now files are stored in /files/feeds/ again.

Patch attached for HEAD.

CommentFileSizeAuthor
feeds-batch-inc.patch1.16 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Besides the bug, I had two additional questions:

1. can we set a custom path with filefield_paths module? For example, feeds/2010/11/09/FeedBatch_2312321312_123123

2. I have a lot of feeds with settings "refresh=never, delete=never". Shouldn't we delete (cleanup) unused batch files, e.g. for those feeds with refresh=never?

Thanks

alex_b’s picture

Title: Tiny feeds dir problem in FeedsBatch.inc » Avoid trailing slashes when passing file paths to file_check_directory()

Thank you, running tests now.

1. Needs a separate issue. I could imagine adding a documented Drupal variable that is not surfaced on the UI.
2. #863494: Delete temporary enclosures file

alex_b’s picture

Sorry, 2. is actually a different issue. I can't see how we delete them as we always allow a repeated import... I am open for suggestions, if you would like to discuss this, please open a separate issue.

alex_b’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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