1
0
mirror of https://github.com/LinkStackOrg/LinkStack.git synced 2024-12-30 03:20:56 +01:00

Migrate Twitter icon to X

This commit is contained in:
Julian Prieber 2024-12-09 14:53:03 +01:00
parent d5721ae31e
commit e54320ea54

View File

@ -7,6 +7,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Database\Seeders\ButtonSeeder;
use App\Models\Page;
use App\Models\Link;
set_time_limit(0);
@ -429,6 +430,30 @@ try {
session(['update_error' => $e->getMessage()]);
}
try {
$links = Link::where('button_id', 94)->get()->groupBy('user_id');
foreach ($links as $userId => $userLinks) {
$hasXTwitter = $userLinks->contains('title', 'x-twitter');
foreach ($userLinks as $link) {
if ($link->title == 'twitter') {
if ($hasXTwitter) {
$link->delete();
} else {
$link->title = 'x-twitter';
$link->save();
$hasXTwitter = true;
}
}
}
}
} catch (exception $e) {
session(['update_error' => $e->getMessage()]);
}
try {
$themesPath = base_path('themes');