Merge pull request #8091 from nupplaphil/bug/7998_photo_missing_get
Fix missing storage class
This commit is contained in:
commit
0fded51bb9
|
@ -144,7 +144,8 @@ class Attach
|
||||||
*/
|
*/
|
||||||
public static function getData($item)
|
public static function getData($item)
|
||||||
{
|
{
|
||||||
if ($item['backend-class'] == '') {
|
$backendClass = DI::storageManager()->getByName($photo['backend-class'] ?? '');
|
||||||
|
if ($backendClass === null) {
|
||||||
// legacy data storage in 'data' column
|
// legacy data storage in 'data' column
|
||||||
$i = self::selectFirst(['data'], ['id' => $item['id']]);
|
$i = self::selectFirst(['data'], ['id' => $item['id']]);
|
||||||
if ($i === false) {
|
if ($i === false) {
|
||||||
|
@ -152,9 +153,8 @@ class Attach
|
||||||
}
|
}
|
||||||
return $i['data'];
|
return $i['data'];
|
||||||
} else {
|
} else {
|
||||||
$backendClass = $item['backend-class'];
|
|
||||||
$backendRef = $item['backend-ref'];
|
$backendRef = $item['backend-ref'];
|
||||||
return $backendClass::get($backendRef);
|
return $backendClass->get($backendRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ class Attach
|
||||||
|
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
$backend_class = DI::storageManager()->getByName($item['backend-class'] ?? '');
|
$backend_class = DI::storageManager()->getByName($item['backend-class'] ?? '');
|
||||||
if ($backend_class !== '') {
|
if ($backend_class !== null) {
|
||||||
$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();
|
||||||
|
|
|
@ -171,7 +171,8 @@ class Photo
|
||||||
*/
|
*/
|
||||||
public static function getImageForPhoto(array $photo)
|
public static function getImageForPhoto(array $photo)
|
||||||
{
|
{
|
||||||
if (empty($photo['backend-class'])) {
|
$backendClass = DI::storageManager()->getByName($photo['backend-class'] ?? '');
|
||||||
|
if ($backendClass === null) {
|
||||||
// legacy data storage in "data" column
|
// legacy data storage in "data" column
|
||||||
$i = self::selectFirst(['data'], ['id' => $photo['id']]);
|
$i = self::selectFirst(['data'], ['id' => $photo['id']]);
|
||||||
if ($i === false) {
|
if ($i === false) {
|
||||||
|
@ -179,7 +180,6 @@ class Photo
|
||||||
}
|
}
|
||||||
$data = $i['data'];
|
$data = $i['data'];
|
||||||
} else {
|
} else {
|
||||||
$backendClass = DI::storageManager()->getByName($photo['backend-class'] ?? '');
|
|
||||||
$backendRef = $photo['backend-ref'] ?? '';
|
$backendRef = $photo['backend-ref'] ?? '';
|
||||||
$data = $backendClass->get($backendRef);
|
$data = $backendClass->get($backendRef);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue