Fix attach model
This commit is contained in:
parent
c2ac206379
commit
1b2ff54f66
2 changed files with 5 additions and 11 deletions
|
@ -6,12 +6,10 @@
|
||||||
*/
|
*/
|
||||||
namespace Friendica\Model;
|
namespace Friendica\Model;
|
||||||
|
|
||||||
use Friendica\Core\StorageManager;
|
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Database\DBStructure;
|
use Friendica\Database\DBStructure;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Storage\IStorage;
|
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Mimetype;
|
use Friendica\Util\Mimetype;
|
||||||
|
@ -261,10 +259,9 @@ class Attach
|
||||||
$items = self::selectToArray(['backend-class','backend-ref'], $conditions);
|
$items = self::selectToArray(['backend-class','backend-ref'], $conditions);
|
||||||
|
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
/** @var IStorage $backend_class */
|
$backend_class = DI::facStorage()->getByName($item['backend-class'] ?? '');
|
||||||
$backend_class = (string)$item['backend-class'];
|
|
||||||
if ($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 {
|
} else {
|
||||||
$fields['data'] = $img->asString();
|
$fields['data'] = $img->asString();
|
||||||
}
|
}
|
||||||
|
@ -294,10 +291,9 @@ class Attach
|
||||||
$items = self::selectToArray(['backend-class','backend-ref'], $conditions);
|
$items = self::selectToArray(['backend-class','backend-ref'], $conditions);
|
||||||
|
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
/** @var IStorage $backend_class */
|
$backend_class = DI::facStorage()->getByName($item['backend-class'] ?? '');
|
||||||
$backend_class = (string)$item['backend-class'];
|
if ($backend_class !== null) {
|
||||||
if ($backend_class !== '') {
|
$backend_class->delete($item['backend-ref'] ?? '');
|
||||||
$backend_class::delete($item['backend-ref']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,10 @@ use Friendica\Core\Cache;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\StorageManager;
|
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Database\DBStructure;
|
use Friendica\Database\DBStructure;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Storage\IStorage;
|
|
||||||
use Friendica\Model\Storage\SystemResource;
|
use Friendica\Model\Storage\SystemResource;
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
|
Loading…
Reference in a new issue