One audio file per poll (MP3, M4A, OGG, WAV) is uploaded in the admin settings and looped in the presenter view while a quiz runs. Format is detected by magic bytes, files are served with a fixed content type, copied with the poll and swept by images_cleanup. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
35 lines
849 B
PHP
35 lines
849 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Migrations\BaseMigration;
|
|
|
|
/**
|
|
* Optional audio file per presentation, played in the presenter view while a quiz countdown runs.
|
|
* The file lives in the upload directory, see \App\Service\AudioService; the table only holds its
|
|
* random file name.
|
|
*/
|
|
class AddAudioToPolls extends BaseMigration
|
|
{
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function up(): void
|
|
{
|
|
$table = $this->table('polls');
|
|
if (!$table->hasColumn('audio')) {
|
|
$table->addColumn('audio', 'string', ['null' => true, 'default' => null, 'limit' => 40])->update();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function down(): void
|
|
{
|
|
$table = $this->table('polls');
|
|
if ($table->hasColumn('audio')) {
|
|
$table->removeColumn('audio')->update();
|
|
}
|
|
}
|
|
}
|