aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-07-16 20:20:42 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-07-16 20:20:42 -0700
commit3c60a0c22cc7945d8298a76d9dc2e30c1b2fb3c3 (patch)
treeda39e7c9dda2e1c210f014b58b61b95c81f6d38f /include
parent4299ae65a4ec406bbd932e0948197c5127a57b3b (diff)
downloadvolse-hubzilla-3c60a0c22cc7945d8298a76d9dc2e30c1b2fb3c3.tar.gz
volse-hubzilla-3c60a0c22cc7945d8298a76d9dc2e30c1b2fb3c3.tar.bz2
volse-hubzilla-3c60a0c22cc7945d8298a76d9dc2e30c1b2fb3c3.zip
provide any single year of exported items
Diffstat (limited to 'include')
-rw-r--r--include/identity.php37
-rwxr-xr-xinclude/items.php1
2 files changed, 35 insertions, 3 deletions
diff --git a/include/identity.php b/include/identity.php
index 8ba5d64db..5ca626c72 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -583,8 +583,14 @@ function identity_basic_export($channel_id, $items = false) {
/** @warning this may run into memory limits on smaller systems */
- $r = q("select * from item where item_wall = 1 and item_deleted = 0 and uid = %d",
- intval($channel_id)
+ /** export one year of posts. If you want to export and import all posts you have to start with
+ * the first year and export/import them in ascending order.
+ */
+
+ $r = q("select * from item where item_wall = 1 and item_deleted = 0 and uid = %d and created > %s - INTERVAL %s",
+ intval($channel_id),
+ db_utcnow(),
+ db_quoteinterval('1 YEAR')
);
if($r) {
$ret['item'] = array();
@@ -598,6 +604,33 @@ function identity_basic_export($channel_id, $items = false) {
}
+function identity_export_year($channel_id,$year) {
+
+ if(! $year)
+ return array();
+
+ $ret = array();
+ $mindate = datetime_convert('UTC','UTC',$year . '-01-01 00:00:00');
+ $maxdate = datetime_convert('UTC','UTC',$year+1 . '-01-01 00:00:00');
+ $r = q("select * from item where item_wall = 1 and item_deleted = 0 and uid = %d and created >= '%s' and created < '%s' ",
+ intval($channel_id),
+ dbesc($mindate),
+ dbesc($maxdate)
+ );
+
+ if($r) {
+ $ret['item'] = array();
+ xchan_query($r);
+ $r = fetch_post_tags($r,true);
+ foreach($r as $rr)
+ $ret['item'][] = encode_item($rr,true);
+ }
+
+ return $ret;
+}
+
+
+
/**
* @brief Loads a profile into the App structure.
*
diff --git a/include/items.php b/include/items.php
index c067d3c1e..b1a0dacdf 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4389,7 +4389,6 @@ function first_post_date($uid,$wall = false) {
$r = q("select id, created from item
where uid = %d and id = parent $item_normal $wall_sql
order by created asc limit 1",
- intval(ITEM_VISIBLE),
intval($uid)
);