Not Allowed';
$o = '
' . t('Update to Hubzilla 5.0 step 2') . '
';
$o .= '' . t('To complete the update please run') . '
';
$o .= '' . t('php util/z6convert.php') . '
';
$o .= '' . t('from the terminal.') . '
';
return $o;
/* this code is outdated use util/z6convert.php instead
$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)
);
}
}
$zot = dbesc($zot_xchan);
$zot6 = dbesc($zot6_xchan);
// Item table
foreach(['owner_xchan', 'author_xchan'] as $x) {
$q .= sprintf("UPDATE item SET $x = '%s' WHERE $x = '%s';\r\n",
$zot6,
$zot
);
}
$q .= "UPDATE item SET source_xchan = replace(source_xchan, '$zot', '$zot6'), route = replace(route, '$zot', '$zot6'), allow_cid = replace(allow_cid, '$zot', '$zot6'), deny_cid = replace(deny_cid, '$zot', '$zot6');\r\n";
// photo table
$q .= "UPDATE photo SET xchan = replace(xchan, '$zot', '$zot6'), allow_cid = replace(allow_cid, '$zot', '$zot6'), deny_cid = replace(deny_cid, '$zot', '$zot6');\r\n";
// dreport table
$q .= "UPDATE dreport SET dreport_recip = '$zot6' WHERE dreport_recip = '$zot';\r\n";
$q .= "UPDATE dreport SET dreport_xchan = '$zot6' WHERE dreport_xchan = '$zot';\r\n";
}
if($q)
file_put_contents($path, $q);
$o = '' . t('Update to Hubzilla 5.0 step 2') . '
';
$o .= '' . t('To complete the update please run') . '
';
if(ACTIVE_DBTYPE == DBTYPE_MYSQL)
$o .= 'source ' . $_SERVER["DOCUMENT_ROOT"] . '/' . $path . '
from the mysql console.
';
else
$o .= '\i ' . $_SERVER["DOCUMENT_ROOT"] . '/' . $path . '
from the postgresql console.
';
$o .= '
' . t('INFO: this command can take a very long time depending on your DB size.') . '
';
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;
}
}