Avoid write operations if not needed
This commit is contained in:
parent
19a24d6ada
commit
ca2454eeb4
|
@ -437,6 +437,10 @@ function display_content(&$a, $update = 0) {
|
||||||
if($r) {
|
if($r) {
|
||||||
|
|
||||||
if((local_user()) && (local_user() == $a->profile['uid'])) {
|
if((local_user()) && (local_user() == $a->profile['uid'])) {
|
||||||
|
$unseen = q("SELECT `id` FROM `item` WHERE `unseen` AND `parent` = %d",
|
||||||
|
intval($r[0]['parent']));
|
||||||
|
|
||||||
|
if ($unseen)
|
||||||
q("UPDATE `item` SET `unseen` = 0
|
q("UPDATE `item` SET `unseen` = 0
|
||||||
WHERE `parent` = %d AND `unseen`",
|
WHERE `parent` = %d AND `unseen`",
|
||||||
intval($r[0]['parent'])
|
intval($r[0]['parent'])
|
||||||
|
|
|
@ -857,15 +857,25 @@ function network_content(&$a, $update = 0) {
|
||||||
|
|
||||||
|
|
||||||
if((! $group) && (! $cid) && (! $star)) {
|
if((! $group) && (! $cid) && (! $star)) {
|
||||||
|
|
||||||
|
$unseen = q("SELECT `id` FROM `item` WHERE `unseen` AND `uid` = %d",
|
||||||
|
intval(local_user()));
|
||||||
|
|
||||||
|
if ($unseen)
|
||||||
$r = q("UPDATE `item` SET `unseen` = 0
|
$r = q("UPDATE `item` SET `unseen` = 0
|
||||||
WHERE `unseen` = 1 AND `uid` = %d",
|
WHERE `unseen` = 1 AND `uid` = %d",
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if($update_unseen)
|
if($update_unseen) {
|
||||||
|
|
||||||
|
$unseen = q("SELECT `id` FROM `item` ".$update_unseen);
|
||||||
|
|
||||||
|
if ($unseen)
|
||||||
$r = q("UPDATE `item` SET `unseen` = 0 $update_unseen");
|
$r = q("UPDATE `item` SET `unseen` = 0 $update_unseen");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set this so that the conversation function can find out contact info for our wall-wall items
|
// Set this so that the conversation function can find out contact info for our wall-wall items
|
||||||
$a->page_contact = $a->contact;
|
$a->page_contact = $a->contact;
|
||||||
|
|
Loading…
Reference in a new issue