nextcloud / maps

🌍🌏🌎 The whole world fits inside your cloud!
https://apps.nextcloud.com/apps/maps
GNU Affero General Public License v3.0
499 stars 88 forks source link

Scan-photo script aborts after access rights of external storage folder changed #468

Open beccon4 opened 3 years ago

beccon4 commented 3 years ago

I have my images in an external folder mounted using SMB. There is another mounted folder with all my other user data - and some jpeg images too. Both are physically located on a Synology NAS. I've withdrawn access to the #recycle - trash bin.

When I do a scan with php occ maps:scan-photos -vvvv beccon - the procedure crashes:

www-data@nextcloud-virt:~/nextcloud$ php occ maps:scan-photos -vvvv beccon                                      
======== User beccon ========                                                                                       

In FailedStorage.php line 210:                                                                                    

  [OCP\Files\StorageNotAvailableException (1)]                                                                            
  Storage with mount id 14 is not available                                                                                     

Exception trace:                                                                                                            
  at /var/www/nextcloud/lib/private/Files/Storage/FailedStorage.php:210                                      
 OC\Files\Storage\FailedStorage->getAvailability() at /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php:527
 OC\Files\Storage\Wrapper\Wrapper->getAvailability() at /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php:81           
 OC\Files\Storage\Wrapper\Availability->isAvailable() at /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php:92
 OC\Files\Storage\Wrapper\Availability->checkAvailability() at /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php:382
 OC\Files\Storage\Wrapper\Availability->hasUpdated() at /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php:379 
 OC\Files\Storage\Wrapper\Wrapper->hasUpdated() at /var/www/nextcloud/lib/private/Files/Cache/Watcher.php:127               
 OC\Files\Cache\Watcher->needsUpdate() at /var/www/nextcloud/lib/private/Files/View.php:1342                 
 OC\Files\View->getCacheEntry() at /var/www/nextcloud/lib/private/Files/View.php:1445                                                      
 OC\Files\View->getDirectoryContent() at /var/www/nextcloud/lib/private/Files/Node/Folder.php:100                     
 OC\Files\Node\Folder->getDirectoryListing() at /var/www/nextcloud/apps/maps/lib/Service/PhotofilesService.php:322  
 OCA\Maps\Service\PhotofilesService->gatherPhotoFiles() at /var/www/nextcloud/apps/maps/lib/Service/PhotofilesService.php:332
 OCA\Maps\Service\PhotofilesService->gatherPhotoFiles() at /var/www/nextcloud/apps/maps/lib/Service/PhotofilesService.php:67
 OCA\Maps\Service\PhotofilesService->rescan() at /var/www/nextcloud/apps/maps/lib/Command/RescanPhotos.php:80
 OCA\Maps\Command\RescanPhotos->rescanUserPhotos() at /var/www/nextcloud/apps/maps/lib/Command/RescanPhotos.php:71
 OCA\Maps\Command\RescanPhotos->execute() at /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:915
 Symfony\Component\Console\Application->doRunCommand() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:272
 Symfony\Component\Console\Application->doRun() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /var/www/nextcloud/lib/private/Console/Application.php:214
 OC\Console\Application->run() at /var/www/nextcloud/console.php:99
 require_once() at /var/www/nextcloud/occ:11    

In ConfigAdapter.php line 150:

  [OCP\Files\StorageNotAvailableException (1)]                                            
  Storage with mount id 14 is not available                                            

Exception trace:                                                                                 
  at /var/www/nextcloud/apps/files_external/lib/Config/ConfigAdapter.php:150
 OCA\Files_External\Config\ConfigAdapter->OCA\Files_External\Config\{closure}() at n/a:n/a
 array_map() at /var/www/nextcloud/apps/files_external/lib/Config/ConfigAdapter.php:145        
 OCA\Files_External\Config\ConfigAdapter->getMountsForUser() at /var/www/nextcloud/lib/private/Files/Config/MountProviderCollection.php:104
 OC\Files\Config\MountProviderCollection->addMountForUser() at /var/www/nextcloud/lib/private/Files/Filesystem.php:448
 OC\Files\Filesystem::initMountPoints() at /var/www/nextcloud/lib/private/Files/Node/Root.php:378                 
 OC\Files\Node\Root->getUserFolder() at n/a:n/a
 call_user_func_array() at /var/www/nextcloud/lib/private/Files/Node/LazyRoot.php:65
 OC\Files\Node\LazyRoot->__call() at /var/www/nextcloud/lib/private/Files/Node/LazyRoot.php:282
 OC\Files\Node\LazyRoot->getUserFolder() at /var/www/nextcloud/apps/maps/lib/Service/PhotofilesService.php:66
 OCA\Maps\Service\PhotofilesService->rescan() at /var/www/nextcloud/apps/maps/lib/Command/RescanPhotos.php:80
 OCA\Maps\Command\RescanPhotos->rescanUserPhotos() at /var/www/nextcloud/apps/maps/lib/Command/RescanPhotos.php:71
 OCA\Maps\Command\RescanPhotos->execute() at /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:915
 Symfony\Component\Console\Application->doRunCommand() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:272
 Symfony\Component\Console\Application->doRun() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /var/www/nextcloud/lib/private/Console/Application.php:214
 OC\Console\Application->run() at /var/www/nextcloud/console.php:99
 require_once() at /var/www/nextcloud/occ:11

maps:scan-photos [<user_id>]

I suspect it is caused by the change of access rights in the NAS. Nevertheless a external storage can be unavailable from time to time. It should not be cause the script to abort but issue a warning and continue scanning.

tacruc commented 3 years ago

This script should be executed just once, after the installation, or if you messed up your database. Run it is all stoarges are online.