aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Update/_1215.php
blob: 3acaab5878ff5e26a87bc93e6061b0b5f9b9348f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
		}
	}

}