replacing direct query with User model call
This commit is contained in:
parent
76fd2a4aa0
commit
7e061e0cae
1 changed files with 2 additions and 8 deletions
|
@ -369,17 +369,11 @@ class Photo extends BaseObject
|
||||||
$logger = $a->getLogger();
|
$logger = $a->getLogger();
|
||||||
$profiler = $a->getProfiler();
|
$profiler = $a->getProfiler();
|
||||||
|
|
||||||
$userStmt = DBA::p(
|
$user = User::getOwnerDataById($uid);
|
||||||
"SELECT `user`.`nickname`, `user`.`page-flags`, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid`
|
|
||||||
WHERE `user`.`uid` = %d AND `user`.`blocked` = 0 AND `contact`.`self` = 1 LIMIT 1",
|
|
||||||
intval($uid)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!DBA::isResult($userStmt)) {
|
if (!DBA::isResult($user) || !empty($user['blocked'])) {
|
||||||
$logger->info("Can't detect user data.", ['uid' => $uid]);
|
$logger->info("Can't detect user data.", ['uid' => $uid]);
|
||||||
return [];
|
return [];
|
||||||
} else {
|
|
||||||
$user = DBA::toArray($userStmt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$page_owner_nick = $user[0]['nickname'];
|
$page_owner_nick = $user[0]['nickname'];
|
||||||
|
|
Loading…
Reference in a new issue