mirror of
https://github.com/YunoHost-Apps/hubzilla_ynh.git
synced 2024-09-03 19:26:21 +02:00
32 lines
626 B
PHP
32 lines
626 B
PHP
<?php
|
|
|
|
function apply_updates() {
|
|
|
|
//check for updated items and remove them
|
|
$x = q("SELECT mid, max(obj) AS obj FROM item WHERE verb = '%s' AND obj_type = '%s' GROUP BY mid",
|
|
dbesc(ACTIVITY_UPDATE),
|
|
dbesc(ACTIVITY_OBJ_FILE)
|
|
);
|
|
|
|
if($x) {
|
|
|
|
foreach($x as $xx) {
|
|
|
|
$object = json_decode($xx['obj'],true);
|
|
|
|
$d_mid = $object['d_mid'];
|
|
$u_mid = $xx['mid'];
|
|
|
|
$y = q("DELETE FROM item WHERE obj_type = '%s' AND (verb = '%s' AND mid = '%s') OR (verb = '%s' AND mid = '%s')",
|
|
dbesc(ACTIVITY_OBJ_FILE),
|
|
dbesc(ACTIVITY_POST),
|
|
dbesc($d_mid),
|
|
dbesc(ACTIVITY_UPDATE),
|
|
dbesc($u_mid)
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|