NC file deletion

From Newroco Tech Docs
Jump to navigationJump to search

If you have problem deleting a file/folder in nextcloud here is a list of things to try.

PHP memory limit

If in you have something like this in /var/log/apache2/error.log

PHP Fatal error:  Allowed memory size of 792723456 bytes exhausted (tried to allocate 72 bytes) in /var/www/nextcloud/lib/private/Files/Cache/Cache.php on line 620

you can change the value of memory_limit in /var/www/nextcloud/.htaccess

Install Redis for file locking

Instruction here: Redis

Manually delete locks from database

Put nextcloud in maintenance mode, by changing maintenance to true in /var/www/nextcloud/config/config.php

Connect to nextcloud database and run this:

DELETE FROM oc_file_locks WHERE lock=1;

Disable maintenance mode by changing maintenance back to false

Scan the nextcloud filesystem

Run this command in /var/www/nextcloud

sudo -u www-data php occ files:scan --all

You can also do this just for specific users, and do groupfolders via

sudo -u www-data php occ files:scan --path=/user/files/my_groupfolder_path

Disable file locking(untested)

Put this in /var/www/nextcloud/config/config.php

'filelocking.enabled' => false,