Best way to integrate own backend for external storage

Hi folk,
I’m new to this forum, so, hello to the nextcloud community.
I started developing an amazon cloud drive backend, to integrate an amazon drive into owncloud 9.

I created my own app and injected my backend into the files_external app, which worked well.
In the last weeks, I migrated to nextcloud 11. After this migration I wondered because there are multiple errors in the log.
The log says: “unable to get backend for /acd”, where “acd” is my mount to the Amazon Cloud Drive.
The cause for this is: the app files_external initialize all registered mounts (from config) while loading for the first time. But because my app loaded after the “files_external”, my backend is not registered yet.

All functions seems to be working fine, but there are multiple errors logged when a cron-job is running or on any access to the cloud.

So my question is: is it a good way to depend on the “files_external” app and injecting the backend, or is there a better way for this to make the backend more stable? I don’t want to hack directly into the files_external app, because then I will ran into trouble when an update is coming, also my app is not “shareable” anymore…

For storage backend developing there is no really good documentation (or I didn’t find it). The only what is existing is a discussion in a ticket for owncloud 8.x, which I used for my hack (but worked not fully for me, so I had to adopt it partly to new interfaces). See the discussion from icewind: https://github.com/owncloud/documentation/issues/1112

Can anyone help me with my issue?

1 Like

Maybe @icewind can help

Your app will need to be leaded after files_external, then you register you backend during the initialization of your app

See https://github.com/icewind1991/files_external_ftp/blob/master/lib/AppInfo/Application.php#L42 and the rest of the app for an example

Thank you for the example. I changed my implementation to exact the same way.
But I still get the following exception:
Error files_external Could not load storage: "Unable to get backend for acd"
This exception has its origin here:


If I understand this code correct, my app is not loaded. This method will be called, when files_external will be initialized.
The $backendIdentifier is loaded from the configuration from the database for the existing mount. While the init of files_external, all mounts are tried to restore. At this point the exception occurs, because the related backend for this mount is not loaded yet, so its not registered at files_external.
After the files_external has finished its init, the “files_external_acd” app will be initialized and register it in the app files_external.
So, all following actions related this mount are successfully. Only the exception while initializing the files_external app still exists (but seems to have no impact)…
So currently I’m confused how I can suppress this exception…

Hi @icewind
I installed your ftp-addon and configured it.
After a look in the log, I saw the same error-message, than for my app.
Every access to the nextcloud will be confirmed with multiple error-messages of type

ERROR - files_external  - Could not load storage: "unable to get backend for ftp_flysystem"

For me, it looks like, that there is currently no possibility to extend the files_external-app without having permanent error messages in the log.
Maybe, the files-external should be adopted, so that extensions are supported, like your own example implementation?! - Maybe a bug?

Have you shared this app somewhere?

Not yet. The app is in a alpha-state, which have several issues.
One thing is the “bug” above.
Other things are conflicting 3rd party libs.
I solved it for me by renaming the namespaces of the 3rd party libs and patched the files_external app.
So the app is currently working without big issues, but still in testing.

Because I have no time to support it, I don’t know, if I should share this app…