0
Answered

trash and thumbnail_cache paths in Docker

rob.flate 3 weeks ago updated by Vlad R 2 weeks ago 10

How do I use the advanced settings `trash` and `thumbnail_cache` in Docker. Do I;

1. Create `customizables/config.php` inside the volume mapped to `/var/www/html` on my local file system.

2. Fill it with

```

<php

$config['path']['trash'] = '/path/with/write/permission/';

$config['path']['thumbnail_cache'] ='/path/with/write/permission/';

?>

```

If so, I assume the '/path/with/write/permission/' are the paths inside the container. How do I map those so they are persistent on my local file system?

Thanks

Answer

Answer

You have most probably hit a PHP limitation when it comes to moving folders between devices. Your trash folder and user's home folders are most probably not on the same device (same partition, same filesystem). PHP can move files in this case (by doing a copy+delete operation) but can't do the same for folders.

If you wish to keep this setup and not move the trash folder on the same filesystem, then you will need to use this in your config file:

$config['system']['fm']['use_safe_move'] = true;

This will make FileRun do copy+delete for any file/folder move operation. The downside to this is that it can be considerably slow for moving large amounts of data.

Answered

You do that the same way you do with the user files, by adding a volume to the Docker container, and use the container path, which gets mapped to a real path on your persistent file system.

You can also create some folders inside "/var/www/html/system/data/temp" and use those. "/var/www/html" being the path of the FileRun application files, which sit in a the persistent file system.

Thanks. Sorry I'm still confused. Are there already folders inside the container for trash and thumbnail_cache for me to map? If so what are the paths?


I understand that to map the user-files folder I just do;


- ~/docker/filerun/user-files:/user-files

So if there was a trash folder already in the container at /var/www/html/system/trash I would do;

- ~/docker/filerun/trash:/var/www/html/system/trash

combined with the following in config.php;

<php
$config['path']['trash'] = '/var/www/html/system/trash';
?>

If there are no trash or thumbnail_cache folders inside the container do I do something like;

- ~/docker/filerun/trash:/trash

combined with;

<php
$config['path']['trash'] = '/trash';
?>

Sorry, I'm sure this is simple but I just need a bit more help. Thanks

+1

Yes, just manually create the folder "~/docker/filerun/trash" and set

$config['path']['trash'] = '/var/www/html/system/trash';

That's it, you don't need anything else.

Thanks. That did the trick for the most part;


  • I set thumbnail_cache then ran make_thumbs.php and the thumbnails successfully go in the folder set in config.php.
  • I set trash then deleted a file and it successfully went into the folder set in config.php
  • However, when I delete a folder I get this error, 'Failed to move folder to trash'. The log shows, 'Error: Failed to move item to trash folder.' There's nothing in 'php_error_log.txt' that refers to this.

The owner/group of the folder is the same as those set with APACHE_RUN_USER etc. The permissions are 775. The same error happens whether I create the folder inside or outside FileRun. Any idea why I can delete a file but not a folder. Thanks.

Check the user activity log from the FileRun control panel, for any possible additional details related to the failed operation.

For a proper test, create a brand new file and a brand new folder with FileRun, and delete both, and let me know the result.

I created a folder called Test and a text file called Test.txt;

  • I successfully deleted Test.txt (although no mention of it in activity log). I can see it's been moved to my custom trash folder and emptying the trash deletes it from there.
  • I cannot delete the Test folder. I get the error, 'Failed to move item to trash folder'.

Activity Logs below

User
11/18/2020 07:41 PM
Failed to delete folder
HOME/Test
Full path: /user-files/Test
Error: Failed to move item to trash folder.

User
11/18/2020 07:41 PM
File uploaded
Test.txt
To: HOME
/user-files/Test.txt
File size: 4 Bytes
Method: Code Editor

User
11/18/2020 07:41 PM
File downloaded
Test.txt
From: HOME
Full path: /user-files/Test.txt
File size: Empty
Method: Code Editor

User
11/18/2020 07:41 PM
File uploaded
Test.txt
To: HOME
/user-files/Test.txt
File size: Empty
Method: Code Editor

User
11/18/2020 07:41 PM
New folder created
Test
Inside: HOME
Full path: /user-files/Test
Answer

You have most probably hit a PHP limitation when it comes to moving folders between devices. Your trash folder and user's home folders are most probably not on the same device (same partition, same filesystem). PHP can move files in this case (by doing a copy+delete operation) but can't do the same for folders.

If you wish to keep this setup and not move the trash folder on the same filesystem, then you will need to use this in your config file:

$config['system']['fm']['use_safe_move'] = true;

This will make FileRun do copy+delete for any file/folder move operation. The downside to this is that it can be considerably slow for moving large amounts of data.

Problem solved. Thank you for all your help. It's much appreciated.

Also, apologies. I should have noticed the advice to set use_safe_move in the docs.

P.S. Don't be sorry, this is a very tricky one, and I just added the note in the documentation ;)