move the maintenance part to include/sharedwithme.php
This commit is contained in:
parent
47c055e7f3
commit
e345d6793d
32
include/sharedwithme.php
Normal file
32
include/sharedwithme.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
function apply_updates() {
|
||||
|
||||
//check for updated items and remove them
|
||||
$x = q("SELECT mid, object 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['object'],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)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -12,33 +12,9 @@ function sharedwithme_content(&$a) {
|
||||
|
||||
$is_owner = (local_channel() && (local_channel() == $channel['channel_id']));
|
||||
|
||||
//maintenance - see if a file got dropped and remove it systemwide - this should possibly go to include/poller
|
||||
$x = q("SELECT * FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d",
|
||||
dbesc(ACTIVITY_UPDATE),
|
||||
dbesc(ACTIVITY_OBJ_FILE),
|
||||
intval(local_channel())
|
||||
);
|
||||
|
||||
if($x) {
|
||||
|
||||
foreach($x as $xx) {
|
||||
|
||||
$object = json_decode($xx['object'],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)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//check for updated items and remove them
|
||||
require_once('include/sharedwithme.php');
|
||||
apply_updates();
|
||||
|
||||
//drop single file - localuser
|
||||
if((argc() > 2) && (argv(2) === 'drop')) {
|
||||
|
Reference in New Issue
Block a user