diff options
author | Mario <mario@mariovavti.com> | 2021-10-15 19:17:06 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-10-15 19:17:06 +0000 |
commit | a622f533ad2f5890a782b6477406ce1d1d774d34 (patch) | |
tree | e5d04752ad37e3b04a6e908a83a177176a65fd05 /include/channel.php | |
parent | db18438db2a6f5aeb12da4a75aa7e772054f601b (diff) | |
download | volse-hubzilla-a622f533ad2f5890a782b6477406ce1d1d774d34.tar.gz volse-hubzilla-a622f533ad2f5890a782b6477406ce1d1d774d34.tar.bz2 volse-hubzilla-a622f533ad2f5890a782b6477406ce1d1d774d34.zip |
some heavylifting on manual item export
Diffstat (limited to 'include/channel.php')
-rw-r--r-- | include/channel.php | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/include/channel.php b/include/channel.php index 2db0434ca..7188d76f8 100644 --- a/include/channel.php +++ b/include/channel.php @@ -767,10 +767,10 @@ function get_default_export_sections() { 'connections', 'config', 'apps', - 'chatrooms', - 'events', - 'webpages', - 'wikis' +// 'chatrooms', +// 'events', +// 'webpages', +// 'wikis' ]; $cb = [ 'sections' => $sections ]; @@ -1179,7 +1179,7 @@ function identity_export_year($channel_id, $year, $month = 0, $zap_compat = fals } /** - * @brief Export items within an arbitrary date range. + * @brief Export conv items within an arbitrary date range. * * Date/time is in UTC. * @@ -1212,19 +1212,39 @@ function channel_export_items_date($channel_id, $start, $finish, $zap_compat = f } - $r = q("select * from item where ( item_wall = 1 or item_type != %d ) and item_deleted = 0 and uid = %d and created >= '%s' and created <= '%s' and resource_type != 'photo' order by created", - intval(ITEM_TYPE_POST), + // Fetch parent items for the timeframe + $r = q("SELECT parent AS item_id FROM item + WHERE uid = %d AND (item_wall = 1 OR item_private = 2) AND item_thread_top = 1 + AND resource_type IN ('group_item', '') AND item_deleted = 0 + AND created >= '%s' AND created <= '%s' + ORDER BY created", intval($channel_id), dbesc($start), dbesc($finish) ); - if($r) { - $ret['item'] = array(); - xchan_query($r); - $r = fetch_post_tags($r, true); - foreach($r as $rr) - $ret['item'][] = encode_item($rr, true, $zap_compat); + $parents_str = ids_to_querystr($r, 'item_id'); + + $items = q("SELECT * FROM item + WHERE uid = %d + AND parent IN ( $parents_str ) + ORDER BY created", + intval($channel_id) + ); + + //$items = q("select * from item where (item_wall = 1 or item_type != %d ) and resource_type = '' and item_deleted = 0 and uid = %d and created >= '%s' and created <= '%s' order by created", + //intval(ITEM_TYPE_POST), + //intval($channel_id), + //dbesc($start), + //dbesc($finish) + //); + + if($items) { + $ret['item'] = []; + xchan_query($items); + $r = fetch_post_tags($items, true); + foreach ($items as $item) + $ret['item'][] = encode_item($item, true, $zap_compat); } return $ret; |