Hi,
Want I would like to do is quite simple :
When an user try to access a file/folder that don’t exist , I want to catch that and send an e-mail.
I have managed to do that perfectly by adding some code in the app/files/lib/Controller/ViewController.php
public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false) {
if ($fileid !== null) {
try {
return $this->redirectToFile($fileid);
} catch (NotFoundException $e) {
// My custom code goes here
return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
}
}
But to do that I have to edit a controller from the app Files, what I want to do is to build an app to do that but I don’t know how catch the NotFoundException outside the ViewController.php
Thanks you !