]> git.mxchange.org Git - friendica.git/commitdiff
Fix attach model
authornupplaPhil <admin@philipp.info>
Mon, 6 Jan 2020 22:58:41 +0000 (23:58 +0100)
committernupplaPhil <admin@philipp.info>
Fri, 10 Jan 2020 12:22:00 +0000 (13:22 +0100)
src/Model/Attach.php
src/Model/Photo.php

index 102e7b1a1d2f708575fc95af981b49c72c1848cd..7a0446176817a3e4113cf78bc334aa7afe04108a 100644 (file)
@@ -6,12 +6,10 @@
  */
 namespace Friendica\Model;
 
-use Friendica\Core\StorageManager;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
 use Friendica\DI;
-use Friendica\Model\Storage\IStorage;
 use Friendica\Object\Image;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Mimetype;
@@ -261,10 +259,9 @@ class Attach
                        $items = self::selectToArray(['backend-class','backend-ref'], $conditions);
 
                        foreach($items as $item) {
-                               /** @var IStorage $backend_class */
-                               $backend_class = (string)$item['backend-class'];
+                               $backend_class = DI::facStorage()->getByName($item['backend-class'] ?? '');
                                if ($backend_class !== '') {
-                                       $fields['backend-ref'] = $backend_class::put($img->asString(), $item['backend-ref']);
+                                       $fields['backend-ref'] = $backend_class->put($img->asString(), $item['backend-ref'] ?? '');
                                } else {
                                        $fields['data'] = $img->asString();
                                }
@@ -294,10 +291,9 @@ class Attach
                $items = self::selectToArray(['backend-class','backend-ref'], $conditions);
 
                foreach($items as $item) {
-                       /** @var IStorage $backend_class */
-                       $backend_class = (string)$item['backend-class'];
-                       if ($backend_class !== '') {
-                               $backend_class::delete($item['backend-ref']);
+                       $backend_class = DI::facStorage()->getByName($item['backend-class'] ?? '');
+                       if ($backend_class !== null) {
+                               $backend_class->delete($item['backend-ref'] ?? '');
                        }
                }
 
index 8df06565bc52b5baef652cbe7026205bb78596a5..b13aaa79aabe7b7c3b7fc01dd8097a89c85d1e5e 100644 (file)
@@ -10,12 +10,10 @@ use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\Logger;
-use Friendica\Core\StorageManager;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
 use Friendica\DI;
-use Friendica\Model\Storage\IStorage;
 use Friendica\Model\Storage\SystemResource;
 use Friendica\Object\Image;
 use Friendica\Util\DateTimeFormat;