]> git.mxchange.org Git - friendica-addons.git/commitdiff
Add name check for webdav configuration options
authorGidi Kroon <Gidi@gidikroon.eu>
Fri, 7 Jan 2022 01:14:24 +0000 (02:14 +0100)
committerGidi Kroon <Gidi@gidikroon.eu>
Fri, 7 Jan 2022 01:14:24 +0000 (02:14 +0100)
The webdav_storage addon should check whether it should provide its
config options and its instance based on the provided `$data['name']`.
Not doing this will override the configuration and instance of another
storage add-on.

webdav_storage/webdav_storage.php

index 7686ca9f960c3aedc860f54e7f7c1267196fbff5..a93caeffe17a23e5e77c57219be4b28618786944 100644 (file)
@@ -26,11 +26,15 @@ function webdav_storage_uninstall()
 
 function webdav_storage_instance(App $a, array &$data)
 {
-       $config          = new WebDavConfig(DI::l10n(), DI::config(), DI::httpClient());
-       $data['storage'] = new WebDav($config->getUrl(), $config->getAuthOptions(), DI::httpClient(), DI::logger());
+       if ($data['name'] == WebDav::getName()) {
+               $config          = new WebDavConfig(DI::l10n(), DI::config(), DI::httpClient());
+               $data['storage'] = new WebDav($config->getUrl(), $config->getAuthOptions(), DI::httpClient(), DI::logger());
+       }
 }
 
 function webdav_storage_config(App $a, array &$data)
 {
-       $data['storage_config'] = new WebDavConfig(DI::l10n(), DI::config(), DI::httpClient());
+       if ($data['name'] == WebDav::getName()) {
+               $data['storage_config'] = new WebDavConfig(DI::l10n(), DI::config(), DI::httpClient());
+       }
 }