aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobody <nobody@zotlabs.com>2020-09-19 23:45:37 +0000
committerMario <mario@mariovavti.com>2020-09-21 10:37:41 +0200
commitbd0b8d768eb3fdc2d95527e383abdfd72c3dc59a (patch)
treee4196eaf82c0489920f228206d8c5cbacbe33212
parent56e503149d3c2677e96d8909cef702127933f291 (diff)
downloadvolse-hubzilla-bd0b8d768eb3fdc2d95527e383abdfd72c3dc59a.tar.gz
volse-hubzilla-bd0b8d768eb3fdc2d95527e383abdfd72c3dc59a.tar.bz2
volse-hubzilla-bd0b8d768eb3fdc2d95527e383abdfd72c3dc59a.zip
apply channel name changes to all associated xchans
(cherry picked from commit f2ac1e4b7d2aa4854ed08ded49b2ed2dd10fab59) (cherry picked from commit 34217f5f901ae4dca180bceccef425de1eef4aeb)
-rw-r--r--Zotlabs/Module/Profiles.php4
-rw-r--r--Zotlabs/Module/Settings/Channel.php5
2 files changed, 5 insertions, 4 deletions
diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php
index 7deceabab..645d74add 100644
--- a/Zotlabs/Module/Profiles.php
+++ b/Zotlabs/Module/Profiles.php
@@ -607,10 +607,10 @@ class Profiles extends \Zotlabs\Web\Controller {
$channel = \App::get_channel();
if($namechanged && $is_default) {
- $r = q("UPDATE xchan SET xchan_name = '%s', xchan_name_date = '%s' WHERE xchan_hash = '%s'",
+ $r = q("UPDATE xchan SET xchan_name = '%s', xchan_name_date = '%s' WHERE xchan_url = '%s'",
dbesc($name),
dbesc(datetime_convert()),
- dbesc($channel['xchan_hash'])
+ dbesc(z_root() . '/channel/' . $channel['xchan_address'])
);
$r = q("UPDATE channel SET channel_name = '%s' WHERE channel_hash = '%s'",
dbesc($name),
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index ab9b72490..2eed1efc9 100644
--- a/Zotlabs/Module/Settings/Channel.php
+++ b/Zotlabs/Module/Settings/Channel.php
@@ -274,10 +274,11 @@ class Channel {
}
if($name_change) {
- $r = q("update xchan set xchan_name = '%s', xchan_name_date = '%s' where xchan_hash = '%s'",
+ // change name on all associated xchans by matching the url
+ $r = q("update xchan set xchan_name = '%s', xchan_name_date = '%s' where xchan_url = '%s'",
dbesc($username),
dbesc(datetime_convert()),
- dbesc($channel['channel_hash'])
+ dbesc(z_root() . '/channel/' . $channel['channel_address'])
);
$r = q("update profile set fullname = '%s' where uid = %d and is_default = 1",
dbesc($username),