]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Attach.php
Fix: The "extid" field wasn't updated
[friendica.git] / src / Model / Attach.php
index b81c38762eb556c75b3bb119d5f0a12406431e29..6182727c9762ad85d63c6365941bc8636129c5aa 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -159,8 +159,12 @@ class Attach
         */
        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) {
@@ -275,7 +279,7 @@ class Attach
 
                        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();
@@ -307,7 +311,7 @@ class Attach
 
                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'] ?? '');
                        }
                }