aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-03-11 10:35:05 +0000
committerMario <mario@mariovavti.com>2020-03-11 10:35:05 +0000
commitd54ff4fae5db65f94d7c936be89984e6674f0501 (patch)
tree4f16ef8190f61cdf24c4f9f3920bd142066be714
parentba566fd64bbb57fb52779a3f29f30e730cab7744 (diff)
parent720d3dcedc96c7aaf6c4444c8b45acd46b8718b0 (diff)
downloadvolse-hubzilla-d54ff4fae5db65f94d7c936be89984e6674f0501.tar.gz
volse-hubzilla-d54ff4fae5db65f94d7c936be89984e6674f0501.tar.bz2
volse-hubzilla-d54ff4fae5db65f94d7c936be89984e6674f0501.zip
Merge branch 'dev' into z6connect
-rw-r--r--Zotlabs/Module/Z6trans.php130
-rw-r--r--include/text.php4
2 files changed, 132 insertions, 2 deletions
diff --git a/Zotlabs/Module/Z6trans.php b/Zotlabs/Module/Z6trans.php
new file mode 100644
index 000000000..98832ad98
--- /dev/null
+++ b/Zotlabs/Module/Z6trans.php
@@ -0,0 +1,130 @@
+<?php
+/**
+ * @file Zotlabs/Module/Z6trans.php
+ *
+ * @brief replace all occurances of an zot xchan with the zot6 xchan in DB.
+ *
+ */
+
+namespace Zotlabs\Module;
+
+use Zotlabs\Web\Controller;
+
+class Z6trans extends Controller {
+
+ function get() {
+ if(!is_site_admin())
+ return 'Not Allowed';
+
+ $path = 'store/z6trans.sql';
+
+ $r = q("SELECT channel.channel_name, channel.channel_portable_id, xchan.xchan_network FROM channel
+ LEFT JOIN xchan ON channel_portable_id = xchan_hash
+ WHERE xchan.xchan_network = 'zot'
+ AND channel.channel_removed = 0"
+ );
+
+ $q = '';
+
+ foreach($r as $rr) {
+
+ $zot_xchan = $rr['channel_portable_id'];
+
+ $r = q("SELECT xchan_guid FROM xchan WHERE xchan_hash = '%s' AND xchan_network = 'zot'",
+ dbesc($zot_xchan)
+ );
+
+ if(!$r) {
+ $q .= '-- ' . $zot_xchan . 'failed: zot xchan not found' . "\r\n";
+ continue;
+ }
+
+ $guid = $r[0]['xchan_guid'];
+
+ $r = q("SELECT xchan_hash, xchan_guid_sig FROM xchan WHERE xchan_guid = '%s' AND xchan_network = 'zot6'",
+ dbesc($guid)
+ );
+
+ if(!$r) {
+ $q .= '-- ' . $zot_xchan . 'failed: zot6 xchan not found' . "\r\n";
+ continue;
+ }
+
+ $zot6_xchan = $r[0]['xchan_hash'];
+
+ $core = self::get_core_cols();
+
+ $q .= '-- Transforming ' . $rr['channel_name'] . "\r\n";
+
+ foreach($core as $table => $cols) {
+
+ foreach($cols as $col) {
+
+ $q .= sprintf("UPDATE %s SET %s = replace(%s, '%s', '%s');\r\n",
+ dbesc($table),
+ dbesc($col),
+ dbesc($col),
+ dbesc($zot_xchan),
+ dbesc($zot6_xchan)
+ );
+
+ }
+
+ }
+
+ }
+
+ if($q)
+ file_put_contents($path, $q);
+
+ $o = '<h2>' . t('Update to Hubzilla 5.0 setp 2') . '</h2><br>';
+
+ $o .= '<h3>' . t('To complete the update please run') . '</h3>';
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL)
+ $o .= '<code>source ' . $_SERVER["DOCUMENT_ROOT"] . '/' . $path . '</code><h3>from the mysql console.</h3>';
+ else
+ $o .= '<code>\i ' . $_SERVER["DOCUMENT_ROOT"] . '/' . $path . '</code><h3>from the postgresql console.</h3>';
+
+ $o .= '<br><h3>' . t('INFO: this command can take a very long time depending on your DB size.') . '</h3>';
+
+ return $o;
+
+ }
+
+ function get_core_cols() {
+
+ $core = [
+ 'abconfig' => ['xchan'],
+ 'abook' => ['abook_xchan'],
+ 'app' => ['app_author'],
+ 'attach' => ['creator', 'allow_cid', 'deny_cid'],
+ 'channel' => ['channel_allow_cid', 'channel_deny_cid'],
+ 'chat' => ['chat_xchan'],
+ 'chatpresence' => ['cp_xchan'],
+ 'chatroom' => ['allow_cid', 'deny_cid'],
+ 'config' => ['v'],
+ 'dreport' => ['dreport_recip', 'dreport_xchan'],
+ 'event' => ['event_xchan', 'allow_cid', 'deny_cid'],
+ 'iconfig' => ['v'],
+ 'item' => ['owner_xchan', 'author_xchan', 'source_xchan', 'route', 'allow_cid', 'deny_cid'],
+ 'mail' => ['from_xchan', 'to_xchan'],
+ 'menu_item' => ['allow_cid', 'deny_cid'],
+ 'obj' => ['allow_cid', 'deny_cid'],
+ 'pconfig' => ['v'],
+ 'pgrp_member' => ['xchan'],
+ 'photo' => ['xchan', 'allow_cid', 'deny_cid'],
+ 'source' => ['src_channel_xchan', 'src_xchan'],
+ 'updates' => ['ud_hash'],
+ 'xchat' => ['xchat_xchan'],
+ 'xconfig' => ['xchan', 'v'],
+ 'xign' => ['xchan'],
+ 'xlink' => ['xlink_xchan', 'xlink_link'],
+ 'xprof' => ['xprof_hash'],
+ 'xtag' => ['xtag_hash'],
+ ];
+
+ return $core;
+
+ }
+
+}
diff --git a/include/text.php b/include/text.php
index 1475ff334..5d1cf6eff 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1881,7 +1881,7 @@ function format_poll($item,$s,$opts) {
}
}
if ($item['comments_closed'] > NULL_DATE) {
- $t = datetime_convert('UTC',date_default_timezone_get(), $item['comments_closed'], 'Y-m-d h:i');
+ $t = datetime_convert('UTC',date_default_timezone_get(), $item['comments_closed'], 'Y-m-d H:i');
$closed = ((datetime_convert() > $item['comments_closed']) ? true : false);
if ($closed) {
$message = t('Poll has ended.');
@@ -1892,7 +1892,7 @@ function format_poll($item,$s,$opts) {
$output .= EOL . '<div>' . $message . '</div>';
}
if ($activated and $commentable) {
- $output .= EOL . '<input type="button" class="btn btn-std btn-success" name="vote" value="vote" onclick="submitPoll(' . $item['id'] . '); return false;">'. '</form>';
+ $output .= EOL . '<input type="button" class="btn btn-std btn-success" name="vote" value="' . t("Vote") . '" onclick="submitPoll(' . $item['id'] . '); return false;">'. '</form>';
}
}