clone sync missing for some item delete operations
This commit is contained in:
parent
0a21ffbfec
commit
9e27559bdb
@ -1108,6 +1108,14 @@ class Item extends \Zotlabs\Web\Controller {
|
|||||||
else {
|
else {
|
||||||
// complex deletion that needs to propagate and be performed in phases
|
// complex deletion that needs to propagate and be performed in phases
|
||||||
drop_item($i[0]['id'],true,DROPITEM_PHASE1);
|
drop_item($i[0]['id'],true,DROPITEM_PHASE1);
|
||||||
|
$r = q("select * from item where id = %d",
|
||||||
|
intval($i[0]['id'])
|
||||||
|
);
|
||||||
|
if($r) {
|
||||||
|
xchan_query($r);
|
||||||
|
$sync_item = fetch_post_tags($r);
|
||||||
|
build_sync_packet($i[0]['uid'],array('item' => array(encode_item($sync_item[0],true))));
|
||||||
|
}
|
||||||
tag_deliver($i[0]['uid'],$i[0]['id']);
|
tag_deliver($i[0]['uid'],$i[0]['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ function wiki_page_list($resource_id) {
|
|||||||
$i = 1;
|
$i = 1;
|
||||||
foreach($files as $file) {
|
foreach($files as $file) {
|
||||||
// strip the file extension and unwrap URL encoding to leave HTML encoded name
|
// strip the file extension and unwrap URL encoding to leave HTML encoded name
|
||||||
$title = substr($file, 0, -3);
|
$title = substr($file, 0, strrpos($file,'.'));
|
||||||
if(urldecode($title) !== 'Home') {
|
if(urldecode($title) !== 'Home') {
|
||||||
$pages[] = [
|
$pages[] = [
|
||||||
'resource_id' => $resource_id,
|
'resource_id' => $resource_id,
|
||||||
@ -147,7 +147,7 @@ function wiki_create_wiki($channel, $observer_hash, $wiki, $acl) {
|
|||||||
$item_id = $post['item_id'];
|
$item_id = $post['item_id'];
|
||||||
|
|
||||||
if ($item_id) {
|
if ($item_id) {
|
||||||
\Zotlabs\Daemon\Master::Summon(array('Notifier', 'activity', $item_id));
|
\Zotlabs\Daemon\Master::Summon(array('Notifier', 'activity', $item_id));
|
||||||
return array('item' => $post['item'], 'success' => true);
|
return array('item' => $post['item'], 'success' => true);
|
||||||
} else {
|
} else {
|
||||||
return array('item' => null, 'success' => false);
|
return array('item' => null, 'success' => false);
|
||||||
@ -226,8 +226,8 @@ function wiki_get_permissions($resource_id, $owner_id, $observer_hash) {
|
|||||||
$r = q("SELECT * FROM item WHERE uid = %d and resource_type = '%s' AND resource_id = '%s' $sql_extra LIMIT 1",
|
$r = q("SELECT * FROM item WHERE uid = %d and resource_type = '%s' AND resource_id = '%s' $sql_extra LIMIT 1",
|
||||||
intval($owner_id),
|
intval($owner_id),
|
||||||
dbesc(WIKI_ITEM_RESOURCE_TYPE),
|
dbesc(WIKI_ITEM_RESOURCE_TYPE),
|
||||||
dbesc($resource_id)
|
dbesc($resource_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
return array('read' => false, 'write' => false, 'success' => true);
|
return array('read' => false, 'write' => false, 'success' => true);
|
||||||
@ -579,36 +579,36 @@ function wiki_toc($content) {
|
|||||||
|
|
||||||
// look for markdown TOC items
|
// look for markdown TOC items
|
||||||
preg_match_all(
|
preg_match_all(
|
||||||
'/^(?:=|-|#).*$/m',
|
'/^(?:=|-|#).*$/m',
|
||||||
$source,
|
$source,
|
||||||
$matches,
|
$matches,
|
||||||
PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE
|
PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE
|
||||||
);
|
);
|
||||||
|
|
||||||
// preprocess: iterate matched lines to create an array of items
|
// preprocess: iterate matched lines to create an array of items
|
||||||
// where each item is an array(level, text)
|
// where each item is an array(level, text)
|
||||||
$file_size = strlen($source);
|
$file_size = strlen($source);
|
||||||
foreach ($matches[0] as $item) {
|
foreach ($matches[0] as $item) {
|
||||||
$found_mark = substr($item[0], 0, 1);
|
$found_mark = substr($item[0], 0, 1);
|
||||||
if ($found_mark == '#') {
|
if ($found_mark == '#') {
|
||||||
// text is the found item
|
// text is the found item
|
||||||
$item_text = $item[0];
|
$item_text = $item[0];
|
||||||
$item_level = strrpos($item_text, '#') + 1;
|
$item_level = strrpos($item_text, '#') + 1;
|
||||||
$item_text = substr($item_text, $item_level);
|
$item_text = substr($item_text, $item_level);
|
||||||
} else {
|
} else {
|
||||||
// text is the previous line (empty if <hr>)
|
// text is the previous line (empty if <hr>)
|
||||||
$item_offset = $item[1];
|
$item_offset = $item[1];
|
||||||
$prev_line_offset = strrpos($source, "\n", -($file_size - $item_offset + 2));
|
$prev_line_offset = strrpos($source, "\n", -($file_size - $item_offset + 2));
|
||||||
$item_text =
|
$item_text =
|
||||||
substr($source, $prev_line_offset, $item_offset - $prev_line_offset - 1);
|
substr($source, $prev_line_offset, $item_offset - $prev_line_offset - 1);
|
||||||
$item_text = trim($item_text);
|
$item_text = trim($item_text);
|
||||||
$item_level = $found_mark == '=' ? 1 : 2;
|
$item_level = $found_mark == '=' ? 1 : 2;
|
||||||
}
|
}
|
||||||
if (!trim($item_text) OR strpos($item_text, '|') !== FALSE) {
|
if (!trim($item_text) OR strpos($item_text, '|') !== FALSE) {
|
||||||
// item is an horizontal separator or a table header, don't mind
|
// item is an horizontal separator or a table header, don't mind
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$raw_toc[] = ['level' => $item_level, 'text' => trim($item_text)];
|
$raw_toc[] = ['level' => $item_level, 'text' => trim($item_text)];
|
||||||
}
|
}
|
||||||
$o = '';
|
$o = '';
|
||||||
foreach($raw_toc as $t) {
|
foreach($raw_toc as $t) {
|
||||||
|
Reference in New Issue
Block a user