text
stringlengths
9
39.2M
dir
stringlengths
26
295
lang
stringclasses
185 values
created_date
timestamp[us]
updated_date
timestamp[us]
repo_name
stringlengths
1
97
repo_full_name
stringlengths
7
106
star
int64
1k
183k
len_tokens
int64
1
13.8M
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20180211192448 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('CREATE TABLE station_webhooks (id INT AUTO_INCREMENT NOT NULL, station_id INT NOT NULL, name VARCHAR(100) NOT NULL, is_enabled TINYINT(1) NOT NULL, triggers LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\', config LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\', INDEX IDX_1516958B21BDB235 (station_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); $this->addSql('ALTER TABLE station_webhooks ADD CONSTRAINT FK_1516958B21BDB235 FOREIGN KEY (station_id) REFERENCES station (id) ON DELETE CASCADE'); } public function down(Schema $schema): void { $this->addSql('DROP TABLE station_webhooks'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20180211192448.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
247
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20161117000718 extends AbstractMigration { /** * @param Schema $schema */ public function up(Schema $schema): void { $this->addSql('CREATE TABLE station_mounts (id INT AUTO_INCREMENT NOT NULL, station_id INT NOT NULL, name VARCHAR(100) NOT NULL, is_default TINYINT(1) NOT NULL, fallback_mount VARCHAR(100) DEFAULT NULL, enable_streamers TINYINT(1) NOT NULL, enable_autodj TINYINT(1) NOT NULL, autodj_format VARCHAR(10) DEFAULT NULL, autodj_bitrate SMALLINT DEFAULT NULL, INDEX IDX_4DDF64AD21BDB235 (station_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); $this->addSql('ALTER TABLE station_mounts ADD CONSTRAINT FK_4DDF64AD21BDB235 FOREIGN KEY (station_id) REFERENCES station (id) ON DELETE CASCADE'); } public function postup(Schema $schema): void { foreach ($this->connection->fetchAllAssociative('SELECT * FROM station') as $station) { $this->connection->insert( 'station_mounts', [ 'station_id' => $station['id'], 'name' => '/radio.mp3', 'is_default' => 1, 'fallback_mount' => '/autodj.mp3', 'enable_streamers' => 1, 'enable_autodj' => 0, ] ); $this->connection->insert( 'station_mounts', [ 'station_id' => $station['id'], 'name' => '/autodj.mp3', 'is_default' => 0, 'fallback_mount' => '/error.mp3', 'enable_streamers' => 0, 'enable_autodj' => 1, 'autodj_format' => 'mp3', 'autodj_bitrate' => 128, ] ); } } /** * @param Schema $schema */ public function down(Schema $schema): void { $this->addSql('DROP TABLE station_mounts'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20161117000718.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
522
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20180320061801 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_webhooks CHANGE name type VARCHAR(100) NOT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_webhooks CHANGE type name VARCHAR(100) NOT NULL COLLATE utf8mb4_unicode_ci'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20180320061801.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
131
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20180506022642 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('DROP INDEX idx_playlist_media ON station_playlist_media'); } public function down(Schema $schema): void { $this->addSql('CREATE UNIQUE INDEX idx_playlist_media ON station_playlist_media (playlist_id, media_id)'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20180506022642.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
120
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20170512094523 extends AbstractMigration { /** * @param Schema $schema */ public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_media ADD fade_overlap NUMERIC(3, 1) DEFAULT NULL, ADD fade_in NUMERIC(3, 1) DEFAULT NULL, ADD fade_out NUMERIC(3, 1) DEFAULT NULL'); } /** * @param Schema $schema */ public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_media DROP fade_overlap, DROP fade_in, DROP fade_out'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20170512094523.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
179
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use App\Entity\Attributes\StableMigration; use Doctrine\DBAL\Schema\Schema; #[ StableMigration('0.19.4'), StableMigration('0.19.5') ] final class Version20231125215905 extends AbstractMigration { public function getDescription(): string { return 'Add table for user passkeys.'; } public function up(Schema $schema): void { $this->addSql('CREATE TABLE user_passkeys (id VARCHAR(64) NOT NULL, user_id INT NOT NULL, created_at INT NOT NULL, name VARCHAR(255) NOT NULL, full_id LONGTEXT NOT NULL, public_key_pem LONGTEXT NOT NULL, INDEX IDX_A2309328A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_general_ci` ENGINE = InnoDB'); $this->addSql('ALTER TABLE user_passkeys ADD CONSTRAINT FK_A2309328A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE user_passkeys DROP FOREIGN KEY FK_A2309328A76ED395'); $this->addSql('DROP TABLE user_passkeys'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20231125215905.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
293
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; final class Version20210620131126 extends AbstractMigration { public function getDescription(): string { return 'Add "max_listener_duration" to station_mounts table.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_mounts ADD max_listener_duration INT NOT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_mounts DROP max_listener_duration'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20210620131126.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
129
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20190124132556 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_remotes ADD is_public TINYINT(1) NOT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_remotes DROP is_public'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20190124132556.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
119
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20180320163622 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('ALTER TABLE station DROP FOREIGN KEY FK_9F39F8B19B209974'); $this->addSql('ALTER TABLE station ADD CONSTRAINT FK_9F39F8B19B209974 FOREIGN KEY (current_streamer_id) REFERENCES station_streamers (id) ON DELETE SET NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station DROP FOREIGN KEY FK_9F39F8B19B209974'); $this->addSql('ALTER TABLE station ADD CONSTRAINT FK_9F39F8B19B209974 FOREIGN KEY (current_streamer_id) REFERENCES station_streamers (id) ON DELETE CASCADE'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20180320163622.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
218
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20210721011736 extends AbstractMigration { public function getDescription(): string { return 'Retire Message Queue DB table.'; } public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->addSql('DROP TABLE messenger_messages'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_general_ci`, headers LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_general_ci`, queue_name VARCHAR(190) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_general_ci`, created_at DATETIME NOT NULL, available_at DATETIME NOT NULL, delivered_at DATETIME DEFAULT NULL, INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20210721011736.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
329
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20170719045113 extends AbstractMigration { /** * @param Schema $schema */ public function up(Schema $schema): void { $this->addSql('ALTER TABLE song_history ADD sent_to_autodj TINYINT(1) NOT NULL'); } public function postup(Schema $schema): void { $this->connection->executeStatement( 'UPDATE song_history SET sent_to_autodj=1 WHERE timestamp_cued != 0 AND timestamp_cued IS NOT NULL' ); } /** * @param Schema $schema */ public function down(Schema $schema): void { $this->addSql('ALTER TABLE song_history DROP sent_to_autodj'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20170719045113.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
201
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20161120032434 extends AbstractMigration { /** * @param Schema $schema */ public function up(Schema $schema): void { $this->addSql('ALTER TABLE station ADD needs_restart TINYINT(1) NOT NULL'); } /** * @param Schema $schema */ public function down(Schema $schema): void { $this->addSql('ALTER TABLE station DROP needs_restart'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20161120032434.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
139
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20170516214120 extends AbstractMigration { /** * @param Schema $schema */ public function up(Schema $schema): void { $this->addSql('DROP INDEX update_idx ON listener'); $this->addSql('CREATE INDEX update_idx ON listener (listener_hash)'); } /** * @param Schema $schema */ public function down(Schema $schema): void { $this->addSql('DROP INDEX update_idx ON listener'); $this->addSql('CREATE INDEX update_idx ON listener (listener_uid, listener_ip)'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20170516214120.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
168
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20180206105454 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('CREATE TABLE api_keys (id VARCHAR(16) NOT NULL, user_id INT NOT NULL, verifier VARCHAR(128) NOT NULL, comment VARCHAR(255) DEFAULT NULL, INDEX IDX_9579321FA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); $this->addSql('ALTER TABLE api_keys ADD CONSTRAINT FK_9579321FA76ED395 FOREIGN KEY (user_id) REFERENCES users (uid) ON DELETE CASCADE'); } public function down(Schema $schema): void { $this->addSql('DROP TABLE api_keys'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20180206105454.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
208
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; final class Version20201222063647 extends AbstractMigration { public function getDescription(): string { return 'Create a table for tracking unprocessed media.'; } public function up(Schema $schema): void { $this->addSql( 'CREATE TABLE unprocessable_media (id INT AUTO_INCREMENT NOT NULL, storage_location_id INT NOT NULL, path VARCHAR(500) DEFAULT NULL, mtime INT DEFAULT NULL, error LONGTEXT DEFAULT NULL, INDEX IDX_DCB6B9EDCDDD8AF (storage_location_id), UNIQUE INDEX path_unique_idx (path, storage_location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_general_ci` ENGINE = InnoDB' ); $this->addSql( 'ALTER TABLE unprocessable_media ADD CONSTRAINT FK_DCB6B9EDCDDD8AF FOREIGN KEY (storage_location_id) REFERENCES storage_location (id) ON DELETE CASCADE' ); } public function down(Schema $schema): void { $this->addSql('DROP TABLE unprocessable_media'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20201222063647.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
254
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; final class Version20240619130956 extends AbstractMigration { public function getDescription(): string { return 'Migrate media metadata to an expandable field, pt. 1'; } public function up(Schema $schema): void { // Clean up records that won't comply with new field changes. $this->addSql(<<<'SQL' DELETE FROM station_media WHERE unique_id IS NULL OR mtime IS NULL OR length IS NULL SQL); $this->addSql(<<<'SQL' ALTER TABLE station_media ADD extra_metadata JSON DEFAULT NULL, DROP length_text, CHANGE length length NUMERIC(7, 2) NOT NULL, CHANGE mtime mtime INT NOT NULL, CHANGE unique_id unique_id VARCHAR(25) NOT NULL SQL); } public function down(Schema $schema): void { $this->addSql(<<<'SQL' ALTER TABLE station_media ADD length_text VARCHAR(10) DEFAULT NULL, DROP extra_metadata, CHANGE unique_id unique_id VARCHAR(25) DEFAULT NULL, CHANGE length length NUMERIC(7, 2) DEFAULT NULL, CHANGE mtime mtime INT DEFAULT NULL SQL); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20240619130956.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
296
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; final class Version20220421123900 extends AbstractMigration { public function getDescription(): string { return 'Fix nullability of extended Listener columns.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE listener CHANGE device_browser_family device_browser_family VARCHAR(150) DEFAULT NULL, CHANGE device_os_family device_os_family VARCHAR(150) DEFAULT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE listener CHANGE device_browser_family device_browser_family VARCHAR(150) NOT NULL, CHANGE device_os_family device_os_family VARCHAR(150) NOT NULL'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20220421123900.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
164
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Add reactivate_at to station_streamers table */ final class Version20181025232600 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('ALTER TABLE station ADD disconnect_deactivate_streamer INT DEFAULT 0'); $this->addSql('ALTER TABLE station_streamers ADD reactivate_at INT DEFAULT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_streamers DROP reactivate_at'); $this->addSql('ALTER TABLE station DROP disconnect_deactivate_streamer'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20181025232600.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
154
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20200402212036 extends AbstractMigration { public function getDescription(): string { return 'Make SongHistory-to-StationRequest a many-to-one relationship.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE song_history DROP INDEX UNIQ_2AD16164427EB8A5, ADD INDEX IDX_2AD16164427EB8A5 (request_id)'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE song_history DROP INDEX IDX_2AD16164427EB8A5, ADD UNIQUE INDEX UNIQ_2AD16164427EB8A5 (request_id)'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20200402212036.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
193
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20190315002523 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_playlists ADD is_jingle TINYINT(1) NOT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_playlists DROP is_jingle'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20190315002523.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
121
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20200310204315 extends AbstractMigration { public function getDescription(): string { return 'Track the current streamer for every song history event.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE song_history ADD streamer_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE song_history ADD CONSTRAINT FK_2AD1616425F432AD FOREIGN KEY (streamer_id) REFERENCES station_streamers (id) ON DELETE CASCADE'); $this->addSql('CREATE INDEX IDX_2AD1616425F432AD ON song_history (streamer_id)'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE song_history DROP FOREIGN KEY FK_2AD1616425F432AD'); $this->addSql('DROP INDEX IDX_2AD1616425F432AD ON song_history'); $this->addSql('ALTER TABLE song_history DROP streamer_id'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20200310204315.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
255
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20200130094654 extends AbstractMigration { public function getDescription(): string { return 'Create station_playlist_folders table.'; } public function up(Schema $schema): void { $this->addSql('CREATE TABLE station_playlist_folders (id INT AUTO_INCREMENT NOT NULL, station_id INT DEFAULT NULL, playlist_id INT DEFAULT NULL, path VARCHAR(255) NOT NULL, INDEX IDX_15190AE921BDB235 (station_id), INDEX IDX_15190AE96BBD148 (playlist_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_general_ci` ENGINE = InnoDB'); $this->addSql('ALTER TABLE station_playlist_folders ADD CONSTRAINT FK_15190AE921BDB235 FOREIGN KEY (station_id) REFERENCES station (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE station_playlist_folders ADD CONSTRAINT FK_15190AE96BBD148 FOREIGN KEY (playlist_id) REFERENCES station_playlists (id) ON DELETE CASCADE'); } public function down(Schema $schema): void { $this->addSql('DROP TABLE station_playlist_folders'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20200130094654.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
284
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; final class Version20240421094525 extends AbstractMigration { public function getDescription(): string { return 'Expand podcast database fields.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE podcast ADD branding_config JSON DEFAULT NULL'); $this->addSql( 'ALTER TABLE podcast_episode ADD season_number INT DEFAULT NULL, ADD episode_number INT DEFAULT NULL' ); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE podcast DROP branding_config'); $this->addSql('ALTER TABLE podcast_episode DROP season_number, DROP episode_number'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20240421094525.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
164
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20170510085226 extends AbstractMigration { /** * @param Schema $schema */ public function up(Schema $schema): void { $this->addSql('ALTER TABLE station DROP radio_base_dir'); } /** * @param Schema $schema */ public function down(Schema $schema): void { $this->addSql('ALTER TABLE station ADD radio_base_dir VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci'); } public function postdown(Schema $schema): void { foreach ($this->connection->fetchAllAssociative('SELECT * FROM station') as $station) { $this->connection->update( 'station', [ 'radio_base_dir' => str_replace('/media', '', $station['radio_media_dir']), ], [ 'id' => $station['id'], ] ); } } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20170510085226.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
236
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20161007021719 extends AbstractMigration { /** * @param Schema $schema */ public function up(Schema $schema): void { $this->addSql('ALTER TABLE users ADD theme VARCHAR(25) DEFAULT NULL'); } /** * @param Schema $schema */ public function down(Schema $schema): void { $this->addSql('ALTER TABLE users DROP theme'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20161007021719.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
135
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20180320070100 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_webhooks ADD name VARCHAR(100) DEFAULT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_webhooks DROP name'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20180320070100.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
115
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; final class Version20240519163701 extends AbstractMigration { public function getDescription(): string { return 'Expand media field lengths.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE song_history CHANGE text text VARCHAR(512) DEFAULT NULL, CHANGE artist artist VARCHAR(255) DEFAULT NULL, CHANGE title title VARCHAR(255) DEFAULT NULL'); $this->addSql('ALTER TABLE station_media CHANGE title title VARCHAR(255) DEFAULT NULL, CHANGE artist artist VARCHAR(255) DEFAULT NULL, CHANGE text text VARCHAR(512) DEFAULT NULL'); $this->addSql('ALTER TABLE station_queue CHANGE text text VARCHAR(512) DEFAULT NULL, CHANGE artist artist VARCHAR(255) DEFAULT NULL, CHANGE title title VARCHAR(255) DEFAULT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_media CHANGE text text VARCHAR(303) DEFAULT NULL, CHANGE artist artist VARCHAR(150) DEFAULT NULL, CHANGE title title VARCHAR(150) DEFAULT NULL'); $this->addSql('ALTER TABLE station_queue CHANGE text text VARCHAR(303) DEFAULT NULL, CHANGE artist artist VARCHAR(150) DEFAULT NULL, CHANGE title title VARCHAR(150) DEFAULT NULL'); $this->addSql('ALTER TABLE song_history CHANGE text text VARCHAR(303) DEFAULT NULL, CHANGE artist artist VARCHAR(150) DEFAULT NULL, CHANGE title title VARCHAR(150) DEFAULT NULL'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20240519163701.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
331
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20220221225704 extends AbstractMigration { public function getDescription(): string { return 'Add indices to station_queue to optimize performance.'; } public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->addSql('CREATE INDEX idx_played_status ON station_queue (is_played, timestamp_played)'); $this->addSql('CREATE INDEX idx_cued_status ON station_queue (sent_to_autodj, timestamp_cued)'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->addSql('DROP INDEX idx_played_status ON station_queue'); $this->addSql('DROP INDEX idx_cued_status ON station_queue'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20220221225704.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
222
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; use const PASSWORD_ARGON2ID; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20200129010322 extends AbstractMigration { public function getDescription(): string { return 'Deduplicate streamers and hash passwords for streamer accounts.'; } public function preUp(Schema $schema): void { // Deleting duplicate streamers to avoid constraint errors in subsequent update $streamers = $this->connection->fetchAllAssociative( 'SELECT * FROM station_streamers ORDER BY station_id, id ASC' ); $accounts = []; foreach ($streamers as $row) { $stationId = $row['station_id']; $username = $row['streamer_username']; if (isset($accounts[$stationId][$username])) { $this->connection->delete('station_streamers', ['id' => $row['id']]); } else { $accounts[$stationId][$username] = $username; } } } public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_streamers CHANGE streamer_password streamer_password VARCHAR(255) NOT NULL'); $this->addSql('CREATE UNIQUE INDEX username_unique_idx ON station_streamers (station_id, streamer_username)'); } public function postUp(Schema $schema): void { // Hash DJ passwords that are currently stored in plaintext. $streamers = $this->connection->fetchAllAssociative( 'SELECT * FROM station_streamers ORDER BY station_id, id ASC' ); foreach ($streamers as $row) { $this->connection->update('station_streamers', [ 'streamer_password' => password_hash($row['streamer_password'], PASSWORD_ARGON2ID), ], ['id' => $row['id']]); } } public function down(Schema $schema): void { $this->addSql('DROP INDEX username_unique_idx ON station_streamers'); $this->addSql('ALTER TABLE station_streamers CHANGE streamer_password streamer_password VARCHAR(50) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_general_ci`'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20200129010322.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
496
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20171104014701 extends AbstractMigration { /** * @param Schema $schema */ public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_media ADD unique_id VARCHAR(25) DEFAULT NULL'); } public function postup(Schema $schema): void { foreach ($this->connection->fetchAllAssociative('SELECT * FROM station_media') as $record) { $this->connection->update( 'station_media', [ 'unique_id' => bin2hex(random_bytes(12)), ], [ 'id' => $record['id'], ] ); } } /** * @param Schema $schema */ public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_media DROP unique_id'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20171104014701.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
225
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20200604075356 extends AbstractMigration { public function getDescription(): string { return 'Add per-playlist "avoid duplicates" flag.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_playlists ADD avoid_duplicates TINYINT(1) NOT NULL'); } public function postUp(Schema $schema): void { $this->connection->executeStatement('UPDATE station_playlists SET avoid_duplicates=1'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_playlists DROP avoid_duplicates'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20200604075356.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
178
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use App\Entity\Attributes\StableMigration; use Doctrine\DBAL\Schema\Schema; #[StableMigration('0.17.2')] final class Version20220626171758 extends AbstractMigration { public function getDescription(): string { return 'Add HLS stream relation to listener table.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE listener ADD hls_stream_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE listener ADD CONSTRAINT FK_959C34226FE7D59F FOREIGN KEY (hls_stream_id) REFERENCES station_hls_streams (id) ON DELETE SET NULL' ); $this->addSql('CREATE INDEX IDX_959C34226FE7D59F ON listener (hls_stream_id)'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE listener DROP FOREIGN KEY FK_959C34226FE7D59F'); $this->addSql('DROP INDEX IDX_959C34226FE7D59F ON listener'); $this->addSql('ALTER TABLE listener DROP hls_stream_id'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20220626171758.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
268
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20190326051220 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_playlists ADD play_per_hour_minute SMALLINT NOT NULL, ADD interrupt_other_songs TINYINT(1) NOT NULL, ADD loop_playlist_once TINYINT(1) NOT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_playlists DROP play_per_hour_minute, DROP interrupt_other_songs, DROP loop_playlist_once'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20190326051220.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
157
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; final class Version20210801020848 extends AbstractMigration { public function getDescription(): string { return 'Add intro file support to station mounts.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_mounts ADD intro_path VARCHAR(255) DEFAULT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_mounts DROP intro_path'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20210801020848.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
126
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20210512225946 extends AbstractMigration { public function getDescription(): string { return 'Initial Podcast table setup.'; } public function up(Schema $schema): void { $this->addSql( 'CREATE TABLE podcast (id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', storage_location_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, link VARCHAR(255) DEFAULT NULL, description LONGTEXT NOT NULL, language VARCHAR(2) NOT NULL, art_updated_at INT NOT NULL, INDEX IDX_D7E805BDCDDD8AF (storage_location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_general_ci` ENGINE = InnoDB' ); $this->addSql( 'CREATE TABLE podcast_category (id INT AUTO_INCREMENT NOT NULL, podcast_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:guid)\', category VARCHAR(255) NOT NULL, INDEX IDX_E633B1E8786136AB (podcast_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_general_ci` ENGINE = InnoDB' ); $this->addSql( 'CREATE TABLE podcast_episode (id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', podcast_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:guid)\', title VARCHAR(255) NOT NULL, link VARCHAR(255) DEFAULT NULL, description LONGTEXT NOT NULL, publish_at INT DEFAULT NULL, explicit TINYINT(1) NOT NULL, created_at INT NOT NULL, art_updated_at INT NOT NULL, INDEX IDX_77EB2BD0786136AB (podcast_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_general_ci` ENGINE = InnoDB' ); $this->addSql( 'CREATE TABLE podcast_media (id CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', storage_location_id INT DEFAULT NULL, episode_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:guid)\', original_name VARCHAR(200) NOT NULL, length NUMERIC(7, 2) NOT NULL, length_text VARCHAR(10) NOT NULL, path VARCHAR(500) NOT NULL, mime_type VARCHAR(255) NOT NULL, modified_time INT NOT NULL, art_updated_at INT NOT NULL, INDEX IDX_15AD8829CDDD8AF (storage_location_id), UNIQUE INDEX UNIQ_15AD8829362B62A0 (episode_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_general_ci` ENGINE = InnoDB' ); $this->addSql( 'ALTER TABLE podcast ADD CONSTRAINT FK_D7E805BDCDDD8AF FOREIGN KEY (storage_location_id) REFERENCES storage_location (id) ON DELETE CASCADE' ); $this->addSql( 'ALTER TABLE podcast_category ADD CONSTRAINT FK_E633B1E8786136AB FOREIGN KEY (podcast_id) REFERENCES podcast (id) ON DELETE CASCADE' ); $this->addSql( 'ALTER TABLE podcast_episode ADD CONSTRAINT FK_77EB2BD0786136AB FOREIGN KEY (podcast_id) REFERENCES podcast (id) ON DELETE CASCADE' ); $this->addSql( 'ALTER TABLE podcast_media ADD CONSTRAINT FK_15AD8829CDDD8AF FOREIGN KEY (storage_location_id) REFERENCES storage_location (id) ON DELETE CASCADE' ); $this->addSql( 'ALTER TABLE podcast_media ADD CONSTRAINT FK_15AD8829362B62A0 FOREIGN KEY (episode_id) REFERENCES podcast_episode (id) ON DELETE SET NULL' ); $this->addSql('ALTER TABLE station ADD podcasts_storage_location_id INT DEFAULT NULL'); $this->addSql( 'ALTER TABLE station ADD CONSTRAINT FK_9F39F8B123303CD0 FOREIGN KEY (podcasts_storage_location_id) REFERENCES storage_location (id) ON DELETE SET NULL' ); $this->addSql('CREATE INDEX IDX_9F39F8B123303CD0 ON station (podcasts_storage_location_id)'); } public function postUp(Schema $schema): void { $stations = $this->connection->fetchAllAssociative( 'SELECT id, radio_base_dir FROM station WHERE podcasts_storage_location_id IS NULL ORDER BY id ASC' ); foreach ($stations as $row) { $stationId = $row['id']; $baseDir = $row['radio_base_dir']; $this->connection->insert( 'storage_location', [ 'type' => 'station_podcasts', 'adapter' => 'local', 'path' => $baseDir . '/podcasts', 'storage_quota' => null, ] ); $podcastsStorageLocationId = $this->connection->lastInsertId(); $this->connection->update( 'station', [ 'podcasts_storage_location_id' => $podcastsStorageLocationId, ], [ 'id' => $stationId, ] ); } } public function down(Schema $schema): void { $this->addSql('ALTER TABLE podcast_category DROP FOREIGN KEY FK_E633B1E8786136AB'); $this->addSql('ALTER TABLE podcast_episode DROP FOREIGN KEY FK_77EB2BD0786136AB'); $this->addSql('ALTER TABLE podcast_media DROP FOREIGN KEY FK_15AD8829362B62A0'); $this->addSql('DROP TABLE podcast'); $this->addSql('DROP TABLE podcast_category'); $this->addSql('DROP TABLE podcast_episode'); $this->addSql('DROP TABLE podcast_media'); $this->addSql('ALTER TABLE station DROP FOREIGN KEY FK_9F39F8B123303CD0'); $this->addSql('DROP INDEX IDX_9F39F8B123303CD0 ON station'); $this->addSql('ALTER TABLE station DROP podcasts_storage_location_id'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20210512225946.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,341
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20170917175534 extends AbstractMigration { /** * @param Schema $schema */ public function up(Schema $schema): void { $this->addSql('ALTER TABLE station ADD enable_public_page TINYINT(1) NOT NULL'); $this->addSql('UPDATE station SET enable_public_page=1'); } /** * @param Schema $schema */ public function down(Schema $schema): void { $this->addSql('ALTER TABLE station DROP enable_public_page'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20170917175534.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
157
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20170829030442 extends AbstractMigration { /** * @param Schema $schema */ public function up(Schema $schema): void { $this->changeCharset('utf8mb4', 'utf8mb4_unicode_ci'); } private function changeCharset(string $charset, string $collate): void { $dbName = $this->connection->getDatabase() ?? 'azuracast'; $sqlLines = [ 'ALTER TABLE listener CHANGE listener_user_agent listener_user_agent VARCHAR(255) NOT NULL', 'ALTER TABLE station CHANGE url url VARCHAR(255) DEFAULT NULL, CHANGE radio_base_dir radio_base_dir VARCHAR(255) DEFAULT NULL, CHANGE radio_media_dir radio_media_dir VARCHAR(255) DEFAULT NULL', 'ALTER TABLE station_media CHANGE path path VARCHAR(255) DEFAULT NULL', 'ALTER TABLE station_mounts CHANGE relay_url relay_url VARCHAR(255) DEFAULT NULL, CHANGE authhash authhash VARCHAR(255) DEFAULT NULL', 'ALTER TABLE users CHANGE auth_password auth_password VARCHAR(255) DEFAULT NULL', 'ALTER TABLE app_migrations CHANGE version version VARCHAR(191) NOT NULL', 'ALTER DATABASE ' . $this->connection->quoteIdentifier($dbName) . ' CHARACTER SET = ' . $charset . ' COLLATE = ' . $collate, 'ALTER TABLE `song_history` DROP FOREIGN KEY FK_2AD16164A0BDB2F3', 'ALTER TABLE `station_media` DROP FOREIGN KEY FK_32AADE3AA0BDB2F3', 'ALTER TABLE `analytics` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `api_keys` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `app_migrations` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `listener` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `role` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `role_permissions` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `settings` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `song_history` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `songs` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `station` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `station_media` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `station_mounts` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `station_playlist_has_media` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `station_playlists` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `station_requests` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `station_streamers` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `user_has_role` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `users` CONVERT TO CHARACTER SET ' . $charset . ' COLLATE ' . $collate, 'ALTER TABLE `song_history` ADD CONSTRAINT FK_2AD16164A0BDB2F3 FOREIGN KEY (song_id) REFERENCES songs (id) ON DELETE CASCADE', 'ALTER TABLE `station_media` ADD CONSTRAINT FK_32AADE3AA0BDB2F3 FOREIGN KEY (song_id) REFERENCES songs (id) ON DELETE SET NULL', ]; foreach ($sqlLines as $sql) { $this->addSql($sql); } } /** * @param Schema $schema */ public function down(Schema $schema): void { $this->changeCharset('utf8', 'utf8_unicode_ci'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20170829030442.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
981
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20200217114139 extends AbstractMigration { public function getDescription(): string { return 'Add ability to limit streamer connection times to their scheduled times.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_streamers ADD enforce_schedule TINYINT(1) NOT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_streamers DROP enforce_schedule'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20200217114139.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
146
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20201003021913 extends AbstractMigration { public function getDescription(): string { return 'Songs denormalization, part 1'; } public function up(Schema $schema): void { // Handling potentially failed updates. //$this->addSql('ALTER TABLE song_history DROP COLUMN `text`, DROP COLUMN `artist`, DROP COLUMN `title`'); // Avoid "data truncated" errors with really long titles/artists. $this->addSql('UPDATE station_media SET artist=SUBSTRING(artist, 1, 150), title=SUBSTRING(title, 1, 150)'); $this->addSql('ALTER TABLE song_history ADD `text` VARCHAR(150) DEFAULT NULL, ADD artist VARCHAR(150) DEFAULT NULL, ADD title VARCHAR(150) DEFAULT NULL'); $this->addSql('ALTER TABLE station_media ADD `text` VARCHAR(150) DEFAULT NULL, CHANGE title title VARCHAR(150) DEFAULT NULL, CHANGE artist artist VARCHAR(150) DEFAULT NULL'); $this->addSql('ALTER TABLE station_queue ADD `text` VARCHAR(150) DEFAULT NULL, ADD artist VARCHAR(150) DEFAULT NULL, ADD title VARCHAR(150) DEFAULT NULL'); $this->addSql('UPDATE song_history sh JOIN songs s ON sh.song_id = s.id SET sh.text=s.text, sh.artist=s.artist, sh.title=s.title'); $this->addSql('UPDATE station_queue sq JOIN songs s ON sq.song_id = s.id SET sq.text=s.text, sq.artist=s.artist, sq.title=s.title'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->addSql('ALTER TABLE song_history DROP `text`, DROP artist, DROP title'); $this->addSql('ALTER TABLE station_media DROP `text`, CHANGE artist artist VARCHAR(200) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_general_ci`, CHANGE title title VARCHAR(200) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_general_ci`'); $this->addSql('ALTER TABLE station_queue DROP `text`, DROP artist, DROP title'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20201003021913.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
508
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; final class Version20220406121125 extends AbstractMigration { public function getDescription(): string { return 'Reduce size and improve performance of StationQueue table.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_queue DROP log'); } public function postUp(Schema $schema): void { $this->connection->executeQuery( <<<SQL DELETE FROM station_queue WHERE timestamp_played < (UNIX_TIMESTAMP() - (86400 * 14)) SQL ); $this->connection->executeQuery( <<<SQL OPTIMIZE TABLE station_queue SQL ); } public function down(Schema $schema): void { $this->addSql( 'ALTER TABLE station_queue ADD log LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_general_ci` COMMENT \'(DC2Type:json)\'' ); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20220406121125.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
233
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use App\Entity\Attributes\StableMigration; use Doctrine\DBAL\Schema\Schema; #[StableMigration('0.17.6')] final class Version20221110212745 extends AbstractMigration { public function getDescription(): string { return 'Migrate from NChan to static JSON for NP.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE settings CHANGE enable_websockets enable_static_nowplaying TINYINT(1) NOT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE settings CHANGE enable_static_nowplaying enable_websockets TINYINT(1) NOT NULL'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20221110212745.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
166
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; final class Version20220706235608 extends AbstractMigration { public function getDescription(): string { return 'Add "is_visible" denormalization to song_history table.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE song_history ADD is_visible TINYINT(1) NOT NULL'); $this->addSql('CREATE INDEX idx_is_visible ON song_history (is_visible)'); $this->addSql('UPDATE song_history SET is_visible=1'); } public function down(Schema $schema): void { $this->addSql('DROP INDEX idx_is_visible ON song_history'); $this->addSql('ALTER TABLE song_history DROP is_visible'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20220706235608.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
183
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20190324040155 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_remotes ADD display_name VARCHAR(255) DEFAULT NULL, ADD is_visible_on_public_pages TINYINT(1) NOT NULL'); $this->addSql('ALTER TABLE station_mounts ADD display_name VARCHAR(255) DEFAULT NULL, ADD is_visible_on_public_pages TINYINT(1) NOT NULL'); $this->addSql('UPDATE station_remotes SET is_visible_on_public_pages=1'); $this->addSql('UPDATE station_mounts SET is_visible_on_public_pages=1'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_mounts DROP display_name, DROP is_visible_on_public_pages'); $this->addSql('ALTER TABLE station_remotes DROP display_name, DROP is_visible_on_public_pages'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20190324040155.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
239
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; final class Version20201208185538 extends AbstractMigration { public function getDescription(): string { return 'Add Dropbox support to Storage Locations.'; } public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->addSql('ALTER TABLE api_keys CHANGE user_id user_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE storage_location ADD dropbox_auth_token VARCHAR(255) DEFAULT NULL'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->addSql('ALTER TABLE api_keys CHANGE user_id user_id INT NOT NULL'); $this->addSql('ALTER TABLE storage_location DROP dropbox_auth_token'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20201208185538.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
201
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20200127071620 extends AbstractMigration { public function getDescription(): string { return 'Add new "station_streamer_broadcasts" table to track streamer historical broadcasts.'; } public function up(Schema $schema): void { $this->addSql('CREATE TABLE station_streamer_broadcasts (id INT AUTO_INCREMENT NOT NULL, station_id INT DEFAULT NULL, streamer_id INT DEFAULT NULL, timestamp_start INT NOT NULL, timestamp_end INT NOT NULL, recording_path VARCHAR(255) DEFAULT NULL, INDEX IDX_76169D6621BDB235 (station_id), INDEX IDX_76169D6625F432AD (streamer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_general_ci` ENGINE = InnoDB'); $this->addSql('ALTER TABLE station_streamer_broadcasts ADD CONSTRAINT FK_76169D6621BDB235 FOREIGN KEY (station_id) REFERENCES station (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE station_streamer_broadcasts ADD CONSTRAINT FK_76169D6625F432AD FOREIGN KEY (streamer_id) REFERENCES station_streamers (id) ON DELETE CASCADE'); } public function down(Schema $schema): void { $this->addSql('DROP TABLE station_streamer_broadcasts'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20200127071620.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
323
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; final class Version20201010170333 extends AbstractMigration { public function getDescription(): string { return 'Add genre field as a first-class meta field for Station Media.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_media ADD genre varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_media DROP genre'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20201010170333.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
133
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; final class Version20211124165404 extends AbstractMigration { public function getDescription(): string { return 'Add "timestamp_played" to queue items.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_queue ADD timestamp_played INT NOT NULL'); } public function postUp(Schema $schema): void { $this->connection->executeQuery( 'UPDATE station_queue SET timestamp_played=timestamp_cued WHERE timestamp_played IS NULL' ); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_queue DROP timestamp_played'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20211124165404.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
172
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20210226053617 extends AbstractMigration { public function getDescription(): string { return 'Create the user login token table.'; } public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->addSql('CREATE TABLE user_login_tokens (id VARCHAR(16) NOT NULL, user_id INT DEFAULT NULL, created_at INT NOT NULL, verifier VARCHAR(128) NOT NULL, INDEX IDX_DDF24A16A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_general_ci` ENGINE = InnoDB'); $this->addSql('ALTER TABLE user_login_tokens ADD CONSTRAINT FK_DDF24A16A76ED395 FOREIGN KEY (user_id) REFERENCES users (uid) ON DELETE CASCADE'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->addSql('DROP TABLE user_login_tokens'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20210226053617.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
268
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20210416214621 extends AbstractMigration { public function getDescription(): string { return 'Move playlist queue to station_playlist_media table.'; } public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->addSql('ALTER TABLE station_playlist_media ADD is_queued TINYINT(1) NOT NULL'); $this->addSql('ALTER TABLE station_playlists DROP queue'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->addSql('ALTER TABLE station_playlist_media DROP is_queued'); $this->addSql('ALTER TABLE station_playlists ADD queue LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_general_ci` COMMENT \'(DC2Type:array)\''); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20210416214621.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
238
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20200927004829 extends AbstractMigration { public function getDescription(): string { return 'Drop Message Queue table.'; } public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->addSql('DROP TABLE messenger_messages'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_general_ci`, headers LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_general_ci`, queue_name VARCHAR(190) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_general_ci`, created_at DATETIME NOT NULL, available_at DATETIME NOT NULL, delivered_at DATETIME DEFAULT NULL, INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20200927004829.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
327
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20200503005148 extends AbstractMigration { public function getDescription(): string { return 'Add per-station default album art.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE station ADD default_album_art_url VARCHAR(255) DEFAULT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station DROP default_album_art_url'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20200503005148.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
139
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20200321174535 extends AbstractMigration { public function getDescription(): string { return 'Add "skip_delay" field to station requests.'; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_requests ADD skip_delay TINYINT(1) NOT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_requests DROP skip_delay'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20200321174535.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
141
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Add source_port, source_mount to station_remotes table */ final class Version20180909174026 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('ALTER TABLE station_remotes ADD source_port SMALLINT DEFAULT NULL, ADD source_mount VARCHAR(150) DEFAULT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station_remotes DROP source_port, DROP source_mount'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20180909174026.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
131
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use App\Entity\Migration\Traits\UpdateAllRecords; use Doctrine\DBAL\Schema\Schema; /** * Add per-station-configurable number of history items to be shown in the NowPlaying API. */ final class Version20180818223558 extends AbstractMigration { use UpdateAllRecords; public function up(Schema $schema): void { $this->addSql('ALTER TABLE station ADD api_history_items SMALLINT NOT NULL'); } public function postup(Schema $schema): void { $this->updateAllRecords('station', [ 'api_history_items' => 5, ]); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station DROP api_history_items'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20180818223558.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
176
```php <?php declare(strict_types=1); namespace App\Entity\Migration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ final class Version20180203214656 extends AbstractMigration { public function up(Schema $schema): void { $this->addSql('ALTER TABLE station ADD is_streamer_live TINYINT(1) NOT NULL'); } public function down(Schema $schema): void { $this->addSql('ALTER TABLE station DROP is_streamer_live'); } } ```
/content/code_sandbox/backend/src/Entity/Migration/Version20180203214656.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
119
```php <?php declare(strict_types=1); namespace App\Entity\Migration\Traits; use Doctrine\DBAL\ArrayParameterType; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Exception; use Doctrine\DBAL\ParameterType; /** * @phpstan-type Param ParameterType|ArrayParameterType|string */ trait UpdateAllRecords { /** @var Connection */ protected $connection; /** * Executes an SQL UPDATE statement on a table. * * Table expression and columns are not escaped and are not safe for user-input. * * @param string $table Table name * @param array<string, mixed> $data Column-value pairs * @param array<Param> $types Parameter types * * @return int|string The number of affected rows. * * @throws Exception */ public function updateAllRecords( string $table, array $data, array $types = [] ): int|string { $columns = $values = $set = []; foreach ($data as $columnName => $value) { $columns[] = $columnName; $values[] = $value; $set[] = $columnName . ' = ?'; } if (is_string(key($types))) { $types = $this->extractTypeValues($columns, $types); } $sql = 'UPDATE ' . $table . ' SET ' . implode(', ', $set); return $this->connection->executeStatement($sql, $values, $types); } /** * Extract ordered type list from an ordered column list and type map. * * * * @param array<int, string> $columnList * @param array<Param> $types * * @return array<Param> */ private function extractTypeValues(array $columnList, array $types): array { $typeValues = []; foreach ($columnList as $columnName) { $typeValues[] = $types[$columnName] ?? ParameterType::STRING; } return $typeValues; } } ```
/content/code_sandbox/backend/src/Entity/Migration/Traits/UpdateAllRecords.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
446
```php <?php declare(strict_types=1); namespace App\Entity\Traits; trait TruncateStrings { protected function truncateNullableString(?string $string = null, int $length = 255): ?string { if ($string === null) { return null; } return $this->truncateString($string, $length); } protected function truncateString(string $string, int $length = 255): string { return mb_substr($string, 0, $length, 'UTF-8'); } } ```
/content/code_sandbox/backend/src/Entity/Traits/TruncateStrings.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
116
```php <?php declare(strict_types=1); namespace App\Entity\Traits; use App\Entity\Attributes\AuditIgnore; use App\Entity\Interfaces\EntityGroupsInterface; use App\Security\SplitToken; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; trait HasSplitTokenFields { #[ORM\Column(length: 16)] #[ORM\Id] #[Groups([ EntityGroupsInterface::GROUP_ID, EntityGroupsInterface::GROUP_ALL, ])] protected string $id; #[ORM\Column(length: 128)] #[AuditIgnore] protected string $verifier; protected function setFromToken(SplitToken $token): void { $this->id = $token->identifier; $this->verifier = $token->hashVerifier(); } public function getId(): string { return $this->id; } public function getIdRequired(): string { return $this->id; } public function verify(SplitToken $userSuppliedToken): bool { return $userSuppliedToken->verify($this->verifier); } } ```
/content/code_sandbox/backend/src/Entity/Traits/HasSplitTokenFields.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
241
```php <?php declare(strict_types=1); namespace App\Entity\Traits; use App\Entity\Interfaces\EntityGroupsInterface; use App\Entity\Interfaces\SongInterface; use App\Entity\Song; use Doctrine\ORM\Mapping as ORM; use OpenApi\Attributes as OA; use Symfony\Component\Serializer\Annotation\Groups; #[OA\Schema(type: 'object')] trait HasSongFields { use TruncateStrings; #[ OA\Property, ORM\Column(length: 50), Groups([EntityGroupsInterface::GROUP_GENERAL, EntityGroupsInterface::GROUP_ALL]) ] protected string $song_id; #[ OA\Property, ORM\Column(length: 512, nullable: true), Groups([EntityGroupsInterface::GROUP_GENERAL, EntityGroupsInterface::GROUP_ALL]) ] protected ?string $text = null; #[ OA\Property, ORM\Column(length: 255, nullable: true), Groups([EntityGroupsInterface::GROUP_GENERAL, EntityGroupsInterface::GROUP_ALL]) ] protected ?string $artist = null; #[ OA\Property, ORM\Column(length: 255, nullable: true), Groups([EntityGroupsInterface::GROUP_GENERAL, EntityGroupsInterface::GROUP_ALL]) ] protected ?string $title = null; public function setSong(SongInterface $song): void { $this->title = $this->truncateNullableString($song->getTitle(), 303); $this->artist = $this->truncateNullableString($song->getArtist(), 150); $this->text = $this->truncateNullableString($song->getText(), 150); // Force setting the text field if it's not otherwise set. $this->setText($this->getText()); $this->updateSongId(); } public function getSongId(): string { return $this->song_id; } protected function setSongId(string $songId): void { $this->song_id = $songId; } public function updateSongId(): void { $text = $this->getText(); $this->song_id = !empty($text) ? Song::getSongHash($text) : Song::OFFLINE_SONG_ID; } public function getText(): ?string { return $this->text ?? ($this->artist . ' - ' . $this->title); } protected function setTextFromArtistAndTitle(string $separator = ' - '): void { $this->setText($this->artist . $separator . $this->title); } public function setText(?string $text): void { $oldText = $this->text; $this->text = $this->truncateNullableString($text, 512); if (0 !== strcmp($oldText ?? '', $this->text ?? '')) { $this->updateSongId(); } } public function getArtist(): ?string { return $this->artist; } public function setArtist(?string $artist): void { $oldArtist = $this->artist; $this->artist = $this->truncateNullableString($artist); if (0 !== strcmp($oldArtist ?? '', $this->artist ?? '')) { $this->setTextFromArtistAndTitle(); } } public function getTitle(): ?string { return $this->title; } public function setTitle(?string $title): void { $oldTitle = $this->title; $this->title = $this->truncateNullableString($title); if (0 !== strcmp($oldTitle ?? '', $this->title ?? '')) { $this->setTextFromArtistAndTitle(); } } } ```
/content/code_sandbox/backend/src/Entity/Traits/HasSongFields.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
810
```php <?php declare(strict_types=1); namespace App\Entity\Traits; use App\Entity\Interfaces\EntityGroupsInterface; use Doctrine\ORM\Mapping as ORM; use OpenApi\Attributes as OA; use RuntimeException; use Symfony\Component\Serializer\Annotation\Groups; #[OA\Schema(type: 'object')] trait HasAutoIncrementId { #[ OA\Property, ORM\Column(nullable: false), ORM\Id, ORM\GeneratedValue, Groups([EntityGroupsInterface::GROUP_ID, EntityGroupsInterface::GROUP_ALL]) ] protected ?int $id = null; public function getId(): ?int { return $this->id; } public function getIdRequired(): int { if (null === $this->id) { throw new RuntimeException('An ID was not generated for this object.'); } return $this->id; } } ```
/content/code_sandbox/backend/src/Entity/Traits/HasAutoIncrementId.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
183
```php <?php declare(strict_types=1); namespace App\Entity\Traits; trait TruncateInts { protected function truncateSmallInt(int $int, bool $unsigned = false): int { return $this->truncateIntToLimit(32767, 65535, $unsigned, $int); } protected function truncateNullableSmallInt(?int $int = null, bool $unsigned = false): ?int { if (null === $int) { return null; } return $this->truncateSmallInt($int, $unsigned); } protected function truncateTinyInt(int $int, bool $unsigned = false): int { return $this->truncateIntToLimit(127, 255, $unsigned, $int); } protected function truncateNullableTinyInt(?int $int = null, bool $unsigned = false): ?int { if (null === $int) { return null; } return $this->truncateTinyInt($int, $unsigned); } protected function truncateInt(int $int, bool $unsigned = false): int { return $this->truncateIntToLimit(2147483647, 4294967295, $unsigned, $int); } protected function truncateNullableInt(?int $int = null, bool $unsigned = false): ?int { if (null === $int) { return null; } return $this->truncateInt($int, $unsigned); } protected function truncateIntToLimit( int $signedLimit, int $unsignedLimit, bool $unsigned, int $int ): int { $lowerLimit = $unsigned ? 0 : 0 - $signedLimit; $upperLimit = $unsigned ? $unsignedLimit : $signedLimit; if ($int < $lowerLimit) { return $lowerLimit; } if ($int > $upperLimit) { return $upperLimit; } return $int; } } ```
/content/code_sandbox/backend/src/Entity/Traits/TruncateInts.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
436
```php <?php declare(strict_types=1); namespace App\Entity\Traits; use App\Doctrine\Generator\UuidV6Generator; use App\Entity\Interfaces\EntityGroupsInterface; use Doctrine\ORM\Mapping as ORM; use OpenApi\Attributes as OA; use RuntimeException; use Symfony\Component\Serializer\Annotation\Groups; #[OA\Schema(type: 'object')] trait HasUniqueId { #[ OA\Property, ORM\Column(type: 'guid', unique: true, nullable: false), ORM\Id, ORM\GeneratedValue(strategy: 'CUSTOM'), ORM\CustomIdGenerator(UuidV6Generator::class), Groups([EntityGroupsInterface::GROUP_ID, EntityGroupsInterface::GROUP_ALL]) ] protected ?string $id = null; public function getId(): ?string { return $this->id; } public function getIdRequired(): string { if (null === $this->id) { throw new RuntimeException('An ID was not generated for this object.'); } return $this->id; } } ```
/content/code_sandbox/backend/src/Entity/Traits/HasUniqueId.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
217
```php <?php declare(strict_types=1); namespace App\Entity\Api; use ArrayAccess; use JsonSerializable; use LogicException; /** * A utility class ensuring that JSON will correctly represent * associative arrays (hashmaps) in responses as objects, * even when empty. * * @implements ArrayAccess<array-key, mixed> */ final readonly class HashMap implements JsonSerializable, ArrayAccess { public function __construct( private array $data = [] ) { } public function toArray(): array { return $this->data; } public function jsonSerialize(): mixed { return (0 !== count($this->data)) ? $this->data : (object)[]; } public function offsetExists(mixed $offset): bool { return isset($this->data[$offset]); } public function offsetGet(mixed $offset): mixed { return $this->data[$offset] ?? null; } public function offsetSet(mixed $offset, mixed $value): void { throw new LogicException('Data is read-only.'); } public function offsetUnset(mixed $offset): void { throw new LogicException('Data is read-only.'); } } ```
/content/code_sandbox/backend/src/Entity/Api/HashMap.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
267
```php <?php declare(strict_types=1); namespace App\Entity\Api; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_PodcastMedia', type: 'object' )] final class PodcastMedia { #[OA\Property] public ?string $id = null; #[OA\Property] public ?string $original_name = null; #[OA\Property] public float $length = 0.0; #[OA\Property] public ?string $length_text = null; #[OA\Property] public ?string $path = null; } ```
/content/code_sandbox/backend/src/Entity/Api/PodcastMedia.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
129
```php <?php declare(strict_types=1); namespace App\Entity\Api; final class MediaBatchResult extends BatchResult { /** @var string[] */ public array $files = []; /** @var string[] */ public array $directories = []; public ?array $responseRecord = null; /** * @return mixed[] */ public function jsonSerialize(): array { return [ ...parent::jsonSerialize(), 'files' => $this->files, 'directories' => $this->directories, 'record' => $this->responseRecord, ]; } } ```
/content/code_sandbox/backend/src/Entity/Api/MediaBatchResult.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
129
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Utilities\Types; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_ListenerDevice', type: 'object' )] final class ListenerDevice { #[OA\Property( description: 'If the listener device is likely a browser.', example: true )] public bool $is_browser; #[OA\Property( description: 'If the listener device is likely a mobile device.', example: true )] public bool $is_mobile; #[OA\Property( description: 'If the listener device is likely a crawler.', example: true )] public bool $is_bot; #[OA\Property( description: 'Summary of the listener client.', example: 'Firefox 121.0, Windows' )] public ?string $client = null; #[OA\Property( description: 'Summary of the listener browser family.', example: 'Firefox' )] public ?string $browser_family = null; #[OA\Property( description: 'Summary of the listener OS family.', example: 'Windows' )] public ?string $os_family = null; public static function fromArray(array $row): self { $api = new self(); $api->is_browser = Types::bool($row['is_browser'] ?? null); $api->is_mobile = Types::bool($row['is_mobile'] ?? null); $api->is_bot = Types::bool($row['is_bot'] ?? null); $api->client = Types::stringOrNull($row['client'] ?? null); $api->browser_family = Types::stringOrNull($row['browser_family'] ?? null); $api->os_family = Types::stringOrNull($row['os_family'] ?? null); return $api; } } ```
/content/code_sandbox/backend/src/Entity/Api/ListenerDevice.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
409
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\OpenApi; use App\Utilities\Types; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_Listener', type: 'object' )] final class Listener { #[OA\Property( description: 'The listener\'s IP address', example: '127.0.0.1' )] public string $ip; #[OA\Property( description: 'The listener\'s HTTP User-Agent', example: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)' . ' Chrome/59.0.3071.86 Safari/537.36' )] public string $user_agent = ''; #[OA\Property( description: 'A unique identifier for this listener/user agent (used for unique calculations).', example: '' )] public string $hash = ''; #[OA\Property( description: 'Whether the user is connected to a local mount point or a remote one.', example: false )] public bool $mount_is_local = false; #[OA\Property( description: 'The display name of the mount point.', example: '/radio.mp3' )] public string $mount_name = ''; #[OA\Property( description: 'UNIX timestamp that the user first connected.', example: OpenApi::SAMPLE_TIMESTAMP )] public int $connected_on; #[OA\Property( description: 'UNIX timestamp that the user disconnected (or the latest timestamp if they are still connected).', example: OpenApi::SAMPLE_TIMESTAMP )] public int $connected_until; #[OA\Property( description: 'Number of seconds that the user has been connected.', example: 30 )] public int $connected_time = 0; #[OA\Property( description: 'Device metadata, if available.', )] public ListenerDevice $device; #[OA\Property( description: 'Location metadata, if available.', )] public ListenerLocation $location; public static function fromArray(array $row): self { $api = new self(); $api->ip = Types::string($row['listener_ip'] ?? null); $api->user_agent = Types::string($row['listener_user_agent'] ?? null); $api->hash = Types::string($row['listener_hash'] ?? null); $api->connected_on = Types::int($row['timestamp_start'] ?? null); $api->connected_until = Types::int($row['timestamp_end'] ?? null); $api->connected_time = $api->connected_until - $api->connected_on; $device = []; $location = []; foreach ($row as $key => $val) { if (str_starts_with($key, 'device.')) { $device[str_replace('device.', '', $key)] = $val; } elseif (str_starts_with($key, 'location.')) { $location[str_replace('location.', '', $key)] = $val; } } $api->device = ListenerDevice::fromArray($device); $api->location = ListenerLocation::fromArray($location); return $api; } } ```
/content/code_sandbox/backend/src/Entity/Api/Listener.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
721
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\OpenApi; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_StationSchedule', type: 'object' )] final class StationSchedule { public const string TYPE_PLAYLIST = 'playlist'; public const string TYPE_STREAMER = 'streamer'; #[OA\Property( description: 'Unique identifier for this schedule entry.', example: 1 )] public int $id; #[OA\Property( description: 'The type of this schedule entry.', enum: [ StationSchedule::TYPE_PLAYLIST, StationSchedule::TYPE_STREAMER, ], example: StationSchedule::TYPE_PLAYLIST )] public string $type; #[OA\Property( description: 'Either the playlist or streamer\'s display name.', example: 'Example Schedule Entry' )] public string $name; #[OA\Property( description: 'The name of the event.', example: 'Example Schedule Entry' )] public string $title; #[OA\Property( description: 'The full name of the type and name combined.', example: 'Playlist: Example Schedule Entry' )] public string $description; #[OA\Property( description: 'The start time of the schedule entry, in UNIX format.', example: OpenApi::SAMPLE_TIMESTAMP )] public int $start_timestamp; #[OA\Property( description: 'The start time of the schedule entry, in ISO 8601 format.', example: '020-02-19T03:00:00-06:00' )] public string $start; #[OA\Property( description: 'The end time of the schedule entry, in UNIX format.', example: OpenApi::SAMPLE_TIMESTAMP )] public int $end_timestamp; #[OA\Property( description: 'The start time of the schedule entry, in ISO 8601 format.', example: '020-02-19T05:00:00-06:00' )] public string $end; #[OA\Property( description: 'Whether the event is currently ongoing.', example: true )] public bool $is_now; } ```
/content/code_sandbox/backend/src/Entity/Api/StationSchedule.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
491
```php <?php declare(strict_types=1); namespace App\Entity\Api; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_FileListDir', type: 'object' )] final class FileListDir { #[OA\Property(type: "array", items: new OA\Items())] public array $playlists = []; } ```
/content/code_sandbox/backend/src/Entity/Api/FileListDir.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
77
```php <?php declare(strict_types=1); namespace App\Entity\Api; use JsonSerializable; abstract class BatchResult implements JsonSerializable { public array $errors = []; /** * @return mixed[] */ public function jsonSerialize(): array { return [ 'success' => empty($this->errors), 'errors' => $this->errors, ]; } } ```
/content/code_sandbox/backend/src/Entity/Api/BatchResult.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
84
```php <?php declare(strict_types=1); namespace App\Entity\Api; use Carbon\CarbonImmutable; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_Time', type: 'object' )] final class Time { #[OA\Property( description: 'The current UNIX timestamp', example: 1497652397 )] public int $timestamp; #[OA\Property(example: '2017-06-16 10:33:17')] public string $utc_datetime; #[OA\Property(example: 'June 16, 2017')] public string $utc_date; #[OA\Property(example: '10:33pm')] public string $utc_time; #[OA\Property(example: '2012-12-25T16:30:00.000000Z')] public string $utc_json; public function __construct() { $now = CarbonImmutable::now('UTC'); $this->timestamp = $now->getTimestamp(); $this->utc_datetime = $now->format('Y-m-d g:i:s'); $this->utc_date = $now->format('F j, Y'); $this->utc_time = $now->format('g:ia'); $this->utc_json = $now->toJSON(); } } ```
/content/code_sandbox/backend/src/Entity/Api/Time.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
285
```php <?php declare(strict_types=1); namespace App\Entity\Api; use OpenApi\Attributes as OA; #[OA\Schema(schema: 'Api_Status', type: 'object')] class Status { #[OA\Property(example: true)] public bool $success; #[OA\Property(example: 'Changes saved successfully.')] public string $message; #[OA\Property(example: '<b>Changes saved successfully.</b>')] public string $formatted_message; public function __construct( bool $success = true, string $message = 'Changes saved successfully.', ?string $formattedMessage = null ) { $this->success = $success; $this->message = $message; $this->formatted_message = $formattedMessage ?? $message; } public static function success(): self { return new self(true, __('Changes saved successfully.')); } public static function created(): self { return new self(true, __('Record created successfully.')); } public static function updated(): self { return new self(true, __('Record updated successfully.')); } public static function deleted(): self { return new self(true, __('Record deleted successfully.')); } } ```
/content/code_sandbox/backend/src/Entity/Api/Status.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
261
```php <?php declare(strict_types=1); namespace App\Entity\Api; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_NewRecord', type: 'object' )] final class NewRecord extends Status { #[OA\Property( items: new OA\Items(type: 'string', example: 'path_to_url )] public array $links = []; } ```
/content/code_sandbox/backend/src/Entity/Api/NewRecord.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
85
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Entity\Api\NowPlaying\StationQueue; use App\Entity\Api\Traits\HasLinks; use App\Traits\LoadFromParentObject; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_StationQueueDetailed', type: 'object' )] final class StationQueueDetailed extends StationQueue { use LoadFromParentObject; use HasLinks; #[OA\Property( description: 'Indicates whether the song has been sent to the AutoDJ.', )] public bool $sent_to_autodj = false; #[OA\Property( description: 'Indicates whether the song has already been marked as played.', )] public bool $is_played = false; #[OA\Property( description: 'Custom AutoDJ playback URI, if it exists.', example: '' )] public ?string $autodj_custom_uri = null; #[OA\Property( description: 'Log entries on how the specific queue item was picked by the AutoDJ.', items: new OA\Items() )] public ?array $log = []; } ```
/content/code_sandbox/backend/src/Entity/Api/StationQueueDetailed.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
248
```php <?php declare(strict_types=1); namespace App\Entity\Api; use OpenApi\Attributes as OA; use Psr\Http\Message\UriInterface; #[OA\Schema( schema: 'Api_StationOnDemand', type: 'object' )] final class StationOnDemand implements ResolvableUrlInterface { #[OA\Property( description: 'Track ID unique identifier', example: 1 )] public string $track_id; #[OA\Property( description: 'URL to download/play track.', example: '/api/station/1/ondemand/download/1' )] public string $download_url; #[OA\Property] public Song $media; #[OA\Property] public string $playlist; /** * Re-resolve any Uri instances to reflect base URL changes. * * @param UriInterface $base */ public function resolveUrls(UriInterface $base): void { $this->media->resolveUrls($base); } } ```
/content/code_sandbox/backend/src/Entity/Api/StationOnDemand.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
216
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Utilities\File; use OpenApi\Attributes as OA; use Symfony\Component\Validator\Constraints as Assert; #[OA\Schema( schema: 'Api_UploadFile', type: 'object' )] final class UploadFile { #[ OA\Property( description: 'The destination path of the uploaded file.', example: 'relative/path/to/file.mp3' ), Assert\NotBlank ] public string $path; #[ OA\Property( description: 'The base64-encoded contents of the file to upload.', example: '' ), Assert\NotBlank ] public string $file; public function getSanitizedFilename(): string { return File::sanitizeFileName(basename($this->getPath())); } public function getSanitizedPath(): string { return File::sanitizePathPrefix($this->getPath()); } public function getPath(): string { return ltrim($this->path, '/'); } public function getFileContents(): string { return base64_decode($this->file); } } ```
/content/code_sandbox/backend/src/Entity/Api/UploadFile.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
249
```php <?php declare(strict_types=1); namespace App\Entity\Api; final class Notification { public string $title; public string $body; public string $type; public ?string $actionLabel; public ?string $actionUrl; } ```
/content/code_sandbox/backend/src/Entity/Api/Notification.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
55
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Utilities\Types; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_ListenerLocation', type: 'object' )] final class ListenerLocation { #[OA\Property( description: 'The approximate city of the listener.', example: 'Austin' )] public ?string $city = null; #[OA\Property( description: 'The approximate region/state of the listener.', example: 'Texas' )] public ?string $region = null; #[OA\Property( description: 'The approximate country of the listener.', example: 'United States' )] public ?string $country = null; #[OA\Property( description: 'A description of the location.', example: 'Austin, Texas, US' )] public string $description; #[OA\Property( description: 'Latitude.', example: '30.000000' )] public ?float $lat = null; #[OA\Property( description: 'Latitude.', example: '-97.000000' )] public ?float $lon = null; public static function fromArray(array $row): self { $api = new self(); $api->city = Types::stringOrNull($row['city'] ?? null); $api->region = Types::stringOrNull($row['region'] ?? null); $api->country = Types::stringOrNull($row['country'] ?? null); $api->description = Types::string($row['description'] ?? null); $api->lat = Types::floatOrNull($row['lat'] ?? null); $api->lon = Types::floatOrNull($row['lon'] ?? null); return $api; } } ```
/content/code_sandbox/backend/src/Entity/Api/ListenerLocation.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
394
```php <?php declare(strict_types=1); namespace App\Entity\Api; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_PodcastCategory', type: 'object' )] final class PodcastCategory { #[OA\Property] public string $category; #[OA\Property] public string $text; #[OA\Property] public string $title; #[OA\Property] public ?string $subtitle = null; } ```
/content/code_sandbox/backend/src/Entity/Api/PodcastCategory.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
101
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Entity\Api\Traits\HasLinks; use App\Entity\Enums\FileTypes; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_FileList', type: 'object' )] final class FileList { use HasLinks; #[OA\Property] public string $path; #[OA\Property] public string $path_short; #[OA\Property] public string $text = ''; #[OA\Property] public FileTypes $type = FileTypes::Other; #[OA\Property] public int $timestamp = 0; #[OA\Property] public ?int $size = null; #[OA\Property] public ?StationMedia $media = null; #[OA\Property] public ?FileListDir $dir = null; } ```
/content/code_sandbox/backend/src/Entity/Api/FileList.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
189
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\OpenApi; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_SystemStatus', type: 'object' )] final class SystemStatus { #[OA\Property( description: 'Whether the service is online or not (should always be true)', example: true )] public bool $online = true; #[OA\Property( description: 'The current UNIX timestamp', example: OpenApi::SAMPLE_TIMESTAMP )] public int $timestamp; public function __construct() { $this->timestamp = time(); } } ```
/content/code_sandbox/backend/src/Entity/Api/SystemStatus.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
143
```php <?php declare(strict_types=1); namespace App\Entity\Api; final class StationPlaylistImportResult extends Status { public array $import_results = []; public function __construct( bool $success = true, string $message = 'Changes saved successfully.', ?string $formattedMessage = null, array $importResults = [], ) { parent::__construct($success, $message, $formattedMessage); $this->import_results = $importResults; } } ```
/content/code_sandbox/backend/src/Entity/Api/StationPlaylistImportResult.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
103
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Entity\Api\Traits\HasLinks; use App\Entity\Api\Traits\HasSongFields; use App\Entity\StationPlaylist; use App\OpenApi; use App\Traits\LoadFromParentObject; use App\Utilities\Types; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_StationMedia', type: 'object' )] class StationMedia { use LoadFromParentObject; use HasSongFields; use HasLinks; #[OA\Property( description: 'The media\'s identifier.', example: 1 )] public int $id; #[OA\Property( description: "A unique identifier associated with this record.", example: "69b536afc7ebbf16457b8645" )] public string $unique_id = ''; #[OA\Property( description: 'The media file\'s 32-character unique song identifier hash', example: '9f33bbc912c19603e51be8e0987d076b' )] public string $song_id = ''; #[OA\Property( description: 'URL to the album art.', example: 'path_to_url )] public string $art = ''; #[OA\Property( description: "The relative path of the media file.", example: "test.mp3" )] public string $path; #[OA\Property( description: "The UNIX timestamp when the database was last modified.", example: OpenApi::SAMPLE_TIMESTAMP )] public int $mtime; #[OA\Property( description: "The UNIX timestamp when the item was first imported into the database.", example: OpenApi::SAMPLE_TIMESTAMP )] public int $uploaded_at; #[OA\Property( description: "The latest time (UNIX timestamp) when album art was updated.", example: OpenApi::SAMPLE_TIMESTAMP )] public int $art_updated_at = 0; #[OA\Property( description: "The song duration in seconds.", example: 240.00 )] public float $length = 0.0; #[OA\Property( description: "The formatted song duration (in mm:ss format)", example: "4:00" )] public string $length_text = '0:00'; #[OA\Property( type: 'array', items: new OA\Items(type: 'string', example: 'custom_field_value') )] public HashMap $custom_fields; #[OA\Property(type: "array", items: new OA\Items())] public HashMap $extra_metadata; #[OA\Property(type: "array", items: new OA\Items())] public array $playlists; public static function fromArray( array $row, array $extraMetadata = [], array $customFields = [], array $playlists = [] ): self { $media = new self(); $media->id = $row['id']; $media->unique_id = $row['unique_id']; $media->path = $row['path']; $media->song_id = $row['song_id']; $media->title = $row['title']; $media->artist = $row['artist']; $media->text = ($media->artist ?? '') . ' - ' . ($media->title ?? ''); $media->album = $row['album']; $media->genre = $row['genre']; $media->isrc = $row['isrc']; $media->length = Types::int($row['length']); $media->length_text = self::getLengthText($row['length']); $media->art_updated_at = $row['art_updated_at']; $media->mtime = Types::int($row['mtime'] ?? 0); $media->uploaded_at = Types::int($row['uploaded_at'] ?? 0); $media->extra_metadata = new HashMap($extraMetadata); $media->custom_fields = new HashMap($customFields); $media->playlists = $playlists; return $media; } public static function getLengthText(string|float $length): string { $lengthInt = (int)floor(Types::float($length)); $lengthMin = floor($lengthInt / 60); $lengthSec = $lengthInt % 60; return $lengthMin . ':' . str_pad((string)$lengthSec, 2, '0', STR_PAD_LEFT); } public static function aggregatePlaylists(array $rawPlaylists = []): array { $playlists = []; foreach ($rawPlaylists as $playlist) { $playlistId = $playlist['id']; if (isset($playlists[$playlistId])) { $playlists[$playlistId]['count']++; } else { $playlists[$playlistId] = [ 'id' => $playlistId, 'name' => $playlist['name'], 'short_name' => StationPlaylist::generateShortName($playlist['name']), 'count' => 1, ]; } } return array_values($playlists); } } ```
/content/code_sandbox/backend/src/Entity/Api/StationMedia.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,132
```php <?php declare(strict_types=1); namespace App\Entity\Api; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_StationServiceStatus', type: 'object' )] final class StationServiceStatus { #[OA\Property(example: true)] public bool $backend_running; #[OA\Property(example: true)] public bool $frontend_running; #[OA\Property(example: true)] public bool $station_has_started; #[OA\Property(example: true)] public bool $station_needs_restart; public function __construct( bool $backendRunning, bool $frontendRunning, bool $stationHasStarted, bool $stationNeedsRestart ) { $this->backend_running = $backendRunning; $this->frontend_running = $frontendRunning; $this->station_has_started = $stationHasStarted; $this->station_needs_restart = $stationNeedsRestart; } } ```
/content/code_sandbox/backend/src/Entity/Api/StationServiceStatus.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
205
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Entity\Api\NowPlaying\NowPlaying; use App\Entity\Api\Traits\HasLinks; use App\Traits\LoadFromParentObject; final class Dashboard extends NowPlaying { use LoadFromParentObject; use HasLinks; } ```
/content/code_sandbox/backend/src/Entity/Api/Dashboard.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
64
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Entity\Api\Traits\HasLinks; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_PodcastEpisode', type: 'object' )] final class PodcastEpisode { use HasLinks; #[OA\Property] public string $id; #[OA\Property] public string $title; #[OA\Property] public ?string $link = null; #[OA\Property] public string $description; #[OA\Property] public string $description_short; #[OA\Property] public bool $explicit = false; #[OA\Property] public ?int $season_number = null; #[OA\Property] public ?int $episode_number = null; #[OA\Property] public int $created_at; #[OA\Property] public int $publish_at; #[OA\Property] public bool $is_published = true; #[OA\Property] public bool $has_media = false; #[OA\Property] public ?string $playlist_media_id = null; #[OA\Property] public ?Song $playlist_media = null; #[OA\Property] public ?PodcastMedia $media = null; #[OA\Property] public bool $has_custom_art = false; #[OA\Property] public ?string $art = null; #[OA\Property] public int $art_updated_at = 0; } ```
/content/code_sandbox/backend/src/Entity/Api/PodcastEpisode.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
327
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Exception; use OpenApi\Attributes as OA; use ReflectionClass; use Throwable; #[OA\Schema( schema: 'Api_Error', type: 'object' )] final class Error { #[OA\Property( description: 'The numeric code of the error.', example: 500 )] public int $code; #[OA\Property( description: 'The programmatic class of error.', example: 'NotLoggedInException' )] public string $type; #[OA\Property( description: 'The text description of the error.', example: 'Error description.', )] public string $message; #[OA\Property( description: 'The HTML-formatted text description of the error.', example: '<b>Error description.</b><br>Detailed error text.' )] public ?string $formatted_message; #[OA\Property( description: 'Stack traces and other supplemental data.', items: new OA\Items() )] public array $extra_data; #[OA\Property( description: 'Used for API calls that expect an \Entity\Api\Status type response.', example: false )] public bool $success; public function __construct( int $code = 500, string $message = 'General Error', ?string $formattedMessage = null, array $extraData = [], string $type = 'Error' ) { $this->code = $code; $this->message = $message; $this->formatted_message = ($formattedMessage ?? $message); $this->extra_data = $extraData; $this->type = $type; $this->success = false; } public static function notFound(): self { return new self(404, __('Record not found')); } public static function fromFileError(int $fileError): self { $errorMessage = match ($fileError) { UPLOAD_ERR_INI_SIZE => __('The uploaded file exceeds the upload_max_filesize directive in php.ini.'), UPLOAD_ERR_FORM_SIZE => __('The uploaded file exceeds the MAX_FILE_SIZE directive from the HTML form.'), UPLOAD_ERR_PARTIAL => __('The uploaded file was only partially uploaded.'), UPLOAD_ERR_NO_FILE => __('No file was uploaded.'), UPLOAD_ERR_NO_TMP_DIR => __('No temporary directory is available.'), UPLOAD_ERR_CANT_WRITE => __('Could not write to filesystem.'), UPLOAD_ERR_EXTENSION => __('Upload halted by a PHP extension.'), default => __('Unspecified error.'), }; return new self(500, $errorMessage); } public static function fromException(Throwable $e, bool $includeTrace = false): self { $code = $e->getCode(); if (0 === $code) { $code = 500; } $className = (new ReflectionClass($e))->getShortName(); if ($e instanceof Exception) { $messageFormatted = $e->getFormattedMessage(); $extraData = $e->getExtraData(); } else { $messageFormatted = $e->getMessage(); $extraData = []; } $extraData['class'] = $className; $extraData['file'] = $e->getFile(); $extraData['line'] = $e->getLine(); if ($includeTrace) { $extraData['trace'] = $e->getTrace(); } return new self($code, $e->getMessage(), $messageFormatted, $extraData, $className); } } ```
/content/code_sandbox/backend/src/Entity/Api/Error.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
770
```php <?php declare(strict_types=1); namespace App\Entity\Api; use Psr\Http\Message\UriInterface; interface ResolvableUrlInterface { /** * Re-resolve any Uri instances to reflect base URL changes. * * @param UriInterface $base */ public function resolveUrls(UriInterface $base): void; } ```
/content/code_sandbox/backend/src/Entity/Api/ResolvableUrlInterface.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
72
```php <?php declare(strict_types=1); namespace App\Entity\Api; final class GenericBatchResult extends BatchResult { /** * @var array<array{ * id: int, * title: string * }> */ public array $records = []; /** * @return mixed[] */ public function jsonSerialize(): array { return [ ...parent::jsonSerialize(), 'records' => $this->records, ]; } } ```
/content/code_sandbox/backend/src/Entity/Api/GenericBatchResult.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
106
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Entity\Api\NowPlaying\SongHistory; use App\Traits\LoadFromParentObject; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_DetailedSongHistory', type: 'object' )] final class DetailedSongHistory extends SongHistory { use LoadFromParentObject; #[OA\Property( description: 'Number of listeners when the song playback started.', example: 94 )] public int $listeners_start = 0; #[OA\Property( description: 'Number of listeners when song playback ended.', example: 105 )] public int $listeners_end = 0; #[OA\Property( description: 'The sum total change of listeners between the song\'s start and ending.', example: 11 )] public int $delta_total = 0; #[OA\Property( description: 'Whether the entry is visible on public playlists.', example: true )] public bool $is_visible = true; } ```
/content/code_sandbox/backend/src/Entity/Api/DetailedSongHistory.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
233
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Entity\Api\Traits\HasLinks; use App\Entity\PodcastBrandingConfiguration; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_Podcast', type: 'object' )] final class Podcast { use HasLinks; #[OA\Property] public string $id; #[OA\Property] public int $storage_location_id; #[OA\Property] public string $source; #[OA\Property] public ?int $playlist_id = null; #[OA\Property] public bool $playlist_auto_publish = false; #[OA\Property] public string $title; #[OA\Property] public ?string $link = null; #[OA\Property] public string $description; #[OA\Property] public string $description_short; #[OA\Property] public bool $is_enabled = true; #[OA\Property( description: "An array containing podcast-specific branding configuration", type: "array", items: new OA\Items() )] public PodcastBrandingConfiguration $branding_config; #[OA\Property] public string $language; #[OA\Property] public string $language_name; #[OA\Property] public string $author; #[OA\Property] public string $email; #[OA\Property] public bool $has_custom_art = false; #[OA\Property] public string $art; #[OA\Property] public int $art_updated_at = 0; #[OA\Property] public bool $is_published = true; #[OA\Property] public int $episodes = 0; /** * @var PodcastCategory[] */ #[OA\Property( type: 'array', items: new OA\Items(type: PodcastCategory::class) )] public array $categories = []; } ```
/content/code_sandbox/backend/src/Entity/Api/Podcast.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
424
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Entity\Api\Traits\HasLinks; use App\Traits\LoadFromParentObject; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_StationRemote', type: 'object' )] final class StationRemote { use LoadFromParentObject; use HasLinks; #[OA\Property] public ?int $id = null; #[OA\Property(example: '128kbps MP3')] public ?string $display_name = null; #[OA\Property(example: true)] public bool $is_visible_on_public_pages = true; #[OA\Property(example: 'icecast')] public string $type; #[OA\Property(example: 'true')] public bool $is_editable = true; #[OA\Property(example: false)] public bool $enable_autodj = false; #[OA\Property(example: 'mp3')] public ?string $autodj_format = null; #[OA\Property(example: 128)] public ?int $autodj_bitrate = null; #[OA\Property(example: 'path_to_url public ?string $custom_listen_url = null; #[OA\Property(example: 'path_to_url public string $url = ''; #[OA\Property(example: '/stream.mp3')] public ?string $mount = null; #[OA\Property(example: 'password')] public ?string $admin_password = null; #[OA\Property(example: 8000)] public ?int $source_port = null; #[OA\Property(example: '/')] public ?string $source_mount = null; #[OA\Property(example: 'source')] public ?string $source_username = null; #[OA\Property(example: 'password')] public ?string $source_password = null; #[OA\Property(example: false)] public bool $is_public = false; #[OA\Property( description: 'The most recent number of unique listeners.', example: 10 )] public int $listeners_unique = 0; #[OA\Property( description: 'The most recent number of total (non-unique) listeners.', example: 12 )] public int $listeners_total = 0; } ```
/content/code_sandbox/backend/src/Entity/Api/StationRemote.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
500
```php <?php declare(strict_types=1); namespace App\Entity\Api; final class PodcastBatchResult extends BatchResult { /** * @var array<array{ * id: string, * title: string * }> */ public array $episodes = []; public ?array $records = null; /** * @return mixed[] */ public function jsonSerialize(): array { return [ ...parent::jsonSerialize(), 'episodes' => $this->episodes, 'records' => $this->records, ]; } } ```
/content/code_sandbox/backend/src/Entity/Api/PodcastBatchResult.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
128
```php <?php declare(strict_types=1); namespace App\Entity\Api; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_StationPlaylistQueue', type: 'object' )] final class StationPlaylistQueue { #[OA\Property( description: 'ID of the StationPlaylistMedia record associating this track with the playlist', example: 1 )] public ?int $spm_id = null; #[OA\Property( description: 'ID of the StationPlaylistMedia record associating this track with the playlist', example: 1 )] public int $media_id; #[OA\Property( description: 'The song\'s 32-character unique identifier hash', example: '9f33bbc912c19603e51be8e0987d076b' )] public string $song_id; #[OA\Property( description: 'The song artist.', example: 'Chet Porter' )] public string $artist = ''; #[OA\Property( description: 'The song title.', example: 'Aluko River' )] public string $title = ''; } ```
/content/code_sandbox/backend/src/Entity/Api/StationPlaylistQueue.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
250
```php <?php declare(strict_types=1); namespace App\Entity\Api; use OpenApi\Attributes as OA; use Psr\Http\Message\UriInterface; #[OA\Schema( schema: 'Api_StationRequest', type: 'object' )] final class StationRequest implements ResolvableUrlInterface { #[OA\Property( description: 'Requestable ID unique identifier', example: 1 )] public string $request_id; #[OA\Property( description: 'URL to directly submit request', example: '/api/station/1/request/1' )] public string $request_url; #[OA\Property] public Song $song; /** * Re-resolve any Uri instances to reflect base URL changes. * * @param UriInterface $base */ public function resolveUrls(UriInterface $base): void { $this->song->resolveUrls($base); } } ```
/content/code_sandbox/backend/src/Entity/Api/StationRequest.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
200
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Entity\Api\Traits\HasSongFields; use App\Http\Router; use OpenApi\Attributes as OA; use Psr\Http\Message\UriInterface; #[OA\Schema( schema: 'Api_Song', type: 'object' )] class Song implements ResolvableUrlInterface { use HasSongFields; #[OA\Property( description: 'The song\'s 32-character unique identifier hash', example: '9f33bbc912c19603e51be8e0987d076b' )] public string $id = ''; #[OA\Property( description: 'URL to the album artwork (if available).', example: 'path_to_url )] public string|UriInterface $art = ''; #[OA\Property( type: 'array', items: new OA\Items(type: 'string', example: 'custom_field_value') )] public array $custom_fields = []; /** * Re-resolve any Uri instances to reflect base URL changes. * * @param UriInterface $base */ public function resolveUrls(UriInterface $base): void { $this->art = (string)Router::resolveUri($base, $this->art, true); } } ```
/content/code_sandbox/backend/src/Entity/Api/Song.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
283
```php <?php declare(strict_types=1); namespace App\Entity\Api; use App\Entity\Api\NowPlaying\Station; use Psr\Http\Message\UriInterface; final class StationProfile { public Station $station; public StationServiceStatus $services; /** @var StationSchedule[] */ public array $schedule = []; /** * Iterate through sub-items and re-resolve any Uri instances to reflect base URL changes. */ public function resolveUrls(UriInterface $base): void { $this->station->resolveUrls($base); } } ```
/content/code_sandbox/backend/src/Entity/Api/StationProfile.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
119
```php <?php declare(strict_types=1); namespace App\Entity\Api\Traits; use OpenApi\Attributes as OA; #[OA\Schema(type: 'object')] trait HasLinks { #[OA\Property( type: 'object', additionalProperties: new OA\AdditionalProperties(type: 'string') )] public array $links = []; } ```
/content/code_sandbox/backend/src/Entity/Api/Traits/HasLinks.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
73
```php <?php declare(strict_types=1); namespace App\Entity\Api\Traits; use OpenApi\Attributes as OA; #[OA\Schema(schema: 'Api_HasSongFields', type: 'object')] trait HasSongFields { #[OA\Property( description: 'The song title, usually "Artist - Title"', example: 'Chet Porter - Aluko River' )] public string $text = ''; #[OA\Property( description: 'The song artist.', example: 'Chet Porter' )] public ?string $artist = ''; #[OA\Property( description: 'The song title.', example: 'Aluko River' )] public ?string $title = ''; #[OA\Property( description: 'The song album.', example: 'Moving Castle' )] public ?string $album = ''; #[OA\Property( description: 'The song genre.', example: 'Rock' )] public ?string $genre = ''; #[OA\Property( description: 'The International Standard Recording Code (ISRC) of the file.', example: 'US28E1600021' )] public ?string $isrc = ''; #[OA\Property( description: 'Lyrics to the song.', example: '' )] public ?string $lyrics = ''; } ```
/content/code_sandbox/backend/src/Entity/Api/Traits/HasSongFields.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
290
```php <?php declare(strict_types=1); namespace App\Entity\Api\Admin; use App\Entity\Api\Traits\HasLinks; use App\Traits\LoadFromParentObject; use OpenApi\Attributes as OA; #[OA\Schema( schema: 'Api_Admin_StorageLocation', type: 'object' )] final class StorageLocation { use HasLinks; use LoadFromParentObject; #[OA\Property(example: 1)] public int $id; #[OA\Property( description: 'The type of storage location.', example: 'station_media' )] public string $type; #[OA\Property( description: 'The storage adapter to use for this location.', example: 'local' )] public string $adapter; #[OA\Property( description: 'The local path, if the local adapter is used, or path prefix for S3/remote adapters.', example: '/var/azuracast/stations/azuratest_radio/media' )] public ?string $path = null; #[OA\Property( description: 'The credential key for S3 adapters.', example: 'your-key-here' )] public ?string $s3CredentialKey = null; #[OA\Property( description: 'The credential secret for S3 adapters.', example: 'your-secret-here' )] public ?string $s3CredentialSecret = null; #[OA\Property( description: 'The region for S3 adapters.', example: 'your-region' )] public ?string $s3Region = null; #[OA\Property( description: 'The API version for S3 adapters.', example: 'latest' )] public ?string $s3Version = null; #[OA\Property( description: 'The S3 bucket name for S3 adapters.', example: 'your-bucket-name' )] public ?string $s3Bucket = null; #[OA\Property( description: 'The optional custom S3 endpoint S3 adapters.', example: 'path_to_url )] public ?string $s3Endpoint = null; #[OA\Property( description: 'The optional Dropbox App Key.', example: '' )] public ?string $dropboxAppKey = null; #[OA\Property( description: 'The optional Dropbox App Secret.', example: '' )] public ?string $dropboxAppSecret = null; #[OA\Property( description: 'The optional Dropbox Auth Token.', example: '' )] public ?string $dropboxAuthToken = null; #[OA\Property( description: 'The host for SFTP adapters', example: '127.0.0.1' )] public ?string $sftpHost = null; #[OA\Property( description: 'The username for SFTP adapters', example: 'root' )] public ?string $sftpUsername = null; #[OA\Property( description: 'The password for SFTP adapters', example: 'abc123' )] public ?string $sftpPassword = null; #[OA\Property( description: 'The port for SFTP adapters', example: 20 )] public ?int $sftpPort = null; #[OA\Property( description: 'The private key for SFTP adapters' )] public ?string $sftpPrivateKey = null; #[OA\Property( description: 'The private key pass phrase for SFTP adapters' )] public ?string $sftpPrivateKeyPassPhrase = null; #[OA\Property(example: '50 GB')] public ?string $storageQuota = null; #[OA\Property(example: '120000')] public ?string $storageQuotaBytes = null; #[OA\Property(example: '1 GB')] public ?string $storageUsed = null; #[OA\Property(example: '60000')] public ?string $storageUsedBytes = null; #[OA\Property(example: '1 GB')] public ?string $storageAvailable = null; #[OA\Property(example: '120000')] public ?string $storageAvailableBytes = null; #[OA\Property(example: '75')] public ?int $storageUsedPercent = null; #[OA\Property(example: 'true')] public bool $isFull = true; #[OA\Property( description: 'The URI associated with the storage location.', example: '/var/azuracast/www' )] public string $uri; #[OA\Property( description: 'The stations using this storage location, if any.', items: new OA\Items(type: 'string', example: 'AzuraTest Radio') ) ] public ?array $stations = []; } ```
/content/code_sandbox/backend/src/Entity/Api/Admin/StorageLocation.php
php
2016-04-30T21:41:23
2024-08-16T18:27:26
AzuraCast
AzuraCast/AzuraCast
2,978
1,040