Hello. I am developing an app to nextcloud which is an integration to a Matrix.org chat server. I want to implement an external storage backend to access files in the chat server. I have tried to mimic the other backends, creating a file OCA\Files_External\Lib\Backend\MatrixOrg
inside the files_external/lib/Lib/Backend folder and other OCA\Files_External\Lib\Storage\MatrixOrg
inside the files_external/lib/Lib/Storage folder.
The file Backend\MatrixOrg:
`class MatrixOrg extends Backend {
use LegacyDependencyCheckPolyfill;
public function __construct(IL10N $l, Password $legacyAuth) {
$this
->setIdentifier('matrixorg')
->addIdentifierAlias('\OC\Files\Storage\MatrixOrg') // legacy compat
->setStorageClass('\OCA\Files_External\Lib\Storage\MatrixOrg')
->setText($l->t('Matrix.org server'))
->addParameters([
//(new DefinitionParameter('host', $l->t('Matrix.org server URL'))),
//(new DefinitionParameter('user', $l->t('Remote user'))),
//(new DefinitionParameter('password', $l->t('Remote password'))),
])
->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
->setLegacyAuthMechanism($legacyAuth)
;
}
}`
Storage\MatrixOrg is just Stub.
I have some questions about that.
-
I cannot select my new backend in the administration section of the plugin after creating these two files. The new backend is not visible. In the settings.php there is a variable $_[‘backends’] , but I didn’t find where it was set. How to make this backend visible?
-
Is this a best practice to create a external storage in an app? I intended to copy these files to my app directory as soon as the new external storage appeared.
Thank you.