aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-03-16 20:12:30 +0000
committerMario <mario@mariovavti.com>2020-03-16 20:12:30 +0000
commitc5365261960150a2070b915d27b2b96337651f3d (patch)
tree49d2a879bd33a5c8ddf287bf1092284a72c4025b
parentb2de12442d3064ee3899583661efef28c4efd38f (diff)
downloadvolse-hubzilla-c5365261960150a2070b915d27b2b96337651f3d.tar.gz
volse-hubzilla-c5365261960150a2070b915d27b2b96337651f3d.tar.bz2
volse-hubzilla-c5365261960150a2070b915d27b2b96337651f3d.zip
Update 1236 and bump version to 4.7.4
-rw-r--r--Zotlabs/Update/_1236.php115
-rwxr-xr-xboot.php4
2 files changed, 117 insertions, 2 deletions
diff --git a/Zotlabs/Update/_1236.php b/Zotlabs/Update/_1236.php
new file mode 100644
index 000000000..c5f84626b
--- /dev/null
+++ b/Zotlabs/Update/_1236.php
@@ -0,0 +1,115 @@
+<?php
+
+namespace Zotlabs\Update;
+
+use Zotlabs\Lib\Libzot;
+
+class _1236 {
+
+ function run() {
+
+ $r = q("SELECT channel.channel_address, channel.channel_hash, xchan.xchan_guid, channel.channel_pubkey, channel.channel_portable_id FROM channel
+ LEFT JOIN xchan ON channel_hash = xchan_hash
+ WHERE xchan.xchan_network = 'zot'
+ AND channel.channel_removed = 0"
+ );
+
+ $i = 0;
+
+ foreach($r as $rr) {
+
+ $zot_xchan = $rr['channel_hash'];
+ $guid = $r[0]['xchan_guid'];
+
+ $xchan = q("SELECT xchan_hash, xchan_guid_sig FROM xchan WHERE xchan_guid = '%s' AND xchan_network = 'zot6'",
+ dbesc($guid)
+ );
+
+ if(!$xchan) {
+ // This should not actually happen.
+ // A zot6 xchan for every channel should have been
+ // created in update _1226.
+
+ // In case this failed, we will try to fix it here.
+ logger('No zot6 xchan found for: ' . $rr['channel_hash']);
+
+ $zhash = $rr['channel_portable_id'];
+
+ if(!$zhash) {
+ $zhash = Libzot::make_xchan_hash($rr['xchan_guid'], $rr['channel_pubkey']);
+
+ q("UPDATE channel SET channel_portable_id = '%s' WHERE channel_hash = '%s'",
+ dbesc($zhash),
+ dbesc($zot_xchan)
+ );
+ }
+
+ if(!$zhash) {
+ logger('Could not create zot6 xchan_hash for: ' . $rr['channel_hash']);
+ continue;
+ }
+
+ $x = q("SELECT * FROM xchan WHERE xchan_hash = '%s' LIMIT 1",
+ dbesc($rr['channel_hash'])
+ );
+
+ if($x) {
+ $rec = $x[0];
+ $rec['xchan_hash'] = $zhash;
+ $rec['xchan_guid_sig'] = 'sha256.' . $rec['xchan_guid_sig'];
+ $rec['xchan_network'] = 'zot6';
+ xchan_store_lowlevel($rec);
+ }
+
+ $h = q("SELECT * FROM hubloc WHERE hubloc_hash = '%s' AND hubloc_url = '%s' LIMIT 1",
+ dbesc($zot_xchan),
+ dbesc(z_root())
+ );
+
+ if($h) {
+ $rec = $h[0];
+ $rec['hubloc_hash'] = $zhash;
+ $rec['hubloc_guid_sig'] = 'sha256.' . $rec['hubloc_guid_sig'];
+ $rec['hubloc_network'] = 'zot6';
+ $rec['hubloc_url_sig'] = 'sha256.' . $rec['hubloc_url_sig'];
+ $rec['hubloc_callback'] = z_root() . '/zot';
+ $rec['hubloc_id_url'] = channel_url($rr);
+ $rec['hubloc_site_id'] = Libzot::make_xchan_hash(z_root(),get_config('system','pubkey'));
+ hubloc_store_lowlevel($rec);
+ }
+
+ // Now try again
+ $xchan = q("SELECT xchan_hash, xchan_guid_sig FROM xchan WHERE xchan_guid = '%s' AND xchan_network = 'zot6'",
+ dbesc($guid)
+ );
+
+ if(!$xchan) {
+ logger('Could not create zot6 xchan record for: ' . $zot_xchan);
+ continue;
+ }
+
+ }
+
+ $zot6_xchan = $xchan[0]['xchan_hash'];
+ $zot6_xchan_guid_sig = $xchan[0]['xchan_guid_sig'];
+
+ logger('Transforming channel: ' . $zot_xchan);
+ q("UPDATE channel SET channel_hash = '%s', channel_portable_id = '%s', channel_guid_sig = '%s' WHERE channel_hash = '%s'",
+ dbesc($zot6_xchan),
+ dbesc($zot_xchan),
+ dbesc($zot6_xchan_guid_sig),
+ dbesc($zot_xchan)
+ );
+
+ $i++;
+
+ }
+
+ if(count($r) == $i)
+ return UPDATE_SUCCESS;
+ else
+ return UPDATE_FAILED;
+
+ }
+
+}
diff --git a/boot.php b/boot.php
index ec96045e9..4bd51f09c 100755
--- a/boot.php
+++ b/boot.php
@@ -50,10 +50,10 @@ require_once('include/attach.php');
require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
-define ( 'STD_VERSION', '4.7.3' );
+define ( 'STD_VERSION', '4.7.4' );
define ( 'ZOT_REVISION', '6.0a' );
-define ( 'DB_UPDATE_VERSION', 1235 );
+define ( 'DB_UPDATE_VERSION', 1236 );
define ( 'PROJECT_BASE', __DIR__ );