mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-09 18:08:49 +00:00
Add S3 Storage Backend
This commit is contained in:
parent
95fcf98759
commit
9c4b12f868
63 changed files with 8108 additions and 0 deletions
42
s3_storage/s3_storage.php
Normal file
42
s3_storage/s3_storage.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/*
|
||||
* Name: S3 Storage
|
||||
* Description: Adds the possibility to use Amazon S3 as a selectable storage backend
|
||||
* Version: 1.0
|
||||
* Author: Philipp Holzer
|
||||
*/
|
||||
|
||||
use Friendica\Addon\s3_storage\src\S3Client;
|
||||
use Friendica\Addon\s3_storage\src\S3Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
|
||||
function s3_storage_install($a)
|
||||
{
|
||||
Hook::register('storage_instance' , __FILE__, 's3_storage_instance');
|
||||
Hook::register('storage_config' , __FILE__, 's3_storage_config');
|
||||
DI::storageManager()->register(S3Client::class);
|
||||
}
|
||||
|
||||
function s3_storage_uninstall()
|
||||
{
|
||||
DI::storageManager()->unregister(S3Client::class);
|
||||
}
|
||||
|
||||
function s3_storage_instance(App $a, array &$data)
|
||||
{
|
||||
if ($data['name'] == S3Client::getName()) {
|
||||
$config = new S3Config(DI::l10n(), DI::config());
|
||||
$data['storage'] = new S3Client($config->getConfig(), $config->getBucket());
|
||||
}
|
||||
}
|
||||
|
||||
function s3_storage_config(App $a, array &$data)
|
||||
{
|
||||
if ($data['name'] == S3Client::getName()) {
|
||||
$data['storage_config'] = new S3Config(DI::l10n(), DI::config());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue