DB update to fix wrong hubloc_url for activitypub hublocs

This commit is contained in:
Mario Vavti 2018-05-26 21:15:22 +02:00
parent 33700e9cf4
commit eb04dbc5ce
2 changed files with 27 additions and 1 deletions

26
Zotlabs/Update/_1215.php Normal file
View File

@ -0,0 +1,26 @@
<?php
namespace Zotlabs\Update;
class _1215 {
function run() {
q("START TRANSACTION");
// this will fix mastodon hubloc_url
$r1 = q("UPDATE hubloc SET hubloc_url = LEFT(hubloc_url, POSITION('/users' IN hubloc_url)-1) WHERE POSITION('/users' IN hubloc_url)>0");
// this will fix peertube hubloc_url
$r2 = q("UPDATE hubloc SET hubloc_url = LEFT(hubloc_url, POSITION('/account' IN hubloc_url)-1) WHERE POSITION('/account' IN hubloc_url)>0");
if($r1 && $r2) {
q("COMMIT");
return UPDATE_SUCCESS;
}
else {
q("ROLLBACK");
return UPDATE_FAILED;
}
}
}

View File

@ -54,7 +54,7 @@ define ( 'STD_VERSION', '3.5.6' );
define ( 'ZOT_REVISION', '6.0a' );
define ( 'DB_UPDATE_VERSION', 1214 );
define ( 'DB_UPDATE_VERSION', 1215 );
define ( 'PROJECT_BASE', __DIR__ );