<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
*/
public static function getData($item)
{
+ if (!empty($item['data'])) {
+ return $item['data'];
+ }
+
$backendClass = DI::storageManager()->getByName($item['backend-class'] ?? '');
- if ($backendClass === null) {
+ if (empty($backendClass)) {
// legacy data storage in 'data' column
$i = self::selectFirst(['data'], ['id' => $item['id']]);
if ($i === false) {
foreach($items as $item) {
$backend_class = DI::storageManager()->getByName($item['backend-class'] ?? '');
- if ($backend_class !== null) {
+ if (!empty($backend_class)) {
$fields['backend-ref'] = $backend_class->put($img->asString(), $item['backend-ref'] ?? '');
} else {
$fields['data'] = $img->asString();
foreach($items as $item) {
$backend_class = DI::storageManager()->getByName($item['backend-class'] ?? '');
- if ($backend_class !== null) {
+ if (!empty($backend_class)) {
$backend_class->delete($item['backend-ref'] ?? '');
}
}