Prevent AssetPresent from throwing a FileNotFoundException

Permalink
A file has been deleted from the server and is causing a File not found Exception.

The exception is triggered within a assertPresent method. In the Filesystem class (League\Flysystem)

I'm struggling to see how the config 'disable_asserts' can be overridden, as the Exception is currently preventing the whole site from loading.
if ($this->config->get('disable_asserts', false) === false && ! $this->has($path)) {
            throw new FileNotFoundException($path);
        }


I've tried setting a disable_asserts parameter in the config file but unable to get anything to trigger.

(update:) I've just noticed this is loaded from the vendor folder now and not within the core files. So I guess that's part of the cause here

TheRealSean
 
Kaapiii replied on at Permalink Reply
I encountered the same problem but with concrete5 version 8.1.0. There is no config passed to the method getFileSystemObject() in Concrete\Core\Entity\File\StorageLocation\StorageLocation. So setting the disable_asserts value in the config wouldn't work, without hacking some classes.

As soon as you pass the config to the league\Filesystem and disabled the mentioned exception, another exception will be raised. In my case this one was thrown as next.

SplFileInfo::getType(): Lstat failed for /var/www/html/intranet/application/files/5014/9026/0155/bridge.jpg

So I ended up creating the missing folders and files by hand. (In total 4 folders and files were missing.)
TheRealSean replied on at Permalink Reply
TheRealSean
We've had to do the same, we just used some small flat coloured images to get them to show up then deleted them from the file manager.
Kaapiii replied on at Permalink Reply
Better solution: Just delete all entries in the table "FileImageThumbnailPaths" and the problem is gone.

Additional Information:
Because of the constraints you need to delete the entries also form the following tables.

1. atFile
2. FileVersions
3. Files
4. FileImageThumbnailPaths
TheRealSean replied on at Permalink Reply
TheRealSean
I'll give this a go, thanks for the tip