Backup of import fails

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
TobiasMadsen
Posts: 14
Joined: 04 Dec 2020, 09:57

Backup of import fails

Post by TobiasMadsen » 18 Dec 2020, 10:07

Hi Aimeos :)

I'm importing categories (and after that, products - question is the same), but get the following fail:

Code: Select all

Aimeos\Controller\Jobs\Exception 

  Unable to move imported file "imports/categories/toimport/" to "imports/categories/imported/imported_18-12-20.csv"

  at C:\laravel_webshop\ext\ai-controller-jobs\controller\jobs\src\Controller\Jobs\Catalog\Import\Csv\Standard.php:378
    374▕
    375▕                if( !empty( $backup ) && @rename( $path, strftime( $backup ) ) === false )
    376▕                {
    377▕                        $msg = sprintf( 'Unable to move imported file "%1$s" to "%2$s"', $path, strftime( $backup ) );
  ➜ 378▕                        throw new \Aimeos\Controller\Jobs\Exception( $msg );
    379▕                }
    380▕        }
    381▕
    382▕

  1   C:\laravel_webshop\vendor\aimeos\aimeos-laravel\src\Aimeos\Shop\Command\JobsCommand.php:76
      Aimeos\Controller\Jobs\Catalog\Import\Csv\Standard::run()

  2   C:\laravel_webshop\vendor\aimeos\aimeos-core\lib\mwlib\src\MW\Process\Decorator\Check.php:63
      Aimeos\Shop\Command\JobsCommand::Aimeos\Shop\Command\{closure}(Object(Aimeos\MShop\Context\Item\Standard), Object(Aimeos\Bootstrap), "catalog/import/csv")
The category gets imported as it should but the backup fails. My shop.php is like this:

Code: Select all

'catalog' => [
                'import' => [
                    'csv' => [
                        'location' => 'imports/categories/toimport/',
                        'backup' => 'imports/categories/imported/imported_%d-%m-%y.csv',
                        'skip-lines' => 1,
                    ],
                ],
            ],
It is probably something stupid, but i just can't get it right!

For your reference; Folder structure is like picture attached. The "imported" folder is empty
Attachments
folder backuo.png
folder backuo.png (2.1 KiB) Viewed 815 times

User avatar
aimeos
Administrator
Posts: 7917
Joined: 01 Jan 1970, 00:00

Re: Backup of import fails

Post by aimeos » 20 Dec 2020, 13:00

Most likely, it's a permission problem. Your cronjob is executed as another user than your web server, so check the permissions of the backup directory.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
TobiasMadsen
Posts: 14
Joined: 04 Dec 2020, 09:57

Re: Backup of import fails

Post by TobiasMadsen » 20 Dec 2020, 15:47

As of now i am running the command directly from terminal.

I have tried both locally on my Win10 environment and on the Debian server (with www-data as owner of folders). On the server it works, so thats fine.

Thank you for your response :)

Post Reply