X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=update.php;h=59340eed83c84dfe7281048e7145d5f61964b2a8;hb=35995633ae6f5737a324f9023b0648f01883d1d1;hp=980ec721ab281db90676eab2cb59e03953c3f730;hpb=1b7075aebb344487c40d4444233929029393c82d;p=friendica.git diff --git a/update.php b/update.php index 980ec721ab..59340eed83 100644 --- a/update.php +++ b/update.php @@ -1349,3 +1349,31 @@ function update_1524(): int return Update::SUCCESS; } + +function update_1525(): int +{ + // Use expected value for user.username + if (!DBA::e('UPDATE `user` u + JOIN `profile` p + ON p.`uid` = u.`uid` + SET u.`username` = p.`name` + WHERE p.`name` != ""')) { + return Update::FAILED; + } + + // Blank out deprecated field profile.name to avoid future confusion + if (!DBA::e('UPDATE `profile` p + SET p.`name` = ""')) { + return Update::FAILED; + } + + // Update users' self-contact name if needed + if (!DBA::e('UPDATE `contact` c + JOIN `user` u + ON u.`uid` = c.`uid` AND c.`self` = 1 + SET c.`name` = u.`username`')) { + return Update::FAILED; + } + + return Update::SUCCESS; +}