![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/public_html/ |
<?php
// Fix script to restore correct audio URLs for variations
session_start();
require_once 'config/database.php';
echo "<h2>Fixing Audio Variation URLs</h2>";
$pdo = getDBConnection();
if (!$pdo) {
echo "Database connection failed";
exit;
}
// Get all variations that have corrupted audio URLs
$stmt = $pdo->query("
SELECT id, track_id, variation_index, audio_url, source_audio_url, title
FROM audio_variations
WHERE source_audio_url IS NOT NULL
AND source_audio_url != ''
ORDER BY track_id, variation_index
");
$variations = $stmt->fetchAll();
if (empty($variations)) {
echo "<p>No variations with source URLs found.</p>";
exit;
}
echo "<h3>Found " . count($variations) . " variations to fix</h3>";
$fixed = 0;
$errors = 0;
foreach ($variations as $variation) {
if (!empty($variation['source_audio_url'])) {
try {
// Update the audio_url to use the source_audio_url
$stmt = $pdo->prepare("
UPDATE audio_variations
SET audio_url = ?
WHERE id = ?
");
$result = $stmt->execute([$variation['source_audio_url'], $variation['id']]);
if ($result) {
echo "<p style='color: green;'>✓ Fixed variation ID {$variation['id']} (Track {$variation['track_id']}, Index {$variation['variation_index']}): {$variation['title']}</p>";
echo "<p style='margin-left: 20px;'>Changed from: {$variation['audio_url']}</p>";
echo "<p style='margin-left: 20px;'>Changed to: {$variation['source_audio_url']}</p>";
$fixed++;
} else {
echo "<p style='color: red;'>✗ Failed to fix variation ID {$variation['id']}</p>";
$errors++;
}
} catch (Exception $e) {
echo "<p style='color: red;'>✗ Error fixing variation ID {$variation['id']}: " . $e->getMessage() . "</p>";
$errors++;
}
}
}
echo "<h3>Summary:</h3>";
echo "<p>Fixed: {$fixed} variations</p>";
echo "<p>Errors: {$errors} variations</p>";
if ($fixed > 0) {
echo "<p style='color: green; font-weight: bold;'>Audio variation URLs have been restored from source URLs!</p>";
echo "<p>Please refresh your library page to see the corrected audio files.</p>";
}
?>