Batch operations doesn't create the export file on file system

Created on 7 February 2020, over 4 years ago
Updated 15 May 2024, about 1 month ago

I'm using latest 8.x-1.0-beta4 to export 2000~ users using a batch export of 10 items and I face the same issue explained here .

The export creates a new directory inside sites/default/files/views_data_export/users_csv_data_export_1 but this directory remains empty. The CSV file is nowhere. I have also temporally set 777 permissions and the problem persists.

If I go back to Standard export method the export works fine. However, with this method I can only export 1500 users before it reaches PHP timelimit. This is the reason we need batch export.

Doesn't matter if the private file directory is set or not. The problem persists. Maybe a warning message should be shown when the private file directory is not set.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇪🇸Spain scanasgarzo

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India anil280988

    I faced the similar issue,and even log shows that file can't be copied from tmp folder to public/private folder. But looking at the code I found that it's the generic error message that is shown when file can't be created. In my case the issue was the file name format, I was adding timestamp token at the end and it has spaces. Removing that I was able to create the file.

  • 🇬🇧United Kingdom kewesley

    We had a similar issue to #5 where a non-admin user could not download an export in the private files directory, which we fixed by implementing a separate hook in one of our custom modules. I wonder if the regex is overcomplicating things? We are using $file->getOwnerId() to determine who created the export.

    use Drupal\Core\Access\AccessResult;
    use Drupal\Core\Session\AccountInterface;
    use Drupal\file\FileInterface;
    
    function MYMODULE_file_access(FileInterface $file, $operation, AccountInterface $account) {
      // Allow access to temporary private file exports.
      if ($operation === 'download' && $file->isTemporary() && str_contains($file->getFileUri(), '://views_data_export/')) {
        if ($file->getOwnerId() === $account->id()) {
          return AccessResult::allowed();
        }
      }
      return AccessResult::neutral();
    }
  • 🇺🇦Ukraine VasyOK

    Hello guess.
    How can you think its really possible to place exported file in file system?

    I choose filename

    Change export method to Batch

    But nothing happen. This Initializing line doesn't grow.

Production build 0.69.0 2024