From d1480d9f560f2d44679c76f9ecc1520b8fb2a400 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 3 Sep 2015 01:55:07 -0700 Subject: [PATCH 1/9] bug reporting doc --- doc/bugs.bb | 31 +++++++++++++++++++++++++++++++ doc/members.bb | 1 + 2 files changed, 32 insertions(+) create mode 100644 doc/bugs.bb diff --git a/doc/bugs.bb b/doc/bugs.bb new file mode 100644 index 000000000..9fefdef08 --- /dev/null +++ b/doc/bugs.bb @@ -0,0 +1,31 @@ +[h2]Bugs, Issues, and things that go bump in the night...[/h2] + +[h3]Something went wrong! Who is charge of fixing it?[/h3] + +This software is open source and was built by and is maintained by unpaid volunteers. So the quick answer is that nobody is in charge of fixing things. However, some of us have worked long and hard to provide a quality experience for you and don't wish to see you in discomfort because of a software issue or bug. + +The first thing you need to do is talk to your hub administrator - the person who runs and manages your site. They are in the unique position of having access to the internal software and database and [b]logfiles[/b] and will need to be involved in fixing your problem. Other people "on the net" can't really help with this. The first thing [b]they[/b] need to do is look at their logs and/or try to reproduce the problem. So try to be as helpful and courteous as possible in helping them look into the problem. + +To find your site administrator (if you don't know who they are) please look at [url=[baseurl]/siteinfo]this page[/url]. If they have not provided any contact info on that page or provided an "Impressum" there, see [url=[baseurl]/siteinfo/json]this site info summary[/url] under the heading "admin:". + +[h3]I'm a site administrator; what do I do?[/h3] + +It's your site, fix it! OK, sometimes it isn't that easy. There could be other sites involved, and the problem may not even be on your site but elsewhere in the network. Try to pin down the communication endpoints (hubs or sites) involved in the problem and contact the administrator of that site or those sites. Please try and provide an event time of when things went wrong so it can be found in the logs. Work with the other administrator(s) to find the cause of the problem. Logfiles are your friend. When something happens in the software that we didn't expect, it is nearly always logged. + +[h3]The white screen of death[/h3] + +If you get a blank white screen when doing something, this is almost always a code or syntax error. There are instructions in your .htconfig.php file for enabling syntax logging. Do this and repeat the sequence which led to the error and it should log the offending line of code. Hopefully you will be able to fix the problem with this information. When you do, please submit the fix "upstream" so that we can share the fix with the rest of the project members. This is the key benefit of using open source software - we share with each other and everybody benefits. + +[h3]I'm stumped. I can't figure out what is wrong.[/h3] + +At this point it might be worthwhile discussing the issue on one of the online forums. There may be several of these and some may be more suited to your spoken language. As a last resort, try "Channel One", which is in English. + +Other developers may need to find out more, so do your homework and document what is happening and everything you've tried. Don't say "I did xyz and it didn't work." That doesn't tell us anything. Tell us precisely what steps you took and what you expected the result to be, and precisely what happened as a result. If there were any error messages, don't say "there was an error message". Tell us exactly what the message said. + +If the project developers can't help you right away, understand that they are volunteers and may have a lot of other work and demands on their time. At this point you need to file a bug report. You will need an account on github.com to do this. So register, and then visit https://github.com/redmatrix/hubzilla/issues +. Create an issue here and provide all the same information that you provided online. Don't leave out anything. + +Then you wait. If it's a high profile issue, it may get fixed quickly. But nobody is in charge of fixing bugs. If it lingers without resolution, please spend some more time investigating the problem. Ask about anything you don't understand related to the behaviour. You will learn more about how the software works and quite possibly figure out why it isn't working now. Ultimately it is somebody in the community who is going to fix this and you are a member of the community; and this is how the open source process works. + +And just a word of warning. If you file 10 or 20 or 40 bugs on your first day looking at the project and without exploring how the software was supposed to work in the first place, you will probably be ignored. This is a public project and we are unfortunately frequented by "whingers" who like to waste our time complaining about stuff. Don't be one of them. The more helpful and courteous you are, the more helpful and courteous we will be in return. This applies to everything you do in life and is only mentioned here as a reminder. + \ No newline at end of file diff --git a/doc/members.bb b/doc/members.bb index 705154b56..13339ef2d 100644 --- a/doc/members.bb +++ b/doc/members.bb @@ -22,3 +22,4 @@ [zrl=[baseurl]/help/addons]Help With Addons[/zrl] [zrl=[baseurl]/help/diaspora_compat]Diaspora Communications Compatibility (Diaspora and Friendica)[/zrl] [zrl=[baseurl]/help/faq_members]FAQ For Members[/zrl] +[zrl=[baseurl]/help/bugs]Bugs, Issues, and things that go bump in the night...[/zrl] From 5cef672f9a128506f8531cec5d294dda83c3936d Mon Sep 17 00:00:00 2001 From: zottel Date: Thu, 3 Sep 2015 13:55:47 +0200 Subject: [PATCH 2/9] fix update 1148 --- boot.php | 2 +- install/update.php | 29 ++++++++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/boot.php b/boot.php index 3423ef85c..43b5581ac 100755 --- a/boot.php +++ b/boot.php @@ -49,7 +49,7 @@ define ( 'PLATFORM_NAME', 'redmatrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1151 ); +define ( 'DB_UPDATE_VERSION', 1152 ); /** * @brief Constant with a HTML line break. diff --git a/install/update.php b/install/update.php index 3fd75754d..16db09328 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ Date: Thu, 3 Sep 2015 13:10:03 -0700 Subject: [PATCH 3/9] revision update --- version.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.inc b/version.inc index da2499cde..9cfd95d30 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-09-02.1143 +2015-09-03.1144 From e1af81ea55bbec1ce9c03f824386ec062ae37581 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 3 Sep 2015 15:48:01 -0700 Subject: [PATCH 4/9] in this case no results is not an error --- install/update.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/install/update.php b/install/update.php index 16db09328..82792a82d 100644 --- a/install/update.php +++ b/install/update.php @@ -1750,8 +1750,7 @@ function update_r1151() { } } - if ($r3) - return UPDATE_SUCCESS; - return UPDATE_FAILED; + + return UPDATE_SUCCESS; } From c83da012ffcced1cbe1910c53a345fd581e1e4cd Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 3 Sep 2015 16:19:59 -0700 Subject: [PATCH 5/9] profile import error #34 --- mod/import.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mod/import.php b/mod/import.php index c2ed82a0a..391461687 100644 --- a/mod/import.php +++ b/mod/import.php @@ -161,7 +161,6 @@ function import_post(&$a) { } - if($completed < 3) { if($data['photo']) { @@ -169,8 +168,8 @@ function import_post(&$a) { import_channel_photo(base64url_decode($data['photo']['data']),$data['photo']['type'],get_account_id(),$channel['channel_id']); } - if(is_array($data['profiles'])) - import_profiles($channel,$data['profiles']); + if(is_array($data['profile'])) + import_profiles($channel,$data['profile']); logger('import step 3'); $_SESSION['import_step'] = 3; From 2a7ff3018b8f82013c739eb70cd02c51737211bb Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 3 Sep 2015 17:21:20 -0700 Subject: [PATCH 6/9] channel export - don't include linked resource items (photos, events). These items will need to be provided with those objects so that they can be re-linked. --- include/identity.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/identity.php b/include/identity.php index e236b5a90..ca4c009c8 100644 --- a/include/identity.php +++ b/include/identity.php @@ -598,7 +598,9 @@ 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 order by created", + /** Don't export linked resource items. we'll have to pull those out separately. */ + + $r = q("select * from item where (item_flags & %d) > 0 and not (item_restrict & %d) > 0 and uid = %d and resource_type = '' order by created", intval(ITEM_WALL), intval(ITEM_DELETED), intval($channel_id) @@ -635,7 +637,7 @@ function identity_export_year($channel_id,$year,$month = 0) { else $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 ", + $r = q("select * from item where (item_flags & %d) > 0 and (item_restrict & %d) = 0 and uid = %d and created >= '%s' and created < '%s' and resource_type = '' order by created ", intval(ITEM_WALL), intval(ITEM_DELETED), intval($channel_id), From f7d9523c7da3c193dd0216fa00e62a940d0d174d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 3 Sep 2015 18:43:44 -0700 Subject: [PATCH 7/9] export chatrooms --- include/identity.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/identity.php b/include/identity.php index ca4c009c8..1a2a9c177 100644 --- a/include/identity.php +++ b/include/identity.php @@ -577,6 +577,12 @@ function identity_basic_export($channel_id, $items = false) { if($r) $ret['app'] = $r; + $r = q("select * from chatroom where cr_uid = %d", + intval($channel_id) + ); + if($r) + $ret['chatroom'] = $r; + if(! $items) return $ret; From d79e81a0697617b5552917c2fe169b30433c54f6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 3 Sep 2015 18:44:40 -0700 Subject: [PATCH 8/9] import and sync chatrooms --- include/chat.php | 2 + include/identity.php | 7 +++- include/import.php | 99 +++++++++++++++++++++++++++++++++++++++++++- include/zot.php | 3 ++ mod/chat.php | 4 +- mod/import.php | 3 ++ 6 files changed, 114 insertions(+), 4 deletions(-) diff --git a/include/chat.php b/include/chat.php index 05bb02bb9..a0646265a 100644 --- a/include/chat.php +++ b/include/chat.php @@ -91,6 +91,8 @@ function chatroom_destroy($channel,$arr) { return $ret; } + create_sync_packet($channel['channel_id'],array('chatroom' => $r)); + q("delete from chatroom where cr_id = %d", intval($r[0]['cr_id']) ); diff --git a/include/identity.php b/include/identity.php index c3f59b371..393378cc4 100644 --- a/include/identity.php +++ b/include/identity.php @@ -566,13 +566,18 @@ function identity_basic_export($channel_id, $items = false) { if($r) $ret['obj'] = $r; - $r = q("select * from app where app_channel = %d", intval($channel_id) ); if($r) $ret['app'] = $r; + $r = q("select * from chatroom where cr_uid = %d", + intval($channel_id) + ); + if($r) + $ret['chatroom'] = $r; + if(! $items) return $ret; diff --git a/include/import.php b/include/import.php index 6ce572ea2..261219ce0 100644 --- a/include/import.php +++ b/include/import.php @@ -349,7 +349,7 @@ function sync_apps($channel,$apps) { intval($channel['channel_id']) ); if($x) { - if($x[0]['app_edited'] >= $obj['app_edited']) + if($x[0]['app_edited'] >= $app['app_edited']) continue; $exists = true; } @@ -377,4 +377,99 @@ function sync_apps($channel,$apps) { } } } -} \ No newline at end of file +} + + + +function import_chatrooms($channel,$chatrooms) { + + if($channel && $chatrooms) { + foreach($chatrooms as $chatroom) { + + if(! $chatroom['cr_name']) + continue; + + unset($chatroom['cr_id']); + unset($chatroom['cr_aid']); + unset($chatroom['cr_uid']); + + $chatroom['cr_aid'] = $channel['channel_account_id']; + $chatroom['cr_uid'] = $channel['channel_id']; + + dbesc_array($chatroom); + $r = dbq("INSERT INTO chatroom (`" + . implode("`, `", array_keys($chatroom)) + . "`) VALUES ('" + . implode("', '", array_values($chatroom)) + . "')" + ); + } + } +} + + + +function sync_chatrooms($channel,$chatrooms) { + + if($channel && $chatrooms) { + foreach($chatrooms as $chatroom) { + + if(! $chatroom['cr_name']) + continue; + + if(array_key_exists('cr_deleted',$chatroom) && $chatroom['cr_deleted']) { + q("delete from chatroom where cr_name = '%s' and cr_uid = %d limit 1", + dbesc($chatroom['cr_name']), + intval($channel['channel_id']) + ); + continue; + } + + + unset($chatroom['cr_id']); + unset($chatroom['cr_aid']); + unset($chatroom['cr_uid']); + + if(! $chatroom['cr_created'] || $chatroom['cr_created'] === NULL_DATE) + $chatroom['cr_created'] = datetime_convert(); + if(! $chatroom['cr_edited'] || $chatroom['cr_edited'] === NULL_DATE) + $chatroom['cr_edited'] = datetime_convert(); + + $chatroom['cr_aid'] = $channel['channel_account_id']; + $chatroom['cr_uid'] = $channel['channel_id']; + + $exists = false; + + $x = q("select * from chatroom where cr_name = '%s' and cr_uid = %d limit 1", + dbesc($chatroom['cr_name']), + intval($channel['channel_id']) + ); + if($x) { + if($x[0]['cr_edited'] >= $chatroom['cr_edited']) + continue; + $exists = true; + } + $name = $chatroom['cr_name']; + + if($exists) { + foreach($chatroom as $k => $v) { + $r = q("UPDATE chatroom SET `%s` = '%s' WHERE cr_name = '%s' AND cr_uid = %d", + dbesc($k), + dbesc($v), + dbesc($name), + intval($channel['channel_id']) + ); + } + } + else { + dbesc_array($chatroom); + $r = dbq("INSERT INTO chatroom (`" + . implode("`, `", array_keys($chatroom)) + . "`) VALUES ('" + . implode("', '", array_values($chatroom)) + . "')" + ); + } + } + } +} diff --git a/include/zot.php b/include/zot.php index fecaa7ad2..9610df894 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2881,6 +2881,9 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { if(array_key_exists('app',$arr) && $arr['app']) sync_apps($channel,$arr['app']); + if(array_key_exists('chatroom',$arr) && $arr['chatroom']) + sync_apps($channel,$arr['chatroom']); + if(array_key_exists('channel',$arr) && is_array($arr['channel']) && count($arr['channel'])) { if(array_key_exists('channel_page_flags',$arr['channel']) && intval($arr['channel']['channel_pageflags'])) { $arr['channel']['channel_removed'] = (($arr['channel']['channel_pageflags'] & 0x8000) ? 1 : 0); diff --git a/mod/chat.php b/mod/chat.php index c2c11d0ab..633ecae22 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -62,11 +62,13 @@ function chat_post(&$a) { chatroom_create($channel,$arr); - $x = q("select cr_id from chatroom where cr_name = '%s' and cr_uid = %d limit 1", + $x = q("select * from chatroom where cr_name = '%s' and cr_uid = %d limit 1", dbesc($room), intval(local_channel()) ); + create_sync_packet(0, array['chatroom'] => $x); + if($x) goaway(z_root() . '/chat/' . $channel['channel_address'] . '/' . $x[0]['cr_id']); diff --git a/mod/import.php b/mod/import.php index 391461687..1d1799e00 100644 --- a/mod/import.php +++ b/mod/import.php @@ -435,6 +435,9 @@ function import_post(&$a) { if(is_array($data['app'])) import_apps($channel,$data['app']); + if(is_array($data['chatroom'])) + import_chatrooms($channel,$data['chatroom']); + $saved_notification_flags = notifications_off($channel['channel_id']); if($import_posts && array_key_exists('item',$data) && $data['item']) { From b1888afa108fb09d0ebe3d50cc70ee9024ea76f1 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 3 Sep 2015 18:47:03 -0700 Subject: [PATCH 9/9] fix typos before pushing --- mod/chat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/chat.php b/mod/chat.php index 633ecae22..9ad58bc32 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -67,7 +67,7 @@ function chat_post(&$a) { intval(local_channel()) ); - create_sync_packet(0, array['chatroom'] => $x); + create_sync_packet(0, array('chatroom' => $x)); if($x) goaway(z_root() . '/chat/' . $channel['channel_address'] . '/' . $x[0]['cr_id']);