mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-11 09:34:26 +02:00
Make Storage testable & add tests
- Making StorageManager dynamic (DI::facStorage()) - Making concrete Storage dynamic (DI::storage()) - Add tests for Storage backend and failure handling - Bumping Level-2/Dice to "dev-master" until new release - Using Storage-Names instead of Storage-Classes in config (includes migration)
This commit is contained in:
parent
a5895f8623
commit
08edeae2f9
18 changed files with 744 additions and 242 deletions
|
@ -273,18 +273,17 @@ class Photo
|
|||
$data = "";
|
||||
$backend_ref = "";
|
||||
|
||||
/** @var IStorage $backend_class */
|
||||
if (DBA::isResult($existing_photo)) {
|
||||
$backend_ref = (string)$existing_photo["backend-ref"];
|
||||
$backend_class = (string)$existing_photo["backend-class"];
|
||||
$storage = DI::facStorage()->getByName((string)$existing_photo["backend-class"]);
|
||||
} else {
|
||||
$backend_class = StorageManager::getBackend();
|
||||
$storage = DI::storage();
|
||||
}
|
||||
|
||||
if ($backend_class === "") {
|
||||
if ($storage === null) {
|
||||
$data = $Image->asString();
|
||||
} else {
|
||||
$backend_ref = $backend_class::put($Image->asString(), $backend_ref);
|
||||
$backend_ref = $storage->put($Image->asString(), $backend_ref);
|
||||
}
|
||||
|
||||
|
||||
|
@ -309,7 +308,7 @@ class Photo
|
|||
"deny_cid" => $deny_cid,
|
||||
"deny_gid" => $deny_gid,
|
||||
"desc" => $desc,
|
||||
"backend-class" => $backend_class,
|
||||
"backend-class" => (string)$storage,
|
||||
"backend-ref" => $backend_ref
|
||||
];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue