From ec249d465b60407b2e7c64e7a99be8ccf4b95e64 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 16 Jul 2015 20:19:20 -0700 Subject: provide a way to export a single year of items (to potentially keep from exhausting resources either on export or import) --- include/identity.php | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 29d9ef022..3925c3537 100644 --- a/include/identity.php +++ b/include/identity.php @@ -583,7 +583,7 @@ 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_flags & %d)>0 and not (item_restrict & %d)>0 and uid = %d", + $r = q("select * from item where (item_flags & %d)>0 and not (item_restrict & %d)>0 and uid = %d order by created", intval(ITEM_WALL), intval(ITEM_DELETED), intval($channel_id) @@ -600,6 +600,35 @@ 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_flags & %d) > 0 and (item_restrict & %d) = 0 and uid = %d and created >= '%s' and created < '%s' order by created ", + intval(ITEM_WALL), + intval(ITEM_DELETED), + 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. * -- cgit v1.2.3 From 3c60a0c22cc7945d8298a76d9dc2e30c1b2fb3c3 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 16 Jul 2015 20:20:42 -0700 Subject: provide any single year of exported items --- include/identity.php | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'include/identity.php') 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. * -- cgit v1.2.3 From 4d45bc9da185c4c8f558b07f8020dce8171fb957 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 20 Jul 2015 21:01:11 +0200 Subject: Fixes regarding the new default profile photo size. The default profile photos are just renamed. People which provided the originals are invited to reproduce them in the new 300 by 300 px format. --- include/identity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/identity.php') diff --git a/include/identity.php b/include/identity.php index 3925c3537..5a3861b31 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1393,10 +1393,10 @@ function get_theme_uid() { * with the specified size. * * @param int $size -* one of (175, 80, 48) +* one of (300, 80, 48) * @returns string */ -function get_default_profile_photo($size = 175) { +function get_default_profile_photo($size = 300) { $scheme = get_config('system','default_profile_photo'); if(! $scheme) $scheme = 'rainbow_man'; -- cgit v1.2.3