Either I'm missing something obvious, or I have a conflicting module somewhere. I see no place to specify which directory I want scanned, which I expect is the first thing we'd want to be able to do with this very promising module.

If I dpm the form in sourceForm() I see the directory form field, but it doesn't seem to appear.

I turned off Feeds Tamper, seeing that had caused problems for this module in the past.

Using 7.x-2.0-beta5+0-dev with Feeds 7.x-2.0-alpha8

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

darkodev’s picture

Status: Active » Closed (works as designed)

Sorry about that late night miss. You specify a directory on import, not when configuring the importer.

marktheshark’s picture

Will this work with periodic imports where the user will not be specifying a directory every time?

j2b’s picture

I still can not change File mask and save new settings due to the same error - Please specify an upload directory.

I've attached importer to node, created node, and then tried to change .txt to .ics. Receiving the same error and can not change this. Are we missing something in configuration?

Another question, may be directory is not correct. Using Private file download method, indicating ../private folder outside Drupal DocRoot. In Fetcher settings, putting in "private://", as thinking this is a root of private file system folder, where are .ics files located. Web server has access to these folders without problem.

Can you please provide info, to overcome this problem?

j2b’s picture

P.S. It turned out, that this node, to which fetcher is assigned, is not saved too. Kind of a magic circle happening:
1. creating form to specify directory (to let change File mask)
2. saving node (fetcher activated on node save)
3. getting an error, as there are no files found in indicated directory (due to fact, that should be looking for .ics files, but default configuration offer .txt files, which obviously are not there).

rudyard55’s picture

Issue summary: View changes

I'm confused... this issue is "closed as designed"? I can't change the file mask to xml, it defaults to txt. So it that by design?

Gregory Claeyssens’s picture

Same problem here.

Gregory Claeyssens’s picture

Seems like the problem is because the class "feeds_fetcher_directory_fetcher" extends the class "FeedsFileFetcher" from the feeds plugin.

FeedsFileFetcher class hass following function wich should be overwritten:

/**
   * Overrides parent::configFormValidate().
   *
   * Ensure that the chosen directory is accessible.
   */
  public function configFormValidate(&$values) {

    $values['directory'] = trim($values['directory']);
    $values['allowed_schemes'] = array_filter($values['allowed_schemes']);

    if (!$values['direct']) {
      // Ensure that the upload directory field is not empty when not in
      // direct-mode.
      if (!$values['directory']) {
        form_set_error('directory', t('Please specify an upload directory.'));
        // Do not continue validating the directory if none was specified.
        return;
      }

      // Validate the URI scheme of the upload directory.
      $scheme = file_uri_scheme($values['directory']);
      if (!$scheme || !in_array($scheme, $this->getSchemes())) {
        form_set_error('directory', t('Please enter a valid scheme into the directory location.'));

        // Return here so that attempts to create the directory below don't
        // throw warnings.
        return;
      }

      // Ensure that the upload directory exists.
      if (!file_prepare_directory($values['directory'], FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
        form_set_error('directory', t('The chosen directory does not exist and attempts to create it failed.'));
      }
    }
  }
Gregory Claeyssens’s picture

Add this function in the class feeds_fetcher_directory_fetcher (located in file: "feeds_fetcher_directory/feeds_fetcher_directory_fetcher.inc"

/**
   * Overrides parent::configFormValidate().
   *
   * Ensure that the chosen directory is accessible.
   */
  public function configFormValidate(&$values) {
  }

And all seems good, i'll test this further and post a patch if it work correctly

Gregory Claeyssens’s picture

Status: Closed (works as designed) » Needs review
FileSize
439 bytes

Here is the patch.

Frank Ralf’s picture

Version: 7.x-2.x-dev » 7.x-2.0-beta5
Component: User interface » Code
Category: Support request » Bug report
Status: Needs review » Reviewed & tested by the community

Applied the patch and it solves the problem of not being able to change the file mask.

Many thanks, Gregory!

BTW
You can embed screen-shots directly in your posts, and when you use tags for your code snippets they will show with syntax-highlighting ;-)

Feeds Directory Fetcher

Anonymous’s picture

Another RTBC for patch in #9, it worked nicely, please commit!

Niremizov’s picture

baaj’s picture

Confirming that the patch in #9 works well, thanks!

Steven Jones’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch!

Steven Jones’s picture

Status: Fixed » Closed (duplicate)

Oh, pants, this conflicts with #2023775: configFormValidate() errors going to rollback in favour of that one!