Skip removal if no cover image found

This commit is contained in:
Max Kostikov 2019-04-04 11:00:19 +02:00
parent e33604887b
commit 0c2db1cea5

View File

@ -56,18 +56,19 @@ class Cover_photo extends \Zotlabs\Web\Controller {
intval(PHOTO_COVER),
intval(local_channel())
);
q("update photo set photo_usage = %d where photo_usage = %d and uid = %d",
intval(PHOTO_NORMAL),
intval(PHOTO_COVER),
intval(local_channel())
);
if($r) {
q("update photo set photo_usage = %d where photo_usage = %d and uid = %d",
intval(PHOTO_NORMAL),
intval(PHOTO_COVER),
intval(local_channel())
);
$sync = attach_export_data($channel,$r[0]['resource_id']);
if($sync)
build_sync_packet($channel['channel_id'],array('file' => array($sync)));
}
goaway(z_root() . '/cover_photo');
}