]> git.mxchange.org Git - friendica-addons.git/blob - webdav_storage/webdav_storage.php
Dateien nach "invidious/templates" hochladen
[friendica-addons.git] / webdav_storage / webdav_storage.php
1 <?php
2 /*
3  * Name: WebDAV Storage
4  * Description: Adds the possibility to use WebDAV as a selectable storage backend
5  * Version: 1.0
6  * Author: Philipp Holzer
7  */
8
9 use Friendica\Addon\webdav_storage\src\WebDav;
10 use Friendica\Addon\webdav_storage\src\WebDavConfig;
11 use Friendica\App;
12 use Friendica\Core\Hook;
13 use Friendica\DI;
14
15 function webdav_storage_install($a)
16 {
17         Hook::register('storage_instance' , __FILE__, 'webdav_storage_instance');
18         Hook::register('storage_config' , __FILE__, 'webdav_storage_config');
19         DI::storageManager()->register(WebDav::class);
20 }
21
22 function webdav_storage_uninstall()
23 {
24         DI::storageManager()->unregister(WebDav::class);
25 }
26
27 function webdav_storage_instance(array &$data)
28 {
29         if ($data['name'] == WebDav::getName()) {
30                 $config          = new WebDavConfig(DI::l10n(), DI::config(), DI::httpClient());
31                 $data['storage'] = new WebDav($config->getUrl(), $config->getAuthOptions(), DI::httpClient(), DI::logger());
32         }
33 }
34
35 function webdav_storage_config(array &$data)
36 {
37         if ($data['name'] == WebDav::getName()) {
38                 $data['storage_config'] = new WebDavConfig(DI::l10n(), DI::config(), DI::httpClient());
39         }
40 }