4 * Description: Adds the possibility to use Amazon S3 as a selectable storage backend
6 * Author: Philipp Holzer
9 use Friendica\Addon\s3_storage\src\S3Client;
10 use Friendica\Addon\s3_storage\src\S3Config;
12 use Friendica\Core\Hook;
15 require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
17 function s3_storage_install()
19 Hook::register('storage_instance' , __FILE__, 's3_storage_instance');
20 Hook::register('storage_config' , __FILE__, 's3_storage_config');
21 DI::storageManager()->register(S3Client::class);
24 function s3_storage_uninstall()
26 DI::storageManager()->unregister(S3Client::class);
29 function s3_storage_instance(array &$data)
31 if ($data['name'] == S3Client::getName()) {
32 $config = new S3Config(DI::l10n(), DI::config());
33 $data['storage'] = new S3Client($config->getConfig(), $config->getBucket());
37 function s3_storage_config(array &$data)
39 if ($data['name'] == S3Client::getName()) {
40 $data['storage_config'] = new S3Config(DI::l10n(), DI::config());