changed sql for photo table from to avoid memory issues on large photo tables

This commit is contained in:
gerhard6380 2017-05-05 22:29:25 +02:00
parent 38f476eedb
commit 877ecf6d04
1 changed files with 5 additions and 5 deletions

View File

@ -3352,7 +3352,7 @@ $called_api = null;
throw new BadRequestException("no new albumname specified");
}
// check if album is existing
$r = q("SELECT * FROM `photo` WHERE `uid` = %d AND `album` = '%s'",
$r = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `album` = '%s'",
intval(api_user()),
dbesc($album));
if (!dbm::is_result($r)) {
@ -3460,7 +3460,7 @@ $called_api = null;
$mode = "update";
// check if photo is existing in database
$r = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' AND `album` = '%s'",
$r = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' AND `album` = '%s'",
intval(api_user()),
dbesc($photo_id),
dbesc($album));
@ -3580,7 +3580,7 @@ $called_api = null;
throw new BadRequestException("no photo_id specified");
}
// check if photo is existing in database
$r = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'",
$r = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'",
intval(api_user()),
dbesc($photo_id)
);
@ -3659,7 +3659,7 @@ $called_api = null;
// check if specified profile id is valid
if ($profileid != 0) {
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d",
$r = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `id` = %d",
intval(api_user()),
intval($profileid));
// error message if specified profile id is not in database
@ -3706,7 +3706,7 @@ $called_api = null;
intval(local_user())
);
} else {
$r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
$r = q("UPDATE `profile` SET `photo` = '%s', `thumb` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-4.' . $filetype),
dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-5.' . $filetype),
intval($_REQUEST['profile']),