This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | [friendsofphp/php-cs-fixer](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer) | `<3.64.1` -> `<3.85.2` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>PHP-CS-Fixer/PHP-CS-Fixer (friendsofphp/php-cs-fixer)</summary> ### [`v3.85.1`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3851) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.85.0...v3.85.1) - chore: update legacy deps ([#​8902](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8902)) ### [`v3.85.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3850) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.84.0...v3.85.0) - feat: `ArrayIndentationFixer` - handle closures inside attributes ([#​8888](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8888)) - feat: `NullableTypeDeclarationFixer` - support final promoted properties ([#​8885](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8885)) - feat: `OperatorLinebreakFixer` - support pipe operator ([#​8891](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8891)) - feat: `PhpdocTypesFixer` - support multiline array shapes ([#​8893](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8893)) - fix: always reach 100% of checked files ([#​8861](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8861)) - fix: `BracesPositionFixer` - handle property hooks correctly ([#​8886](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8886)) - fix: `NullableTypeDeclarationFixer` - handle abstract and final properties ([#​8876](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8876)) - fix: `PhpdocLineSpanFixer` - handle promoted properties ([#​8897](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8897)) - fix: `PhpUnitDataProviderNameFixer` - fix for multiple providers defined by attributes for one test method ([#​8849](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8849)) - fix: `TernaryOperatorSpacesFixer` - handle `instanceof static` ([#​8879](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8879)) - fix: `TypeDeclarationSpacesFixer` - handle asymmetric visibility and final properties ([#​8900](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8900)) - chore: add initial PHP 8.5 integration test ([#​8871](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8871)) - chore: add tests for public API methods ([#​8895](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8895)) - chore: apply changes from `PhpdocTypesFixer` for multiline array shapes ([#​8894](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8894)) - chore: baseline files without error count ([#​8870](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8870)) - chore: cleanup `PhpCsFixer\DocBlock\Annotation` ([#​8892](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8892)) - chore: Command name/descriptions - use attribute and static properties ([#​8862](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8862)) - chore: Commands - unify way to define help content ([#​8881](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8881)) - chore: ConfigurationResolver - add few missing v4 TODOs ([#​8882](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8882)) - chore: fix `booleanNot.exprNotBoolean` errors ([#​8869](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8869)) - chore: fix/optimize some phpdocs ([#​8889](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8889)) - chore: more unification of PHP CS Fixer naming ([#​8854](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8854)) - chore: PHPStan baseline - use `shipmonk/phpstan-baseline-per-identifier` ([#​8844](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8844)) - chore: remove dead code ([#​8896](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8896)) - chore: remove unused constants ([#​8864](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8864)) - chore: remove useless `@var` annotations ([#​8867](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8867)) - chore: simplify `ClassDefinitionFixer` ([#​8868](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8868)) - chore: unify usage of image versions to not mention minor ([#​8860](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8860)) - chore: update PHPStan ([#​8898](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8898)) - chore: update PHPStan extension for `Preg::match` ([#​8872](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8872)) - chore: wrong return values in `ErrorsManager` ([#​8863](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8863)) - chore: `OrderedInterfacesFixer` - make code more PHPStan friendly ([#​8866](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8866)) - chore: `Token` - add `@phpstan-assert-if-true` ([#​8865](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8865)) - deps: bump phpstan/phpstan from 2.1.17 to 2.1.18 in /dev-tools in the phpstan group ([#​8859](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8859)) - deps: bump the phpstan group in /dev-tools with 4 updates ([#​8890](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8890)) - docs: better document reprecated rule sets ([#​8878](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8878)) - docs: cleanup docs for PHP 7 ([#​8873](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8873)) - docs: cleanup docs for PHP < 7.4 ([#​8855](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8855)) - docs: ListSetsCommand,FixCommand - document possible formats in Command's definitions ([#​8880](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8880)) - DX: Explicitly prevent touching non-monolithic files ([#​6517](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/6517)) ### [`v3.84.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3840) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.83.0...v3.84.0) - feat: Introduce `NoUselessPrintfFixer` ([#​8820](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8820)) - feat: `CastSpacesFixer` - support `(void)` cast ([#​8851](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8851)) - feat: `NewExpressionParenthesesFixer` - add to `PHP84MigrationSet` ([#​8788](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8788)) - feat: `VisibilityRequiredFixer` - support final promoted properties ([#​8835](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8835)) - fix: `PhpdocToParamTypeFixer` - do not convert types from `phpstan-type`, `phpstan-import-type`, `psalm-type` and `psalm-import-type` ([#​8842](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8842)) - fix: `PhpdocToPropertyTypeFixer` - do not convert types from `phpstan-type`, `phpstan-import-type`, `psalm-type` and `psalm-import-type` ([#​8847](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8847)) - fix: `PhpdocToReturnTypeFixer` - do not convert types from `phpstan-type`, `phpstan-import-type`, `psalm-type` and `psalm-import-type` ([#​8846](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8846)) - chore: introduce FCT for few missing tokens ([#​8845](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8845)) - chore: remove useless static variables for const content ([#​8836](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8836)) - chore: simplify `isGivenKind`/`equals`/`equalsAll` calls ([#​8843](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8843)) - docs: Support for new PHP version ([#​8780](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8780)) ### [`v3.83.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3830) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.82.2...v3.83.0) - feat: Suppress enable parallel runner message when only 1 core is available ([#​8833](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8833)) - fix: BracesPositionFixer - fix performance issue for massive files with CT::T\_CURLY\_CLOSE ([#​8830](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8830)) - fix: `NoUnreachableDefaultArgumentValueFixer` - do not crash on property hook ([#​8838](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8838)) - chore: Add CS commit to .git-blame-ignore-revs - chore: apply native\_constant\_invocation for build-in consts ([#​8837](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8837)) - chore: configure native\_constant\_invocation ([#​8840](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8840)) - chore: early compat check with Symfony 8 ([#​8827](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8827)) - chore: `FullyQualifiedStrictTypesFixer` - reduce function calls ([#​8834](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8834)) - CI: mark jobs allow-to-fail declarative, instead of imperative check ([#​8829](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8829)) ### [`v3.82.2`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3822) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.82.1...v3.82.2) - fix: `ClassAttributesSeparationFixer` - handle method `get` aliased in trait import ([#​8822](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8822)) - fix: `LowercaseStaticReferenceFixer` - do not touch enum's cases ([#​8824](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8824)) - fix: `StatementIndentationFixer` - multi constant statement containing array ([#​8825](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8825)) - fix: `VisibilityRequiredFixer` - handle promoted property with visibility and reference, but without type ([#​8823](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8823)) ### [`v3.82.1`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3821) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.82.0...v3.82.1) - fix: `OrderedClassElementsFixer` - handle property hooks ([#​8817](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8817)) - fix: `SingleClassElementPerStatementFixer` - fix for property hooks ([#​8816](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8816)) ### [`v3.82.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3820) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.81.0...v3.82.0) - chore: cleanup `FCTTest` ([#​8808](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8808)) - chore: PhpdocOrderFixer.php - CPU optimization ([#​8812](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8812)) - deps: update box ([#​8795](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8795)) - docs: fix whitespace around code examples and reference sections in rules' docs ([#​8810](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8810)) - feat: `MagicConstantCasingFixer` - support `__PROPERTY__` ([#​8809](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8809)) - feat: `PhpUnitDataProviderNameFixer` - support data providers defined by both annotation and attribute for the same test ([#​8811](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8811)) - fix: `PhpdocToParamTypeFixer` - always handle reference in PHPDoc ([#​8813](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8813)) ### [`v3.81.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3810) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.80.0...v3.81.0) - feat: `VisibilityRequiredFixer` - handle more than only the first promoted property ([#​8801](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8801)) - fix: `BracesPositionFixer` - do not crash when variable is terminated by PHP close tag ([#​8804](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8804)) - fix: `PhpUnitDataProviderMethodOrderFixer` - handle data provider defined by both annotation and attribute ([#​8805](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8805)) - fix: `PhpUnitInternalClassFixer` - skip adding `@internal` on instantiation of anonymous classes ([#​8807](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8807)) - fix: `VisibilityRequiredFixer` - handle promoted parameter passed by reference ([#​8799](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8799)) - chore: add automatically to milestone "PHP 8.5 initial compatibility" if label is "topic/PHP8.5" ([#​8806](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8806)) - chore: fail "Deployment checks" if any job from `tests` failed ([#​8792](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8792)) - docs: update docs about --allow-unsupported-php-version ([#​8796](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8796)) ### [`v3.80.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3800) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.79.0...v3.80.0) - feat: PHP 8.4 compatibility support ([#​8300](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8300)) ### [`v3.79.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3790) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.78.1...v3.79.0) - chore: `VisibilityRequiredFixerTest` - run tests in correct PHP version ([#​8790](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8790)) - feat: `BracesPositionFixer` - do not touch one-line properties with hooks ([#​8785](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8785)) - feat: `PhpUnitDataProvider(.+)Fixer` - support attributes ([#​8197](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8197)) ### [`v3.78.1`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3781) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.78.0...v3.78.1) - fix: `VisibilityRequiredFixer` - do not add `public` incorrectly ([#​8787](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8787)) ### [`v3.78.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3780) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.77.0...v3.78.0) - chore: `VisibilityRequiredFixer` - document behaviour for asymmetric visibility with only set-visibility ([#​8783](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8783)) - feat: `BracesPositionFixer` - support property hooks ([#​8782](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8782)) - feat: `VisibilityRequiredFixer` - support promoted property without visibility ([#​8773](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8773)) - fix: `NativeFunctionInvocationFixer` - fix global function `set` called in array key ([#​8568](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8568)) - fix: `NoBreakCommentFixer` - handle function having return type ([#​8767](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8767)) - fix: `StatementIndentationFixer` - handle functions `set` and `get` (like property hooks, but not) ([#​8576](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8576)) - fix: `StaticPrivateMethodFixer` - handle nested calls ([#​8768](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8768)) ### [`v3.77.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3770) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.76.0...v3.77.0) - chore: add automatically to milestone "PHP 8.4 initial compatibility" if label is "topic/PHP8.4" ([#​8770](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8770)) - chore: Add CS commit to .git-blame-ignore-revs - chore: fix adding automatically to milestone "PHP 8.4 initial compatibility" if label is "topic/PHP8.4" ([#​8775](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8775)) - chore: fix adding automatically to milestone "PHP 8.4 initial compatibility" if label is "topic/PHP8.4" ([#​8776](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8776)) - chore: move all indicators to analyzers ([#​8772](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8772)) - chore: move PHP-compat integration tests ([#​8781](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8781)) - chore: partially apply NoExtraBlankLinesFixer:tokens.comma ([#​8762](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8762)) - chore: reconfigure phpdoc\_order in local config ([#​8220](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8220)) - feat: PhpdocOrderFixer - extend support for phpstan and psalm annotations ([#​8777](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8777)) - feat: support anonymous classes extending `TestCase` in PHPUnit fixers ([#​8707](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8707)) - feat: `CommentToPhpdocFixer` and `PhpdocToCommentFixer` - support asymmetric visibility ([#​8774](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8774)) - feat: `NoEmptyStatementFixer` - support abstract property hooks ([#​8766](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8766)) - feat: `NullableTypeDeclarationForDefaultNullValueFixer` - support asymmetric visibility in the constructor ([#​8604](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8604)) - feat: `ProtectedToPrivateFixer` - add support for promoted properties ([#​8608](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8608)) - fix: `PhpUnitAttributesFixer` - correctly remove annotations when configured `['keep_annotations' => false]` ([#​8577](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8577)) - fix: `ProtectedToPrivateFixer` - fix asymmetric visibility with only set visibility ([#​8763](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8763)) ### [`v3.76.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3760) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.75.0...v3.76.0) - chore(release): bump php ci alpine version ([#​8581](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8581)) - chore: add missing priority test for `BracesPositionFixer` and `MultilinePromotedPropertiesFixer` ([#​8596](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8596)) - chore: add more assertions in tests ([#​8740](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8740)) - chore: bump dependencies version to maximum for non-newest MAJOR version ([#​8753](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8753)) - chore: cast types in tests ([#​8742](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8742)) - chore: cleanup booleans use in tests ([#​8738](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8738)) - chore: cleanup code in tests ([#​8745](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8745)) - chore: cleanup PsrAutoloadingFixerTest.php keywords handling, as always defined currently ([#​8730](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8730)) - chore: cleanup `AlignMultilineCommentFixerTest` ([#​8688](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8688)) - chore: cleanup `BinaryOperatorSpacesFixerTest` ([#​8687](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8687)) - chore: cleanup `BlankLineBeforeStatementFixerTest` ([#​8685](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8685)) - chore: cleanup `ClassDefinitionFixerTest` ([#​8684](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8684)) - chore: cleanup `ClassDefinitionFixer` ([#​8580](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8580)) - chore: cleanup `ConcatSpaceFixerTest` ([#​8683](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8683)) - chore: cleanup `DoctrineAnnotationArrayAssignmentFixerTest` ([#​8621](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8621)) - chore: cleanup `DoctrineAnnotationBracesFixerTest` ([#​8623](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8623)) - chore: cleanup `DoctrineAnnotationIndentationFixerTest` ([#​8620](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8620)) - chore: cleanup `DoctrineAnnotationSpacesFixerTest` ([#​8624](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8624)) - chore: cleanup `EchoTagSyntaxFixerTest` ([#​8681](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8681)) - chore: cleanup `file_get_contents` return types ([#​8735](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8735)) - chore: cleanup `FunctionDeclarationFixerTest` ([#​8680](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8680)) - chore: cleanup `FunctionToConstantFixerTest` ([#​8618](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8618)) - chore: cleanup `GeneralPhpdocTagRenameFixerTest` ([#​8627](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8627)) - chore: cleanup `GlobalNamespaceImportFixerTest` ([#​8679](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8679)) - chore: cleanup `HeaderCommentFixerTest` ([#​8677](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8677)) - chore: cleanup `HeaderCommentFixerTest` (restore `@requires` for PHP 8.1) ([#​8678](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8678)) - chore: cleanup `IncrementStyleFixerTest` ([#​8676](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8676)) - chore: cleanup `IndentationTypeFixerTest` ([#​8675](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8675)) - chore: cleanup `ListSyntaxFixerTest` ([#​8674](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8674)) - chore: cleanup `MethodArgumentSpaceFixerTest` ([#​8673](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8673)) - chore: cleanup `MultilineWhitespaceBeforeSemicolonsFixerTest` ([#​8614](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8614)) - chore: cleanup `NativeConstantInvocationFixerTest` ([#​8672](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8672)) - chore: cleanup `NewWithParenthesesFixerTest` ([#​8592](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8592)) - chore: cleanup `NoBlankLinesAfterPhpdocFixerTest` ([#​8671](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8671)) - chore: cleanup `NoBreakCommentFixerTest` ([#​8670](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8670)) - chore: cleanup `NoClosingTagFixerTest` ([#​8669](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8669)) - chore: cleanup `NoEmptyStatementFixerTest` ([#​8667](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8667)) - chore: cleanup `NoSpacesAroundOffsetFixerTest` ([#​8666](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8666)) - chore: cleanup `NoUnneededControlParenthesesFixerTest` ([#​8665](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8665)) - chore: cleanup `NoUselessElseFixerTest` ([#​8664](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8664)) - chore: cleanup `PhpdocAddMissingParamAnnotationFixerTest` ([#​8663](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8663)) - chore: cleanup `PhpdocNoEmptyReturnFixerTest` ([#​8662](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8662)) - chore: cleanup `PhpdocNoPackageFixerTest` ([#​8626](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8626)) - chore: cleanup `PhpdocOrderByValueFixerTest` ([#​8661](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8661)) - chore: cleanup `PhpdocOrderFixerTest` ([#​8660](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8660)) - chore: cleanup `PhpdocParamOrderFixerTest` ([#​8659](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8659)) - chore: cleanup `PhpdocReturnSelfReferenceFixerTest` ([#​8658](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8658)) - chore: cleanup `PhpdocSeparationFixerTest` ([#​8657](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8657)) - chore: cleanup `PhpdocSummaryFixerTest` ([#​8654](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8654)) - chore: cleanup `PhpdocTrimFixerTest` ([#​8653](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8653)) - chore: cleanup `PhpdocTypesOrderFixerTest` ([#​8652](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8652)) - chore: cleanup `PhpdocVarWithoutNameFixerTest` ([#​8617](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8617)) - chore: cleanup `PhpUnitConstructFixerTest` ([#​8651](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8651)) - chore: cleanup `PhpUnitDedicateAssertFixerTest` ([#​8650](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8650)) - chore: cleanup `PhpUnitTestCaseStaticMethodCallsFixerTest` ([#​8649](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8649)) - chore: cleanup `Preg` issues ([#​8720](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8720)) - chore: cleanup `ReturnAssignmentFixerTest` ([#​8648](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8648)) - chore: cleanup `ReturnTypeDeclarationFixerTest` ([#​8647](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8647)) - chore: cleanup `SingleImportPerStatementFixerTest` ([#​8645](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8645)) - chore: cleanup `SingleLineCommentStyleFixerTest` ([#​8644](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8644)) - chore: cleanup `SingleSpaceAroundConstructFixerTest` ([#​8642](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8642)) - chore: cleanup `SpaceAfterSemicolonFixerTest` ([#​8625](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8625)) - chore: cleanup `SpacesInsideParenthesesFixerTest` ([#​8641](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8641)) - chore: cleanup `StatementIndentationFixerTest` ([#​8640](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8640)) - chore: cleanup `YodaStyleFixerTest` ([#​8638](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8638)) - chore: do not check if `JSON_INVALID_UTF8_IGNORE` is defined because it always is (since PHP 7.2) ([#​8709](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8709)) - chore: handle saveXML failures explicitly ([#​8755](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8755)) - chore: ignore remaining PHPStan (false positive) issues ([#​8746](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8746)) - chore: improve PHPDoc's types in ([#​8741](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8741)) - chore: improve PHPDocs in tests ([#​8736](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8736)) - chore: improve PHPDocs in tests ([#​8744](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8744)) - chore: improve type of `Token::equalsAny` ([#​8743](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8743)) - chore: lint yaml files ([#​8622](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8622)) - chore: MultilinePromotedPropertiesFixer - mark new fixer introduced in [#​8595](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8595) as experimental ([#​8758](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8758)) - chore: PHPMD - cleanup `UnusedLocalVariable` for `foreach` ([#​8637](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8637)) - chore: refactor FCT ([#​8714](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8714)) - chore: remove unused local variables in src ([#​8600](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8600)) - chore: remove unused local variables in tests ([#​8599](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8599)) - chore: remove useless test from `AliasedFixerOptionTest` ([#​8739](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8739)) - chore: remove `defined` calls from tests ([#​8708](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8708)) - chore: restore original type of Token::equalsAny, partially reverts [#​8743](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8743) ([#​8759](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8759)) - chore: run mutation tests on PHP 8.4 ([#​8594](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8594)) - chore: solve one of phpstan warnings ([#​8754](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8754)) - chore: update dev tools ([#​8737](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8737)) - chore: update PHPUnit config ([#​8721](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8721)) - chore: update `checkbashisms` to 2.25.12 ([#​8694](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8694)) - chore: update `checkbashisms` to 2.25.14 ([#​8731](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8731)) - chore: use PHPStan type in data providers ([#​8605](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8605)) - chore: use `foreach` values ([#​8636](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8636)) - chore: use `Preg` class everywhere ([#​8689](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8689)) - CI: add self-approved label ([#​8757](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8757)) - CI: run on PHP 8.5 ([#​8713](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8713)) - deps: bump alpine from 3.21.3 to 3.22.0 ([#​8724](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8724)) - deps: bump alpine from 3.21.3 to 3.22.0 ([#​8726](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8726)) - deps: bump ergebnis/composer-normalize from 2.45.0 to 2.46.0 in /dev-tools ([#​8578](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8578)) - deps: bump ergebnis/composer-normalize from 2.46.0 to 2.47.0 in /dev-tools ([#​8584](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8584)) - deps: bump phpstan/phpstan from 2.1.11 to 2.1.12 in /dev-tools in the phpstan group ([#​8583](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8583)) - deps: bump phpstan/phpstan-symfony from 2.0.3 to 2.0.4 in /dev-tools in the phpstan group ([#​8557](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8557)) - deps: bump the phpstan group across 1 directory with 2 updates ([#​8682](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8682)) - deps: upgrade docker deps ([#​8566](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8566)) - docs: extend and fix links to code ([#​8639](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8639)) - docs: Update SECURITY.md ([#​8716](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8716)) - docs: VisibilityRequiredFixer - extend docs ([#​8561](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8561)) - docs: `VisibilityRequiredFixer` - update docs ([#​8563](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8563)) - DX: add `symfony/polyfill-php84` ([#​8555](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8555)) - DX: always use the latest stable `checkbashisms` package ([#​8732](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8732)) - DX: check for `preg_` functions in tests ([#​8571](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8571)) - DX: cleanup `BlankLinesBeforeNamespaceFixerTest` ([#​8573](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8573)) - DX: cleanup `NativeFunctionInvocationFixerTest` ([#​8567](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8567)) - DX: cleanup `NoUselessConcatOperatorFixerTest` ([#​8572](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8572)) - DX: cleanup `SemicolonAfterInstructionFixerTest` ([#​8570](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8570)) - DX: fix data providers ([#​8693](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8693)) - DX: introduce `FCT` class for tokens not present in the lowest supported PHP version ([#​8706](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8706)) - DX: move `symfony/polyfill-php84` to dev deps ([#​8559](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8559)) - DX: support PHP 8.4 in local Docker development environment ([#​8564](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8564)) - DX: trim array/yield keys ([#​8460](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8460)) - DX: use `WhitespacesAwareFixerInterface` only when needed ([#​8541](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8541)) - feat: add `NewExpressionParenthesesFixer` ([#​8246](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8246)) - feat: allowUnsupportedPhpVersion ([#​8733](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8733)) - feat: introduce `MultilinePromotedPropertiesFixer` ([#​8595](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8595)) - feat: Introduce `StaticPrivateMethodFixer` ([#​4557](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/4557)) - feat: `BracesPositionFixer` - support property hooks in promoted properties ([#​8613](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8613)) - feat: `ClassAttributesSeparationFixer` - add support for property hooks ([#​8610](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8610)) - feat: `GlobalNamespaceImportFixer` - analyze and fix more annotations with types ([#​8593](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8593)) - feat: `LowercaseKeywordsFixer` - support asymmetric visibility ([#​8607](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8607)) - feat: `NoExtraBlankLinesFixer` - add comma to supported tokens ([#​8655](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8655)) - feat: `NoSuperfluousPhpdocTagsFixer` - support asymmetric visibility ([#​8700](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8700)) - feat: `NullableTypeDeclarationFixer` - support asymmetric visibility ([#​8697](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8697)) - feat: `OrderedClassElementsFixer` - add support for property hooks for abstract properties ([#​8574](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8574)) - feat: `OrderedTypesFixer` - add support for asymmetric visibility ([#​8552](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8552)) - feat: `OrderedTypesFixer` - support asymmetric visibility in promoted property ([#​8602](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8602)) - feat: `PhpdocAddMissingParamAnnotationFixer` - support asymmetric visibility ([#​8701](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8701)) - feat: `PhpdocLineSpanFixer` - support asymmetric visibility ([#​8702](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8702)) - feat: `PhpdocVarWithoutNameFixer` - support asymmetric visibility ([#​8704](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8704)) - feat: `ProtectedToPrivateFixer` - add support for asymmetric visibility ([#​8569](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8569)) - feat: `SingleClassElementPerStatementFixer` - support asymmetric visibility ([#​8696](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8696)) - feat: `SingleSpaceAroundConstructFixer` - add support for asymmetric visibility ([#​8699](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8699)) - feat: `StaticLambdaFixer` - support functions having classy elements with `$this` ([#​8728](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8728)) - feat: `VisibilityRequiredFixer` - support ordering set-visibility modifier ([#​8606](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8606)) - fix(dependabot): convert time values to string types ([#​8634](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8634)) - fix: "array" type must have no prefix to be fixable to "list" ([#​8692](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8692)) - fix: "min"/"max" in int generics must never be prefixed by backslash ([#​8691](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8691)) - fix: Allow non-doc comment on opening inline brace line ([#​8690](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8690)) - fix: `ConstantCaseFixer` - do not touch namespaces starting with `Null\` ([#​8752](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8752)) - fix: `LowercaseStaticReferenceFixer` - do not change global constants ([#​8727](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8727)) - fix: `MultilineWhitespaceBeforeSemicolonsFixer` - do not touch multiline constants definitions ([#​8615](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8615)) - fix: `NewWithParenthesesFixer` - fix `new` without parentheses on PHP 8.4 syntax ([#​8588](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8588)) - fix: `NoMultipleStatementsPerLineFixer` - handle `set` and `get` in different casing in property hooks ([#​8558](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8558)) - fix: `NoUnusedImportsFixer` - handle imported class name with underscore before or after it in PHPDoc ([#​8598](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8598)) - fix: `PhpUnitDedicateAssertFixer` - fix for `assertFalse` with `instanceof` ([#​8597](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8597)) - fix: `PhpUnitNamespacedFixer` must rune before `NoUnneededImportAliasFixer` ([#​8579](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8579)) - fix: `PhpUnitTestClassRequiresCoversFixer` - do not add `@coversNothing` annotation when `CoversTrait` attribute is used ([#​8734](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8734)) - fix: `VisibilityRequiredFixer` - add support for asymmetric visibility ([#​8586](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8586)) - refactor: avoid unused local variables in tests ([#​8609](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8609)) - test: add more cases to `PhpUnitMethodCasingFixerTest` ([#​8551](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8551)) - test: fix "unused local variables `$token`" ([#​8603](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8603)) - test: More verbose error output for integration test ([#​8565](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8565)) - Update SECURITY.md ### [`v3.75.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3750) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.74.0...v3.75.0) - feat: `ClassAttributesSeparationFixer` - add support for asymmetric visibility ([#​8518](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8518)) - fix: `NativeFunctionInvocationFixer` - fix for property hooks ([#​8540](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8540)) - chore: add return types for data providers for fixers ([#​8542](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8542)) - chore: add return types for data providers for non-fixers ([#​8543](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8543)) - chore: add return types for remaining data providers ([#​8544](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8544)) - chore: make data providers key type `int` if all the keys are strings ([#​8550](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8550)) - chore: make data providers key type `string` if all the keys are strings ([#​8545](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8545)) - chore: SwitchContinueToBreakFixerTest - improve test case descriptions/typehint ([#​8546](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8546)) - chore: `FunctionsAnalyzerTest` cleanup ([#​8539](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8539)) - deps: bump the phpstan group in /dev-tools with 2 updates ([#​8537](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8537)) - test: ProjectCodeTest::testDataProvidersDeclaredReturnType - allow for int as iterable keys ([#​8548](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8548)) ### [`v3.74.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3740) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.73.1...v3.74.0) - feat: add `--format=@​auto` ([#​8513](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8513)) - fix: `BracesPositionFixer` - do not create two consecutive whitespace tokens ([#​8496](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8496)) - fix: `MbStrFunctionsFixer` - fix imports with leading backslash ([#​8507](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8507)) - fix: `NoUnreachableDefaultArgumentValueFixer` - do not crash on property hook ([#​8512](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8512)) - fix: `OrderedImportsFixer` - do not take the braces part in grouped imports into account ([#​8459](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8459)) - fix: `OrderedImportsFixer` - fix syntax error with grouped use statement and multiple use with comma ([#​8483](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8483)) - fix: `PhpUnitAttributesFixer` - handle parentheses after data provider method name ([#​8510](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8510)) - fix: `PhpUnitMethodCasingFixer` - do not touch anonymous class ([#​8463](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8463)) - chore: make options that have default and allowed sets the same size the same array ([#​8529](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8529)) - chore: update return type of `FixerOptionInterface::getAllowedValues` ([#​8530](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8530)) - chore: `Preg` - improve types ([#​8527](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8527)) - CI: fix code coverage job ([#​8520](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8520)) - CI: try MacOS job without ParaUnit ([#​8528](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8528)) - deps: update PHPStan ([#​8531](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8531)) - deps: upgrade `PHPStan/*` ([#​8524](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8524)) ### [`v3.73.1`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3731) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.73.0...v3.73.1) - fix: `OrderedClassElementsFixer` - do not crash on property hook ([#​8517](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8517)) ### [`v3.73.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3730) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.72.0...v3.73.0) - feat: add support for asymmetric visibility to Doctrine's fixers ([#​8415](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8415)) - fix: `GeneralPhpdocTagRenameFixer` - do not rename keys in array shape definition ([#​8477](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8477)) - fix: `MethodArgumentSpaceFixer` - handle when nested in HTML ([#​8503](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8503)) - chore: update `checkbashisms` to 2.25.5 ([#​8519](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8519)) - DX: cleanup `NoExtraBlankLinesFixerTest` ([#​8505](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8505)) - DX: for duplicated test methods check methods without parameters ([#​8508](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8508)) - DX: remove more duplicated test methods ([#​8506](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8506)) - refactor: `Tokenizer` hash metode using `xxHash` ([#​8491](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8491)) - refactor: `TokensAnalyzerTest` - better test `isArray` and `isArrayMultiLine` ([#​8504](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8504)) - test: run code coverage on PHP 8.4 ([#​8448](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8448)) ### [`v3.72.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3720) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.71.0...v3.72.0) - feat: `StatementIndentationFixer` - handle property hooks ([#​8492](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8492)) - fix: `MbStrFunctionsFixer` - fix imports ([#​8474](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8474)) - fix: `TrailingCommaInMultilineFixer` - handle empty match body ([#​8480](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8480)) - fix: `VisibilityRequiredFixer` - handle property hooks ([#​8495](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8495)) - deps: upgrade few dev-deps ([#​8490](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8490)) - deps: Upgrade PHPStan to 2.1.8 ([#​8489](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8489)) - DX: add trailing comma to multiline auto-generated types ([#​8499](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8499)) - refactor: generalize CodeHasher into Hasher ([#​8500](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8500)) - refactor: Runner - unify paths used when using parallel runner ([#​8488](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8488)) - refactor: use Hasher instead of md5 directly ([#​8501](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8501)) ### [`v3.71.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3710) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.70.2...v3.71.0) - feat: OrderedImportsFixer - deprecate length sorting algorithm ([#​8473](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8473)) - fix: `BinaryOperatorSpacesFixer` - do not break alignment of UTF-8 array keys ([#​8484](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8484)) - fix: `PhpdocAlignFixer` - align correctly type with UTF8 characters ([#​8486](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8486)) - fix: `SingleSpaceAroundConstructFixer` - handle alternative syntax ([#​8317](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8317)) - fix: `StatementIndentationFixer` - return in braceless if ([#​8479](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8479)) - chore: update type in `SingleSpaceAroundConstructFixerTest::provideFixWithElseIfCases` ([#​8481](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8481)) - chore: update type in `SingleSpaceAroundConstructFixerTest::provideFixWithIfCases` ([#​8482](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8482)) - deps: bump phpstan/phpstan from 2.1.6 to 2.1.7 in /dev-tools in the phpstan group ([#​8485](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8485)) - DX: cleanup `PhpdocNoAliasTagFixerTest` ([#​8476](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8476)) - refactor: add `FullyQualifiedNameAnalyzer` ([#​8048](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8048)) - refactor: codeHash - update when it's (re-)generated ([#​8470](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8470)) - refactor: `SwitchAnalyzer` - improve performance ([#​8407](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8407)) - test: NameQualifiedTransformerTest - correct test case ([#​8471](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8471)) ### [`v3.70.2`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3702) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.70.1...v3.70.2) - deps: upgrade deep dev-tools deps ([#​8472](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8472)) - fix: `MbStrFunctionsFixer` must run before `NativeFunctionInvocationFixer` ([#​8466](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8466)) - fix: `MethodArgumentSpaceFixer` - fix nested calls for `ensure_fully_multiline` option ([#​8469](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8469)) ### [`v3.70.1`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3701) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.70.0...v3.70.1) - fix: `PhpUnitSizeClassFixer` must run before `PhpUnitAttributesFixer` ([#​8457](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8457)) - DX: cleanup `OrderedImportsFixerTest` ([#​8458](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8458)) ### [`v3.70.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3700) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.69.1...v3.70.0) - feat: Add `PhpUnitDataProviderMethodOrderFixer` fixer ([#​8225](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8225)) - feat: `HeaderCommentFixer` - allow validators ([#​8452](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8452)) - feat: `PhpCsFixer` ruleset: use `operator_linebreak` rule for all operators ([#​8417](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8417)) - feat: `PhpUnitMethodCasingFixer` to support PHPUnit's `Test` attribute ([#​8451](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8451)) - feat: `TypeDeclarationSpacesFixer` - Fix whitespace between const type and const name ([#​8442](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8442)) - chore: extend bug report template ([#​8447](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8447)) - chore: extend bug report template - more installation options ([#​8450](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8450)) - CI: phpstan-symfony - add entry point for console ([#​8292](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8292)) - deps: bump alpine from 3.21.2 to 3.21.3 ([#​8454](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8454)) - deps: bump phpstan/phpstan from 2.1.5 to 2.1.6 in /dev-tools in the phpstan group ([#​8453](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8453)) - fix: `CommentsAnalyzer` - allow other forms of assignment as valid structural elements for PHPDocs ([#​8371](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8371)) - fix: `PhpUnitTestClassRequiresCoversFixer` must run before `PhpUnitAttributesFixer` ([#​8444](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8444)) - test: fix `CheckCommandTest::testDryRunModeIsUnavailable` to correctly check that option `--dry-run` is unavailable ([#​8438](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8438)) ### [`v3.69.1`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3691) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.69.0...v3.69.1) - fix: `PhpUnitAttributesFixer` - convert correctly version constraint ([#​8439](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8439)) - test: `PhpUnitAttributesFixer` must run before `NoEmptyPhpdocFixer` ([#​8443](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8443)) ### [`v3.69.0`](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/HEAD/CHANGELOG.md#Changelog-for-v3690) [Compare Source](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.68.5...v3.69.0) - feat: Add unsealed array shape phpdoc support ([#​8299](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8299)) - fix: `OrderedClassElementsFixer` - sort correctly typed constants ([#​8408](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8408)) - chore: do not use test class as test data ([#​8430](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8430)) - chore: update `checkbashisms` to 2.25.2 ([#​8427](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8427)) - chore: use constants instead of literal strings ([#​8422](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8422)) - CI: no need to unlock deps on master ([#​8426](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8426)) - CI: run tests using PHPUnit 12 ([#​8431](https://redirect.github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/8431)) - deps: bump kubawerlos/composer-s </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/libretime/libretime). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS41MS4xIiwidXBkYXRlZEluVmVyIjoiNDEuNTEuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicGhwIl19--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: jo <ljonas@riseup.net>
1676 lines
65 KiB
PHP
1676 lines
65 KiB
PHP
<?php
|
|
|
|
class ApiController extends Zend_Controller_Action
|
|
{
|
|
public const DEFAULT_SHOWS_TO_RETRIEVE = '5';
|
|
|
|
public const DEFAULT_DAYS_TO_RETRIEVE = '2';
|
|
|
|
public function init()
|
|
{
|
|
if ($this->view) { // skip if already missing (ie in tests)
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
}
|
|
|
|
// Ignore API key and session authentication for these APIs:
|
|
$ignoreAuth = [
|
|
'live-info',
|
|
'live-info-v2',
|
|
'week-info',
|
|
'station-metadata',
|
|
'station-logo',
|
|
'show-history-feed',
|
|
'item-history-feed',
|
|
'shows',
|
|
'show-tracks',
|
|
'show-schedules',
|
|
'show-logo',
|
|
'track',
|
|
'track-types',
|
|
'stream-m3u',
|
|
];
|
|
|
|
if (Zend_Session::isStarted()) {
|
|
Logging::error('Session already started for an API request. Check your code because
|
|
this will negatively impact performance.');
|
|
}
|
|
|
|
$params = $this->getRequest()->getParams();
|
|
if (!in_array($params['action'], $ignoreAuth)) {
|
|
$this->checkAuth();
|
|
}
|
|
// Initialize action controller here
|
|
$context = $this->_helper->getHelper('contextSwitch');
|
|
$context->addActionContext('version', 'json')
|
|
->addActionContext('recorded-shows', 'json')
|
|
->addActionContext('calendar-init', 'json')
|
|
->addActionContext('upload-file', 'json')
|
|
->addActionContext('upload-recorded', 'json')
|
|
->addActionContext('media-monitor-setup', 'json')
|
|
->addActionContext('media-item-status', 'json')
|
|
->addActionContext('reload-metadata', 'json')
|
|
->addActionContext('list-all-files', 'json')
|
|
->addActionContext('list-all-watched-dirs', 'json')
|
|
->addActionContext('add-watched-dir', 'json')
|
|
->addActionContext('remove-watched-dir', 'json')
|
|
->addActionContext('set-storage-dir', 'json')
|
|
->addActionContext('get-stream-setting', 'json')
|
|
->addActionContext('status', 'json')
|
|
->addActionContext('register-component', 'json')
|
|
->addActionContext('update-liquidsoap-status', 'json')
|
|
->addActionContext('update-file-system-mount', 'json')
|
|
->addActionContext('handle-watched-dir-missing', 'json')
|
|
->addActionContext('rabbitmq-do-push', 'json')
|
|
->addActionContext('check-live-stream-auth', 'json')
|
|
->addActionContext('update-source-status', 'json')
|
|
->addActionContext('get-bootstrap-info', 'json')
|
|
->addActionContext('get-files-without-replay-gain', 'json')
|
|
->addActionContext('get-files-without-silan-value', 'json')
|
|
->addActionContext('reload-metadata-group', 'json')
|
|
->addActionContext('notify-webstream-data', 'json')
|
|
->addActionContext('get-stream-parameters', 'json')
|
|
->addActionContext('push-stream-stats', 'json')
|
|
->addActionContext('update-stream-setting-table', 'json')
|
|
->addActionContext('update-replay-gain-value', 'json')
|
|
->addActionContext('update-cue-values-by-silan', 'json')
|
|
->addActionContext('get-usability-hint', 'json')
|
|
->addActionContext('poll-celery', 'json')
|
|
->addActionContext('recalculate-schedule', 'json') // RKTN-260
|
|
->initContext();
|
|
}
|
|
|
|
public function checkAuth()
|
|
{
|
|
$CC_CONFIG = Config::getConfig();
|
|
$apiKey = $this->_getParam('api_key');
|
|
|
|
if (in_array($apiKey, $CC_CONFIG['apiKey'])) {
|
|
return true;
|
|
}
|
|
|
|
$authHeader = $this->getRequest()->getHeader('Authorization');
|
|
$authHeaderArray = explode(' ', $authHeader);
|
|
if (
|
|
count($authHeaderArray) >= 2
|
|
&& $authHeaderArray[0] == 'Api-Key'
|
|
&& in_array($authHeaderArray[1], $CC_CONFIG['apiKey'])
|
|
) {
|
|
return true;
|
|
}
|
|
|
|
// Start the session so the authentication is
|
|
// enforced by the ACL plugin.
|
|
Zend_Session::start();
|
|
$authAdapter = Zend_Auth::getInstance();
|
|
Application_Model_Auth::pinSessionToClient($authAdapter);
|
|
|
|
if (Zend_Auth::getInstance()->hasIdentity()) {
|
|
return true;
|
|
}
|
|
|
|
header('HTTP/1.0 401 Unauthorized');
|
|
echo _('You are not allowed to access this resource.');
|
|
|
|
exit;
|
|
}
|
|
|
|
public function versionAction()
|
|
{
|
|
$config = Config::getConfig();
|
|
$this->_helper->json->sendJson([
|
|
'airtime_version' => $config['airtime_version'],
|
|
'api_version' => AIRTIME_API_VERSION,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Allows remote client to download requested media file.
|
|
*/
|
|
public function getMediaAction()
|
|
{
|
|
// Close the session so other HTTP requests can be completed while
|
|
// tracks are read for previewing or downloading.
|
|
session_write_close();
|
|
|
|
$fileId = $this->_getParam('file');
|
|
|
|
$inline = !($this->_getParam('download', false) == true);
|
|
Application_Service_MediaService::streamFileDownload($fileId, $inline);
|
|
|
|
$this->_helper->json->sendJson([]);
|
|
}
|
|
|
|
/**
|
|
* Manually trigger the TaskManager task to poll for completed Celery tasks.
|
|
*/
|
|
public function pollCeleryAction()
|
|
{
|
|
$taskManager = TaskManager::getInstance();
|
|
$taskManager->runTask('CeleryTask');
|
|
}
|
|
|
|
/**
|
|
* TODO: move this function into a more generic analytics REST controller.
|
|
*
|
|
* Update station bandwidth usage based on icecast log data
|
|
*/
|
|
public function bandwidthUsageAction()
|
|
{
|
|
$bandwidthUsage = json_decode($this->getRequest()->getParam('bandwidth_data'));
|
|
$usageBytes = 0;
|
|
if (!empty($bandwidthUsage)) {
|
|
foreach ($bandwidthUsage as $entry) {
|
|
// TODO: store the IP address for future use
|
|
$ts = strtotime($entry->timestamp);
|
|
if ($ts > Application_Model_Preference::getBandwidthLimitUpdateTimer()) {
|
|
$usageBytes += $entry->bytes;
|
|
}
|
|
}
|
|
}
|
|
Application_Model_Preference::incrementBandwidthLimitCounter($usageBytes);
|
|
Application_Model_Preference::setBandwidthLimitUpdateTimer();
|
|
|
|
$usage = Application_Model_Preference::getBandwidthLimitCounter();
|
|
if (($usage > Application_Model_Preference::getBandwidthLimit())
|
|
&& (Application_Model_Preference::getProvisioningStatus() == PROVISIONING_STATUS_ACTIVE)
|
|
) {
|
|
$CC_CONFIG = Config::getConfig();
|
|
// Hacky way to get the user ID...
|
|
$url = AIRTIMEPRO_API_URL . '/station/' . $CC_CONFIG['rabbitmq']['user'] . '/suspend';
|
|
$user = ['', $CC_CONFIG['apiKey'][0]];
|
|
$data = ['reason' => 'Bandwidth limit exceeded'];
|
|
|
|
try {
|
|
Application_Common_HTTPHelper::doPost($url, $user, $data);
|
|
} catch (Exception $e) {
|
|
throw $e;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Used by the SaaS monitoring
|
|
public function onAirLightAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
$result = [];
|
|
$result['on_air_light'] = false;
|
|
$result['on_air_light_expected_status'] = false;
|
|
$result['station_down'] = false;
|
|
$result['master_stream'] = false;
|
|
$result['live_stream'] = false;
|
|
$result['master_stream_on_air'] = false;
|
|
$result['live_stream_on_air'] = false;
|
|
|
|
$range = Application_Model_Schedule::GetPlayOrderRange();
|
|
|
|
$isItemCurrentlyScheduled = false;
|
|
$isCurrentItemPlaying = false;
|
|
if (!is_null($range['tracks']['current']) && count($range['tracks']['current']) > 0) {
|
|
$isItemCurrentlyScheduled = true;
|
|
$isCurrentItemPlaying = $range['tracks']['current']['media_item_played'] ? true : false;
|
|
}
|
|
|
|
if (
|
|
$isItemCurrentlyScheduled
|
|
|| Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on'
|
|
|| Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on'
|
|
) {
|
|
$result['on_air_light_expected_status'] = true;
|
|
}
|
|
|
|
if (($isItemCurrentlyScheduled && $isCurrentItemPlaying)
|
|
|| Application_Model_Preference::GetSourceSwitchStatus('live_dj') == 'on'
|
|
|| Application_Model_Preference::GetSourceSwitchStatus('master_dj') == 'on'
|
|
) {
|
|
$result['on_air_light'] = true;
|
|
}
|
|
|
|
if ($result['on_air_light_expected_status'] != $result['on_air_light']) {
|
|
$result['station_down'] = true;
|
|
}
|
|
|
|
$live_dj_stream = Application_Model_Preference::GetSourceStatus('live_dj');
|
|
$master_dj_stream = Application_Model_Preference::GetSourceStatus('master_dj');
|
|
$live_dj_on_air = Application_Model_Preference::GetSourceSwitchStatus('live_dj');
|
|
$master_dj_on_air = Application_Model_Preference::GetSourceSwitchStatus('master_dj');
|
|
|
|
if ($live_dj_stream == true) {
|
|
$result['live_stream'] = true;
|
|
if ($live_dj_on_air == 'on') {
|
|
$result['live_stream_on_air'] = true;
|
|
}
|
|
}
|
|
|
|
if ($master_dj_stream == true) {
|
|
$result['master_stream'] = true;
|
|
if ($master_dj_on_air == 'on') {
|
|
$result['master_stream_on_air'] = true;
|
|
}
|
|
}
|
|
|
|
$this->returnJsonOrJsonp($request, $result);
|
|
}
|
|
|
|
/**
|
|
* Retrieve the currently playing show as well as upcoming shows.
|
|
* Number of shows returned and the time interval in which to
|
|
* get the next shows can be configured as GET parameters.
|
|
*
|
|
* TODO: in the future, make interval length a parameter instead of hardcode to 48
|
|
*
|
|
* Possible parameters:
|
|
* type - Can have values of "endofday" or "interval". If set to "endofday",
|
|
* the function will retrieve shows from now to end of day.
|
|
* If set to "interval", shows in the next 48 hours will be retrived.
|
|
* Default is "interval".
|
|
* limit - How many shows to retrieve
|
|
* Default is "5".
|
|
*/
|
|
public function liveInfoAction()
|
|
{
|
|
if (Application_Model_Preference::GetAllow3rdPartyApi() || $this->checkAuth()) {
|
|
// disable the view and the layout
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$utcTimeNow = gmdate(DEFAULT_TIMESTAMP_FORMAT);
|
|
$utcTimeEnd = ''; // if empty, getNextShows will use interval instead of end of day
|
|
|
|
// default to the station timezone
|
|
$timezone = Application_Model_Preference::GetDefaultTimezone();
|
|
$userDefinedTimezone = strtolower($request->getParam('timezone') ?? '');
|
|
$upcase = false; // only upcase the timezone abbreviations
|
|
$this->updateTimezone($userDefinedTimezone, $timezone, $upcase);
|
|
|
|
$type = $request->getParam('type');
|
|
$limit = $request->getParam('limit');
|
|
if ($limit == '' || !is_numeric($limit)) {
|
|
$limit = '5';
|
|
}
|
|
/* This is some *extremely* lazy programming that needs to be fixed. For some reason
|
|
* we are using two entirely different codepaths for very similar functionality (type = endofday
|
|
* vs type = interval). Needs to be fixed for 2.3 - MK */
|
|
if ($type == 'endofday') {
|
|
// make getNextShows use end of day
|
|
$end = Application_Common_DateHelper::getTodayStationEndDateTime();
|
|
$end->setTimezone(new DateTimeZone('UTC'));
|
|
$utcTimeEnd = $end->format(DEFAULT_TIMESTAMP_FORMAT);
|
|
|
|
$result = [
|
|
'env' => APPLICATION_ENV,
|
|
'schedulerTime' => $utcTimeNow,
|
|
'currentShow' => Application_Model_Show::getCurrentShow($utcTimeNow),
|
|
'nextShow' => Application_Model_Show::getNextShows($utcTimeNow, $limit, $utcTimeEnd),
|
|
];
|
|
} else {
|
|
$result = Application_Model_Schedule::GetPlayOrderRangeOld($limit);
|
|
}
|
|
|
|
if (!isset($result)) {
|
|
$this->returnJsonOrJsonp($request, []);
|
|
}
|
|
|
|
$stationUrl = Config::getPublicUrl();
|
|
|
|
if (isset($result['previous'])) {
|
|
if (
|
|
(isset($result['previous']['type']) && $result['previous']['type'] != 'livestream')
|
|
&& isset($result['previous']['metadata'])
|
|
) {
|
|
$previousID = $result['previous']['metadata']['id'];
|
|
$get_prev_artwork_url = $stationUrl . 'api/track?id=' . $previousID . '&return=artwork';
|
|
$result['previous']['metadata']['artwork_url'] = $get_prev_artwork_url;
|
|
}
|
|
}
|
|
|
|
if (isset($result['current'])) {
|
|
if (
|
|
(isset($result['current']['type']) & $result['current']['type'] != 'livestream')
|
|
&& isset($result['current']['metadata'])
|
|
) {
|
|
$currID = $result['current']['metadata']['id'];
|
|
$get_curr_artwork_url = $stationUrl . 'api/track?id=' . $currID . '&return=artwork';
|
|
$result['current']['metadata']['artwork_url'] = $get_curr_artwork_url;
|
|
}
|
|
}
|
|
|
|
if (isset($result['next'])) {
|
|
if (
|
|
(isset($result['next']['type']) && $result['next']['type'] != 'livestream')
|
|
&& isset($result['next']['metadata'])
|
|
) {
|
|
$nextID = $result['next']['metadata']['id'];
|
|
$get_next_artwork_url = $stationUrl . 'api/track?id=' . $nextID . '&return=artwork';
|
|
$result['next']['metadata']['artwork_url'] = $get_next_artwork_url;
|
|
}
|
|
}
|
|
|
|
// apply user-defined timezone, or default to station
|
|
Application_Common_DateHelper::convertTimestampsToTimezone(
|
|
$result['currentShow'],
|
|
['starts', 'ends', 'start_timestamp', 'end_timestamp'],
|
|
$timezone
|
|
);
|
|
Application_Common_DateHelper::convertTimestampsToTimezone(
|
|
$result['nextShow'],
|
|
['starts', 'ends', 'start_timestamp', 'end_timestamp'],
|
|
$timezone
|
|
);
|
|
|
|
// Convert the UTC scheduler time ("now") to the user-defined timezone.
|
|
$result['schedulerTime'] = Application_Common_DateHelper::UTCStringToTimezoneString($result['schedulerTime'], $timezone);
|
|
$result['timezone'] = $upcase ? strtoupper($timezone) : $timezone;
|
|
$result['timezoneOffset'] = Application_Common_DateHelper::getTimezoneOffset($timezone);
|
|
|
|
// XSS exploit prevention
|
|
SecurityHelper::htmlescape_recursive($result);
|
|
|
|
// convert image paths to point to api endpoints
|
|
WidgetHelper::findAndConvertPaths($result);
|
|
|
|
// used by caller to determine if the airtime they are running or widgets in use is out of date.
|
|
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
|
|
|
|
$this->returnJsonOrJsonp($request, $result);
|
|
} else {
|
|
header('HTTP/1.0 401 Unauthorized');
|
|
echo _('You are not allowed to access this resource. ');
|
|
|
|
exit;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Retrieve the currently playing show as well as upcoming shows.
|
|
* Number of shows returned and the time interval in which to
|
|
* get the next shows can be configured as GET parameters.
|
|
*
|
|
* Possible parameters:
|
|
* days - How many days to retrieve.
|
|
* Default is 2 (today + tomorrow).
|
|
* shows - How many shows to retrieve
|
|
* Default is 5.
|
|
* timezone - The timezone to send the times in
|
|
* Defaults to the station timezone
|
|
*/
|
|
public function liveInfoV2Action()
|
|
{
|
|
if (Application_Model_Preference::GetAllow3rdPartyApi() || $this->checkAuth()) {
|
|
// disable the view and the layout
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
$request = $this->getRequest();
|
|
|
|
// default to the station timezone
|
|
$timezone = Application_Model_Preference::GetDefaultTimezone();
|
|
$userDefinedTimezone = strtolower($request->getParam('timezone') ?? '');
|
|
$upcase = false; // only upcase the timezone abbreviations
|
|
$this->updateTimezone($userDefinedTimezone, $timezone, $upcase);
|
|
|
|
$daysToRetrieve = $request->getParam('days');
|
|
$showsToRetrieve = $request->getParam('shows');
|
|
if ($daysToRetrieve == '' || !is_numeric($daysToRetrieve)) {
|
|
$daysToRetrieve = self::DEFAULT_DAYS_TO_RETRIEVE;
|
|
}
|
|
if ($showsToRetrieve == '' || !is_numeric($showsToRetrieve)) {
|
|
$showsToRetrieve = self::DEFAULT_SHOWS_TO_RETRIEVE;
|
|
}
|
|
|
|
// set the end time to the day's start n days from now.
|
|
// days=1 will return shows until the end of the current day,
|
|
// days=2 will return shows until the end of tomorrow, etc.
|
|
$end = Application_Common_DateHelper::getEndDateTime($timezone, $daysToRetrieve);
|
|
$end->setTimezone(new DateTimeZone('UTC'));
|
|
$utcTimeEnd = $end->format(DEFAULT_TIMESTAMP_FORMAT);
|
|
|
|
$result = Application_Model_Schedule::GetPlayOrderRange($utcTimeEnd, $showsToRetrieve);
|
|
|
|
// apply user-defined timezone, or default to station
|
|
$this->applyLiveTimezoneAdjustments($result, $timezone, $upcase);
|
|
|
|
// XSS exploit prevention
|
|
SecurityHelper::htmlescape_recursive($result);
|
|
|
|
// convert image paths to point to api endpoints
|
|
WidgetHelper::findAndConvertPaths($result);
|
|
|
|
// Expose the live source status
|
|
$live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj');
|
|
$master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj');
|
|
$scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play');
|
|
$result['sources'] = [];
|
|
$result['sources']['livedj'] = $live_dj;
|
|
$result['sources']['masterdj'] = $master_dj;
|
|
$result['sources']['scheduledplay'] = $scheduled_play;
|
|
|
|
// used by caller to determine if the airtime they are running or widgets in use is out of date.
|
|
$result['station']['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
|
|
|
|
$this->returnJsonOrJsonp($request, $result);
|
|
} else {
|
|
header('HTTP/1.0 401 Unauthorized');
|
|
echo _('You are not allowed to access this resource. ');
|
|
|
|
exit;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Check that the value for the timezone the user gave is valid.
|
|
* If it is, override the default (station) timezone.
|
|
* If it's an abbreviation (pst, edt) we upcase the output.
|
|
*
|
|
* @param string $userDefinedTimezone the requested timezone value
|
|
* @param string $timezone the default timezone
|
|
* @param bool $upcase whether the timezone output should be upcased
|
|
*/
|
|
private function updateTimezone($userDefinedTimezone, &$timezone, &$upcase)
|
|
{
|
|
$delimiter = '/';
|
|
// if the user passes in a timezone in standard form ("Continent/City")
|
|
// we need to fix the downcased string by upcasing each word delimited by a /
|
|
if (strpos($userDefinedTimezone, $delimiter) !== false) {
|
|
$userDefinedTimezone = implode($delimiter, array_map('ucfirst', explode($delimiter, $userDefinedTimezone)));
|
|
}
|
|
// if the timezone defined by the user exists, use that
|
|
if (array_key_exists($userDefinedTimezone, timezone_abbreviations_list())) {
|
|
$timezone = $userDefinedTimezone;
|
|
$upcase = true;
|
|
} elseif (in_array($userDefinedTimezone, timezone_identifiers_list())) {
|
|
$timezone = $userDefinedTimezone;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* If the user passed in a timezone parameter, adjust timezone-dependent
|
|
* variables in the result to reflect the given timezone.
|
|
*
|
|
* @param array $result reference to the object to send back to the user
|
|
* @param string $timezone the user's timezone parameter value
|
|
* @param bool $upcase whether the timezone output should be upcased
|
|
*/
|
|
private function applyLiveTimezoneAdjustments(&$result, $timezone, $upcase)
|
|
{
|
|
Application_Common_DateHelper::convertTimestampsToTimezone(
|
|
$result,
|
|
['starts', 'ends', 'start_timestamp', 'end_timestamp'],
|
|
$timezone
|
|
);
|
|
|
|
// Convert the UTC scheduler time ("now") to the user-defined timezone.
|
|
$result['station']['schedulerTime'] = Application_Common_DateHelper::UTCStringToTimezoneString($result['station']['schedulerTime'], $timezone);
|
|
$result['station']['timezone'] = $upcase ? strtoupper($timezone) : $timezone;
|
|
}
|
|
|
|
public function weekInfoAction()
|
|
{
|
|
if (Application_Model_Preference::GetAllow3rdPartyApi() || $this->checkAuth()) {
|
|
// disable the view and the layout
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
$request = $this->getRequest();
|
|
$result = WidgetHelper::getWeekInfo($this->getRequest()->getParam('timezone'));
|
|
|
|
// used by caller to determine if the airtime they are running or widgets in use is out of date.
|
|
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
|
|
|
|
$this->returnJsonOrJsonp($request, $result);
|
|
} else {
|
|
header('HTTP/1.0 401 Unauthorized');
|
|
echo _('You are not allowed to access this resource. ');
|
|
|
|
exit;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* API endpoint to display the show logo.
|
|
*/
|
|
public function showLogoAction()
|
|
{
|
|
// Disable the view and the layout
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
if (Application_Model_Preference::GetAllow3rdPartyApi() || $this->checkAuth()) {
|
|
$request = $this->getRequest();
|
|
$showId = $request->getParam('id');
|
|
if (empty($showId)) {
|
|
throw new ZendActionHttpException($this, 400, 'ERROR: No ID was given.');
|
|
}
|
|
|
|
$show = CcShowQuery::create()->findPk($showId);
|
|
if (empty($show)) {
|
|
throw new ZendActionHttpException($this, 400, "ERROR: No show with ID {$showId} exists.");
|
|
}
|
|
|
|
$path = $show->getDbImagePath();
|
|
|
|
try {
|
|
$mime_type = mime_content_type($path);
|
|
if (empty($path)) {
|
|
throw new ZendActionHttpException($this, 400, 'ERROR: Show does not have an associated image.');
|
|
}
|
|
} catch (Exception $e) {
|
|
// To avoid broken images on your site, we return the station logo if we can't find the show logo.
|
|
$this->_redirect('api/station-logo');
|
|
|
|
return;
|
|
}
|
|
|
|
try {
|
|
// Sometimes end users may be looking at stale data - if an image is removed
|
|
// but has been cached in a client's browser this will throw an exception
|
|
Application_Common_FileIO::smartReadFile($path, filesize($path), $mime_type);
|
|
} catch (LibreTimeFileNotFoundException $e) {
|
|
// throw new ZendActionHttpException($this, 404, "ERROR: No image found at $path");
|
|
$this->_redirect('api/station-logo');
|
|
|
|
return;
|
|
} catch (Exception $e) {
|
|
throw new ZendActionHttpException($this, 500, 'ERROR: ' . $e->getMessage());
|
|
}
|
|
} else {
|
|
header('HTTP/1.0 401 Unauthorized');
|
|
echo _('You are not allowed to access this resource. ');
|
|
|
|
exit;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* New API endpoint to display metadata from any single track.
|
|
*
|
|
* Find metadata to any track imported (eg. id=1&return=json)
|
|
*/
|
|
public function trackAction()
|
|
{
|
|
// Disable the view and the layout
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
if (Application_Model_Preference::GetAllow3rdPartyApi() || $this->checkAuth()) {
|
|
$request = $this->getRequest();
|
|
$trackid = $request->getParam('id');
|
|
$return = $request->getParam('return');
|
|
|
|
if (empty($return)) {
|
|
throw new ZendActionHttpException($this, 400, 'ERROR: No return was given.');
|
|
}
|
|
|
|
if (empty($trackid)) {
|
|
throw new ZendActionHttpException($this, 400, 'ERROR: No ID was given.');
|
|
}
|
|
|
|
$fp = Config::getStoragePath();
|
|
|
|
// $this->view->type = $type;
|
|
$file = Application_Model_StoredFile::RecallById($trackid);
|
|
$md = $file->getMetadata();
|
|
|
|
if ($return === 'artwork-data') {
|
|
foreach ($md as $key => $value) {
|
|
if ($key == 'MDATA_KEY_ARTWORK' && !is_null($value)) {
|
|
FileDataHelper::renderDataURI($fp . $md['MDATA_KEY_ARTWORK']);
|
|
}
|
|
}
|
|
} elseif ($return === 'artwork-data-32') {
|
|
foreach ($md as $key => $value) {
|
|
if ($key == 'MDATA_KEY_ARTWORK' && !is_null($value)) {
|
|
FileDataHelper::renderDataURI($fp . $md['MDATA_KEY_ARTWORK'] . '-32');
|
|
}
|
|
}
|
|
} elseif ($return === 'artwork') {
|
|
// default
|
|
foreach ($md as $key => $value) {
|
|
if ($key == 'MDATA_KEY_ARTWORK' && !is_null($value)) {
|
|
FileDataHelper::renderImage($fp . $md['MDATA_KEY_ARTWORK'] . '-512.jpg');
|
|
}
|
|
}
|
|
} elseif ($return === 'artwork-32') {
|
|
foreach ($md as $key => $value) {
|
|
if ($key == 'MDATA_KEY_ARTWORK' && !is_null($value)) {
|
|
FileDataHelper::renderImage($fp . $md['MDATA_KEY_ARTWORK'] . '-32.jpg');
|
|
}
|
|
}
|
|
} elseif ($return === 'artwork-64') {
|
|
foreach ($md as $key => $value) {
|
|
if ($key == 'MDATA_KEY_ARTWORK' && !is_null($value)) {
|
|
FileDataHelper::renderImage($fp . $md['MDATA_KEY_ARTWORK'] . '-64.jpg');
|
|
}
|
|
}
|
|
} elseif ($return === 'artwork-128') {
|
|
foreach ($md as $key => $value) {
|
|
if ($key == 'MDATA_KEY_ARTWORK' && !is_null($value)) {
|
|
FileDataHelper::renderImage($fp . $md['MDATA_KEY_ARTWORK'] . '-128.jpg');
|
|
}
|
|
}
|
|
} elseif ($return === 'artwork-512') {
|
|
foreach ($md as $key => $value) {
|
|
if ($key == 'MDATA_KEY_ARTWORK' && !is_null($value)) {
|
|
FileDataHelper::renderImage($fp . $md['MDATA_KEY_ARTWORK'] . '-512.jpg');
|
|
}
|
|
}
|
|
} elseif ($return === 'json') {
|
|
$data = json_encode($md);
|
|
echo $data;
|
|
}
|
|
} else {
|
|
header('HTTP/1.0 401 Unauthorized');
|
|
echo _('You are not allowed to access this resource. ');
|
|
|
|
exit;
|
|
}
|
|
}
|
|
|
|
public function trackTypesAction()
|
|
{
|
|
if (Application_Model_Preference::GetAllow3rdPartyApi() || $this->checkAuth()) {
|
|
// disable the view and the layout
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
$tracktypes = Application_Model_Tracktype::getTracktypes();
|
|
$this->_helper->json->sendJson($tracktypes);
|
|
} else {
|
|
header('HTTP/1.0 401 Unauthorized');
|
|
echo _('You are not allowed to access this resource. ');
|
|
|
|
exit;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* API endpoint to provide station metadata.
|
|
*/
|
|
public function stationMetadataAction()
|
|
{
|
|
if (Application_Model_Preference::GetAllow3rdPartyApi() || $this->checkAuth()) {
|
|
// disable the view and the layout
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$result['name'] = Application_Model_Preference::GetStationName();
|
|
$result['logo'] = Config::getPublicUrl() . 'api/station-logo';
|
|
$result['description'] = Application_Model_Preference::GetStationDescription();
|
|
$result['timezone'] = Application_Model_Preference::GetDefaultTimezone();
|
|
$result['locale'] = Application_Model_Preference::GetDefaultLocale();
|
|
$result['stream_data'] = Application_Model_StreamSetting::getEnabledStreamData();
|
|
|
|
// used by caller to determine if the airtime they are running or widgets in use is out of date.
|
|
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
|
|
|
|
$this->returnJsonOrJsonp($request, $result);
|
|
} else {
|
|
header('HTTP/1.0 401 Unauthorized');
|
|
echo _('You are not allowed to access this resource. ');
|
|
|
|
exit;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* API endpoint to display the current station logo.
|
|
*/
|
|
public function stationLogoAction()
|
|
{
|
|
if (Application_Model_Preference::GetAllow3rdPartyApi() || $this->checkAuth()) {
|
|
// disable the view and the layout
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
$logo = Application_Model_Preference::GetStationLogo();
|
|
// if there's no logo, just die - redirects to a 404
|
|
if (!$logo || $logo === '') {
|
|
return;
|
|
}
|
|
|
|
// we're passing this as an image instead of using it in a data uri, so decode it
|
|
$blob = base64_decode($logo);
|
|
|
|
// use finfo to get the mimetype from the decoded blob
|
|
$f = finfo_open();
|
|
$mime_type = finfo_buffer($f, $blob, FILEINFO_MIME_TYPE);
|
|
finfo_close($f);
|
|
|
|
header('Content-Type: ' . $mime_type);
|
|
echo $blob;
|
|
} else {
|
|
header('HTTP/1.0 401 Unauthorized');
|
|
echo _('You are not allowed to access this resource.');
|
|
|
|
exit;
|
|
}
|
|
}
|
|
|
|
public function scheduleAction()
|
|
{
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
$data = Application_Model_Schedule::getSchedule();
|
|
|
|
echo json_encode($data, JSON_FORCE_OBJECT);
|
|
}
|
|
|
|
public function notifyMediaItemStartPlayAction()
|
|
{
|
|
$media_id = $this->_getParam('media_id');
|
|
|
|
// We send a fake media id when playing on-demand ads;
|
|
// in this case, simply return
|
|
if ($media_id === '0' || $media_id === '-1') {
|
|
return;
|
|
}
|
|
|
|
Logging::debug("Received notification of new media item start: {$media_id}");
|
|
Application_Model_Schedule::UpdateMediaPlayedStatus($media_id);
|
|
|
|
try {
|
|
$historyService = new Application_Service_HistoryService();
|
|
$historyService->insertPlayedItem($media_id);
|
|
|
|
// set a 'last played' timestamp for media item
|
|
// needed for smart blocks
|
|
$mediaType = Application_Model_Schedule::GetType($media_id);
|
|
if ($mediaType == 'file') {
|
|
$file_id = Application_Model_Schedule::GetFileId($media_id);
|
|
if (!is_null($file_id)) {
|
|
// we are dealing with a file not a stream
|
|
$file = Application_Model_StoredFile::RecallById($file_id);
|
|
$now = new DateTime('now', new DateTimeZone('UTC'));
|
|
$file->setLastPlayedTime($now);
|
|
|
|
// Push metadata to TuneIn
|
|
if (Application_Model_Preference::getTuneinEnabled()) {
|
|
$filePropelOrm = $file->getPropelOrm();
|
|
$title = urlencode($filePropelOrm->getDbTrackTitle());
|
|
$artist = urlencode($filePropelOrm->getDbArtistName());
|
|
Application_Common_TuneIn::sendMetadataToTunein($title, $artist);
|
|
}
|
|
}
|
|
} else {
|
|
// webstream
|
|
$stream_id = Application_Model_Schedule::GetStreamId($media_id);
|
|
if (!is_null($stream_id)) {
|
|
$webStream = new Application_Model_Webstream($stream_id);
|
|
$now = new DateTime('now', new DateTimeZone('UTC'));
|
|
$webStream->setLastPlayed($now);
|
|
}
|
|
}
|
|
} catch (Exception $e) {
|
|
Logging::info($e);
|
|
}
|
|
|
|
$this->_helper->json->sendJson(['status' => 1, 'message' => '']);
|
|
}
|
|
|
|
public function recordedShowsAction()
|
|
{
|
|
$utcTimezone = new DateTimeZone('UTC');
|
|
$nowDateTime = new DateTime('now', $utcTimezone);
|
|
$endDateTime = clone $nowDateTime;
|
|
$endDateTime = $endDateTime->add(new DateInterval('PT2H'));
|
|
|
|
$this->view->shows = Application_Model_Show::getShows(
|
|
$nowDateTime,
|
|
$endDateTime,
|
|
$onlyRecord = true
|
|
);
|
|
|
|
$this->view->is_recording = false;
|
|
$this->view->server_timezone = Application_Model_Preference::GetDefaultTimezone();
|
|
|
|
$rows = Application_Model_Show::getCurrentShow();
|
|
|
|
if (count($rows) > 0) {
|
|
$this->view->is_recording = ($rows[0]['record'] == 1);
|
|
}
|
|
}
|
|
|
|
public function uploadRecordedAction()
|
|
{
|
|
$show_instance_id = $this->_getParam('showinstanceid');
|
|
$file_id = $this->_getParam('fileid');
|
|
$this->view->fileid = $file_id;
|
|
$this->view->showinstanceid = $show_instance_id;
|
|
$this->uploadRecordedActionParam($show_instance_id, $file_id);
|
|
}
|
|
|
|
// The paramterized version of the uploadRecordedAction controller.
|
|
// We want this controller's action to be invokable from other
|
|
// controllers instead being of only through http
|
|
public function uploadRecordedActionParam($show_instance_id, $file_id)
|
|
{
|
|
$showCanceled = false;
|
|
$file = Application_Model_StoredFile::RecallById($file_id);
|
|
// $show_instance = $this->_getParam('show_instance');
|
|
|
|
try {
|
|
$show_inst = new Application_Model_ShowInstance($show_instance_id);
|
|
$show_inst->setRecordedFile($file_id);
|
|
} catch (Exception $e) {
|
|
// we've reached here probably because the show was
|
|
// cancelled, and therefore the show instance does not exist
|
|
// anymore (ShowInstance constructor threw this error). We've
|
|
// done all we can do (upload the file and put it in the
|
|
// library), now lets just return.
|
|
$showCanceled = true;
|
|
}
|
|
|
|
// TODO : the following is inefficient because it calls save on both
|
|
// fields
|
|
$file->setMetadataValue('MDATA_KEY_CREATOR', 'Airtime Show Recorder');
|
|
$file->setMetadataValue('MDATA_KEY_TRACKNUMBER', $show_instance_id);
|
|
}
|
|
|
|
public function mediaMonitorSetupAction()
|
|
{
|
|
$this->view->stor = Config::getStoragePath();
|
|
|
|
$watchedDirsPath = [];
|
|
$this->view->watched_dirs = $watchedDirsPath;
|
|
}
|
|
|
|
public function dispatchMetadata($md, $mode)
|
|
{
|
|
$return_hash = [];
|
|
Application_Model_Preference::SetImportTimestamp();
|
|
|
|
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
|
$con->beginTransaction();
|
|
|
|
try {
|
|
// create also modifies the file if it exists
|
|
if ($mode == 'create') {
|
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
|
$filepath = Application_Common_OsPath::normpath($filepath);
|
|
$file = Application_Model_StoredFile::RecallByFilepath($filepath, $con);
|
|
if (is_null($file)) {
|
|
$file = Application_Model_StoredFile::Insert($md, $con);
|
|
} else {
|
|
// If the file already exists we will update and make sure that
|
|
// it's marked as 'exists'.
|
|
$file->setFileExistsFlag(true);
|
|
$file->setFileHiddenFlag(false);
|
|
$file->setMetadata($md);
|
|
}
|
|
if ($md['is_record'] != 0) {
|
|
$this->uploadRecordedActionParam($md['MDATA_KEY_TRACKNUMBER'], $file->getId());
|
|
}
|
|
} elseif ($mode == 'modify') {
|
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
|
$file = Application_Model_StoredFile::RecallByFilepath($filepath, $con);
|
|
|
|
// File is not in database anymore.
|
|
if (is_null($file)) {
|
|
$return_hash['error'] = sprintf(_('File does not exist in %s'), PRODUCT_NAME);
|
|
}
|
|
// Updating a metadata change.
|
|
else {
|
|
// CC-5207 - restart media-monitor causes it to reevaluate all
|
|
// files in watched directories, and reset their cue-in/cue-out
|
|
// values. Since media-monitor has nothing to do with cue points
|
|
// let's unset it here. Note that on mode == "create", we still
|
|
// want media-monitor sending info about cue_out which by default
|
|
// will be equal to length of track until silan can take over.
|
|
unset($md['MDATA_KEY_CUE_IN'], $md['MDATA_KEY_CUE_OUT']);
|
|
|
|
$file->setMetadata($md);
|
|
}
|
|
} elseif ($mode == 'moved') {
|
|
$file = Application_Model_StoredFile::RecallByFilepath(
|
|
$md['MDATA_KEY_ORIGINAL_PATH'],
|
|
$con
|
|
);
|
|
|
|
if (is_null($file)) {
|
|
$return_hash['error'] = sprintf(_('File does not exist in %s'), PRODUCT_NAME);
|
|
} else {
|
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
|
// $filepath = str_replace("\\", "", $filepath);
|
|
$file->setFilePath($filepath);
|
|
}
|
|
} elseif ($mode == 'delete') {
|
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
|
$filepath = str_replace('\\', '', $filepath);
|
|
$file = Application_Model_StoredFile::RecallByFilepath($filepath, $con);
|
|
|
|
if (is_null($file)) {
|
|
$return_hash['error'] = sprintf(_('File does not exist in %s'), PRODUCT_NAME);
|
|
Logging::warn("Attempt to delete file that doesn't exist.
|
|
Path: '{$filepath}'");
|
|
} else {
|
|
$file->deleteByMediaMonitor();
|
|
}
|
|
} elseif ($mode == 'delete_dir') {
|
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
|
// $filepath = str_replace("\\", "", $filepath);
|
|
$files = Application_Model_StoredFile::RecallByPartialFilepath($filepath, $con);
|
|
|
|
foreach ($files as $file) {
|
|
$file->deleteByMediaMonitor();
|
|
}
|
|
$return_hash['success'] = 1;
|
|
}
|
|
|
|
if (!isset($return_hash['error'])) {
|
|
$return_hash['fileid'] = is_null($file) ? '-1' : $file->getId();
|
|
}
|
|
$con->commit();
|
|
} catch (Exception $e) {
|
|
Logging::warn('rolling back');
|
|
Logging::warn($e->getMessage());
|
|
$con->rollback();
|
|
$return_hash['error'] = $e->getMessage();
|
|
}
|
|
|
|
return $return_hash;
|
|
}
|
|
|
|
public function reloadMetadataGroupAction()
|
|
{
|
|
// extract all file metadata params from the request.
|
|
// The value is a json encoded hash that has all the information related to this action
|
|
// The key(mdXXX) does not have any meaning as of yet but it could potentially correspond
|
|
// to some unique id.
|
|
$request = $this->getRequest();
|
|
$responses = [];
|
|
$params = $request->getParams();
|
|
$valid_modes = ['delete_dir', 'delete', 'moved', 'modify', 'create'];
|
|
foreach ($params as $k => $raw_json) {
|
|
// Valid requests must start with mdXXX where XXX represents at
|
|
// least 1 digit
|
|
if (!preg_match('/^md\d+$/', $k)) {
|
|
continue;
|
|
}
|
|
$info_json = json_decode($raw_json, $assoc = true);
|
|
|
|
// Log invalid requests
|
|
if (!array_key_exists('mode', $info_json)) {
|
|
Logging::info("Received bad request(key={$k}), no 'mode' parameter. Bad request is:");
|
|
Logging::info($info_json);
|
|
array_push($responses, [
|
|
'error' => _("Bad request. no 'mode' parameter passed."),
|
|
'key' => $k,
|
|
]);
|
|
|
|
continue;
|
|
}
|
|
if (!in_array($info_json['mode'], $valid_modes)) {
|
|
// A request still has a chance of being invalid even if it
|
|
// exists but it's validated by $valid_modes array
|
|
$mode = $info_json['mode'];
|
|
Logging::info("Received bad request(key={$k}). 'mode' parameter was invalid with value: '{$mode}'. Request:");
|
|
Logging::info($info_json);
|
|
array_push($responses, [
|
|
'error' => _("Bad request. 'mode' parameter is invalid"),
|
|
'key' => $k,
|
|
'mode' => $mode,
|
|
]);
|
|
|
|
continue;
|
|
}
|
|
// Removing 'mode' key from $info_json might not be necessary...
|
|
$mode = $info_json['mode'];
|
|
unset($info_json['mode']);
|
|
|
|
try {
|
|
$response = $this->dispatchMetadata($info_json, $mode);
|
|
} catch (Exception $e) {
|
|
Logging::warn($e->getMessage());
|
|
Logging::warn(gettype($e));
|
|
}
|
|
// We tack on the 'key' back to every request in case the would like to associate
|
|
// his requests with particular responses
|
|
$response['key'] = $k;
|
|
array_push($responses, $response);
|
|
}
|
|
$this->_helper->json->sendJson($responses);
|
|
}
|
|
|
|
public function listAllFilesAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$dir_id = $request->getParam('dir_id');
|
|
$all = $request->getParam('all');
|
|
|
|
$this->view->files = Application_Model_StoredFile::listAllFiles($dir_id, $all);
|
|
}
|
|
|
|
public function getStreamSettingAction()
|
|
{
|
|
$info = Application_Model_StreamSetting::getStreamSetting();
|
|
$this->view->msg = $info;
|
|
}
|
|
|
|
public function statusAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$getDiskInfo = $request->getParam('diskinfo') == 'true';
|
|
$config = Config::getConfig();
|
|
|
|
$status = [
|
|
'platform' => Application_Model_Systemstatus::GetPlatformInfo(),
|
|
'airtime_version' => $config['airtime_version'],
|
|
'services' => [
|
|
'pypo' => Application_Model_Systemstatus::GetPypoStatus(),
|
|
'liquidsoap' => Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
|
'media_monitor' => Application_Model_Systemstatus::GetMediaMonitorStatus(),
|
|
],
|
|
];
|
|
|
|
if ($getDiskInfo) {
|
|
$status['partitions'] = Application_Model_Systemstatus::GetDiskInfo();
|
|
}
|
|
|
|
$this->view->status = $status;
|
|
}
|
|
|
|
public function registerComponentAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
|
|
$component = $request->getParam('component');
|
|
$remoteAddr = Application_Model_ServiceRegister::GetRemoteIpAddr();
|
|
Logging::info('Registered Component: ' . $component . '@' . $remoteAddr);
|
|
|
|
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
|
}
|
|
|
|
public function updateLiquidsoapStatusAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
|
|
$msg = $request->getParam('msg_post');
|
|
$stream_id = $request->getParam('stream_id');
|
|
$boot_time = $request->getParam('boot_time');
|
|
|
|
Application_Model_Preference::setLiquidsoapError($stream_id, $msg, $boot_time);
|
|
}
|
|
|
|
public function updateSourceStatusAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
|
|
$sourcename = $request->getParam('sourcename');
|
|
$status = $request->getParam('status');
|
|
|
|
// on source disconnection sent msg to pypo to turn off the switch
|
|
// Added AutoTransition option
|
|
if ($status == 'false' && Application_Model_Preference::GetAutoTransition()) {
|
|
$data = ['sourcename' => $sourcename, 'status' => 'off'];
|
|
Application_Model_RabbitMq::SendMessageToPypo('switch_source', $data);
|
|
Application_Model_Preference::SetSourceSwitchStatus($sourcename, 'off');
|
|
Application_Model_LiveLog::SetEndTime(
|
|
$sourcename == 'scheduled_play' ? 'S' : 'L',
|
|
new DateTime('now', new DateTimeZone('UTC'))
|
|
);
|
|
} elseif ($status == 'true' && Application_Model_Preference::GetAutoSwitch()) {
|
|
$data = ['sourcename' => $sourcename, 'status' => 'on'];
|
|
Application_Model_RabbitMq::SendMessageToPypo('switch_source', $data);
|
|
Application_Model_Preference::SetSourceSwitchStatus($sourcename, 'on');
|
|
Application_Model_LiveLog::SetNewLogTime(
|
|
$sourcename == 'scheduled_play' ? 'S' : 'L',
|
|
new DateTime('now', new DateTimeZone('UTC'))
|
|
);
|
|
}
|
|
Application_Model_Preference::SetSourceStatus($sourcename, $status);
|
|
}
|
|
|
|
/* This action is for use by our dev scripts, that make
|
|
* a change to the database and we want rabbitmq to send
|
|
* out a message to pypo that a potential change has been made. */
|
|
public function rabbitmqDoPushAction()
|
|
{
|
|
Logging::info('Notifying RabbitMQ to send message to pypo');
|
|
|
|
Application_Model_RabbitMq::SendMessageToPypo('reset_liquidsoap_bootstrap', []);
|
|
Application_Model_RabbitMq::PushSchedule();
|
|
}
|
|
|
|
public function getBootstrapInfoAction()
|
|
{
|
|
$live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj');
|
|
$master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj');
|
|
$scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play');
|
|
|
|
$res = ['live_dj' => $live_dj, 'master_dj' => $master_dj, 'scheduled_play' => $scheduled_play];
|
|
$this->view->switch_status = $res;
|
|
$this->view->station_name = Application_Model_Preference::GetStationName();
|
|
$this->view->stream_label = Application_Model_Preference::GetStreamLabelFormat();
|
|
$this->view->transition_fade = Application_Model_Preference::GetDefaultTransitionFade();
|
|
}
|
|
|
|
// This is used but Liquidsoap to check authentication of live streams
|
|
public function checkLiveStreamAuthAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
|
|
$username = $request->getParam('username');
|
|
$password = $request->getParam('password');
|
|
$djtype = $request->getParam('djtype');
|
|
|
|
if ($djtype == 'master') {
|
|
// check against master
|
|
if (
|
|
$username == Application_Model_Preference::GetLiveStreamMasterUsername()
|
|
&& $password == Application_Model_Preference::GetLiveStreamMasterPassword()
|
|
) {
|
|
$this->view->msg = true;
|
|
} else {
|
|
$this->view->msg = false;
|
|
}
|
|
} elseif ($djtype == 'dj') {
|
|
// check against show dj auth
|
|
$showInfo = Application_Model_Show::getCurrentShow();
|
|
|
|
// there is current playing show
|
|
if (isset($showInfo[0]['id'])) {
|
|
$current_show_id = $showInfo[0]['id'];
|
|
$CcShow = CcShowQuery::create()->findPK($current_show_id);
|
|
|
|
// get custom pass info from the show
|
|
$custom_user = $CcShow->getDbLiveStreamUser();
|
|
$custom_pass = $CcShow->getDbLiveStreamPass();
|
|
|
|
// get hosts ids
|
|
$show = new Application_Model_Show($current_show_id);
|
|
$hosts_ids = $show->getHostsIds();
|
|
|
|
// check against hosts auth
|
|
if ($CcShow->getDbLiveStreamUsingAirtimeAuth()) {
|
|
foreach ($hosts_ids as $host) {
|
|
$h = new Application_Model_User($host['subjs_id']);
|
|
if ($username == $h->getLogin() && md5($password) == $h->getPassword()) {
|
|
$this->view->msg = true;
|
|
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
// check against custom auth
|
|
if ($CcShow->getDbLiveStreamUsingCustomAuth()) {
|
|
if ($username == $custom_user && $password == $custom_pass) {
|
|
$this->view->msg = true;
|
|
} else {
|
|
$this->view->msg = false;
|
|
}
|
|
} else {
|
|
$this->view->msg = false;
|
|
}
|
|
} else {
|
|
// no show is currently playing
|
|
$this->view->msg = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* This action is for use by our dev scripts, that make
|
|
* a change to the database and we want rabbitmq to send
|
|
* out a message to pypo that a potential change has been made. */
|
|
public function getFilesWithoutReplayGainAction()
|
|
{
|
|
$dir_id = $this->_getParam('dir_id');
|
|
|
|
// connect to db and get get sql
|
|
$rows = Application_Model_StoredFile::listAllFiles2($dir_id, 100);
|
|
|
|
$this->_helper->json->sendJson($rows);
|
|
}
|
|
|
|
public function getFilesWithoutSilanValueAction()
|
|
{
|
|
// connect to db and get get sql
|
|
$rows = Application_Model_StoredFile::getAllFilesWithoutSilan();
|
|
|
|
$this->_helper->json->sendJson($rows);
|
|
}
|
|
|
|
public function updateReplayGainValueAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$data = json_decode($request->getParam('data'));
|
|
|
|
foreach ($data as $pair) {
|
|
[$id, $gain] = $pair;
|
|
// TODO : move this code into model -- RG
|
|
$file = Application_Model_StoredFile::RecallById($p_id = $id)->getPropelOrm();
|
|
$file->setDbReplayGain($gain);
|
|
$file->save();
|
|
}
|
|
|
|
$this->_helper->json->sendJson([]);
|
|
}
|
|
|
|
public function updateCueValuesBySilanAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$data = json_decode($request->getParam('data'), $assoc = true);
|
|
|
|
foreach ($data as $pair) {
|
|
[$id, $info] = $pair;
|
|
// TODO : move this code into model -- RG
|
|
$file = Application_Model_StoredFile::RecallById($p_id = $id)->getPropelOrm();
|
|
|
|
// What we are doing here is setting a more accurate length that was
|
|
// calculated with silan by actually scanning the entire file. This
|
|
// process takes a really long time, and so we only do it in the background
|
|
// after the file has already been imported -MK
|
|
try {
|
|
$length = $file->getDbLength();
|
|
if (isset($info['length'])) {
|
|
$length = $info['length'];
|
|
// length decimal number in seconds. Need to convert it to format
|
|
// HH:mm:ss to get around silly PHP limitations.
|
|
$length = Application_Common_DateHelper::secondsToPlaylistTime($length);
|
|
$file->setDbLength($length);
|
|
}
|
|
|
|
$cuein = isset($info['cuein']) ? $info['cuein'] : 0;
|
|
$cueout = isset($info['cueout']) ? $info['cueout'] : $length;
|
|
|
|
$file->setDbCuein($cuein);
|
|
$file->setDbCueout($cueout);
|
|
$file->setDbSilanCheck(true);
|
|
$file->save();
|
|
} catch (Exception $e) {
|
|
Logging::info('Failed to update silan values for ' . $file->getDbTrackTitle());
|
|
Logging::info('File length analyzed by Silan is: ' . $length);
|
|
// set silan_check to true so we don't attempt to re-anaylze again
|
|
$file->setDbSilanCheck(true);
|
|
$file->save();
|
|
}
|
|
}
|
|
|
|
$this->_helper->json->sendJson([]);
|
|
}
|
|
|
|
public function notifyWebstreamDataAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$data = $request->getParam('data');
|
|
$media_id = intval($request->getParam('media_id'));
|
|
$data_arr = json_decode($data);
|
|
|
|
// $media_id is -1 sometimes when a stream has stopped playing
|
|
if (!is_null($media_id) && $media_id > 0) {
|
|
if (isset($data_arr->title)) {
|
|
$data_title = substr($data_arr->title, 0, 1024);
|
|
|
|
$previous_metadata = CcWebstreamMetadataQuery::create()
|
|
->orderByDbStartTime('desc')
|
|
->filterByDbInstanceId($media_id)
|
|
->findOne();
|
|
|
|
$do_insert = true;
|
|
if ($previous_metadata) {
|
|
if ($previous_metadata->getDbLiquidsoapData() == $data_title) {
|
|
Logging::debug('Duplicate found: ' . $data_title);
|
|
$do_insert = false;
|
|
}
|
|
}
|
|
|
|
if ($do_insert) {
|
|
$startDT = new DateTime('now', new DateTimeZone('UTC'));
|
|
|
|
$webstream_metadata = new CcWebstreamMetadata();
|
|
$webstream_metadata->setDbInstanceId($media_id);
|
|
$webstream_metadata->setDbStartTime($startDT);
|
|
$webstream_metadata->setDbLiquidsoapData($data_title);
|
|
$webstream_metadata->save();
|
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
$historyService->insertWebstreamMetadata($media_id, $startDT, $data_arr);
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->view->response = $data;
|
|
$this->view->media_id = $media_id;
|
|
}
|
|
|
|
public function getStreamParametersAction()
|
|
{
|
|
$streams = ['s1', 's2', 's3', 's4'];
|
|
$stream_params = [];
|
|
foreach ($streams as $s) {
|
|
$stream_params[$s] = Application_Model_StreamSetting::getStreamDataNormalized($s);
|
|
}
|
|
$this->view->stream_params = $stream_params;
|
|
}
|
|
|
|
public function pushStreamStatsAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
|
|
$data_blob = $request->getParam('data');
|
|
$data = json_decode($data_blob, true);
|
|
|
|
if ($data === null && json_last_error() !== JSON_ERROR_NONE) {
|
|
$message = "An error occured while decoding the 'data' JSON blob: '{$data_blob}'";
|
|
Logging::error($message);
|
|
$this->jsonError(400, $message);
|
|
|
|
return;
|
|
}
|
|
|
|
Application_Model_ListenerStat::insertDataPoints($data);
|
|
$this->view->data = $data;
|
|
}
|
|
|
|
public function updateStreamSettingTableAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
|
|
$data_blob = $request->getParam('data');
|
|
$data = json_decode($data_blob, true);
|
|
|
|
if ($data === null && json_last_error() !== JSON_ERROR_NONE) {
|
|
$message = "An error occured while decoding the 'data' JSON blob: '{$data_blob}'";
|
|
Logging::error($message);
|
|
$this->jsonError(400, $message);
|
|
|
|
return;
|
|
}
|
|
|
|
foreach ($data as $stream_id => $status) {
|
|
Application_Model_Preference::SetListenerStatError($stream_id, $status);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* display played items for a given time range and show instance_id.
|
|
*
|
|
* @return json array
|
|
*/
|
|
public function itemHistoryFeedAction()
|
|
{
|
|
try {
|
|
$request = $this->getRequest();
|
|
$params = $request->getParams();
|
|
$instance = $request->getParam('instance_id', null);
|
|
|
|
[$startsDT, $endsDT] = Application_Common_HTTPHelper::getStartEndFromRequest($request);
|
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
$results = $historyService->getPlayedItemData($startsDT, $endsDT, $params, $instance);
|
|
|
|
$this->_helper->json->sendJson($results['history']);
|
|
} catch (Exception $e) {
|
|
Logging::info($e);
|
|
Logging::info($e->getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* display show schedules for a given time range and show instance_id.
|
|
*
|
|
* @return json array
|
|
*/
|
|
public function showHistoryFeedAction()
|
|
{
|
|
try {
|
|
$request = $this->getRequest();
|
|
$params = $request->getParams();
|
|
$userId = $request->getParam('user_id', null);
|
|
|
|
[$startsDT, $endsDT] = Application_Common_HTTPHelper::getStartEndFromRequest($request);
|
|
|
|
$historyService = new Application_Service_HistoryService();
|
|
$shows = $historyService->getShowList($startsDT, $endsDT, $userId);
|
|
|
|
$this->_helper->json->sendJson($shows);
|
|
} catch (Exception $e) {
|
|
Logging::info($e);
|
|
Logging::info($e->getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* display show info (without schedule) for given show_id.
|
|
*
|
|
* @return json array
|
|
*/
|
|
public function showsAction()
|
|
{
|
|
try {
|
|
$request = $this->getRequest();
|
|
$params = $request->getParams();
|
|
$showId = $request->getParam('show_id', null);
|
|
$results = [];
|
|
|
|
if (empty($showId)) {
|
|
$shows = CcShowQuery::create()->find();
|
|
foreach ($shows as $show) {
|
|
$results[] = $show->getShowInfo();
|
|
}
|
|
} else {
|
|
$show = CcShowQuery::create()->findPK($showId);
|
|
$results[] = $show->getShowInfo();
|
|
}
|
|
|
|
$this->_helper->json->sendJson($results);
|
|
} catch (Exception $e) {
|
|
Logging::info($e);
|
|
Logging::info($e->getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* display show schedule for given show_id.
|
|
*
|
|
* @return json array
|
|
*/
|
|
public function showSchedulesAction()
|
|
{
|
|
try {
|
|
$request = $this->getRequest();
|
|
$params = $request->getParams();
|
|
$showId = $request->getParam('show_id', null);
|
|
|
|
[$startsDT, $endsDT] = Application_Common_HTTPHelper::getStartEndFromRequest($request);
|
|
|
|
if ((!isset($showId)) || (!is_numeric($showId))) {
|
|
// if (!isset($showId)) {
|
|
$this->_helper->json->sendJson(
|
|
['jsonrpc' => '2.0', 'error' => ['code' => 400, 'message' => 'missing invalid type for required show_id parameter. use type int.' . $showId]]
|
|
);
|
|
}
|
|
|
|
$shows = Application_Model_Show::getShows($startsDT, $endsDT, false, $showId);
|
|
|
|
// is this a valid show?
|
|
if (empty($shows)) {
|
|
$this->_helper->json->sendJson(
|
|
['jsonrpc' => '2.0', 'error' => ['code' => 204, 'message' => 'no content for requested show_id']]
|
|
);
|
|
}
|
|
|
|
$this->_helper->json->sendJson($shows);
|
|
} catch (Exception $e) {
|
|
Logging::info($e);
|
|
Logging::info($e->getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* displays track listing for given instance_id.
|
|
*
|
|
* @return json array
|
|
*/
|
|
public function showTracksAction()
|
|
{
|
|
$baseUrl = Config::getBasePath();
|
|
$prefTimezone = Application_Model_Preference::GetTimezone();
|
|
|
|
$instanceId = $this->_getParam('instance_id');
|
|
|
|
if ((!isset($instanceId)) || (!is_numeric($instanceId))) {
|
|
$this->_helper->json->sendJson(
|
|
['jsonrpc' => '2.0', 'error' => ['code' => 400, 'message' => 'missing invalid type for required instance_id parameter. use type int']]
|
|
);
|
|
}
|
|
|
|
$showInstance = new Application_Model_ShowInstance($instanceId);
|
|
$showInstanceContent = $showInstance->getShowListContent($prefTimezone);
|
|
|
|
// is this a valid show instance with content?
|
|
if (empty($showInstanceContent)) {
|
|
$this->_helper->json->sendJson(
|
|
['jsonrpc' => '2.0', 'error' => ['code' => 204, 'message' => 'no content for requested instance_id']]
|
|
);
|
|
}
|
|
|
|
$result = [];
|
|
$position = 0;
|
|
foreach ($showInstanceContent as $track) {
|
|
$elementMap = [
|
|
'title' => isset($track['track_title']) ? $track['track_title'] : '',
|
|
'artist' => isset($track['creator']) ? $track['creator'] : '',
|
|
'position' => $position,
|
|
'id' => ++$position,
|
|
'mime' => isset($track['mime']) ? $track['mime'] : '',
|
|
'starts' => isset($track['starts']) ? $track['starts'] : '',
|
|
'length' => isset($track['length']) ? $track['length'] : '',
|
|
'file_id' => ($track['type'] == 0) ? $track['item_id'] : $track['filepath'],
|
|
];
|
|
|
|
$result[] = $elementMap;
|
|
}
|
|
|
|
$this->_helper->json($result);
|
|
}
|
|
|
|
/**
|
|
* This function is called from PYPO (pypofetch) every 2 minutes and updates
|
|
* metadata on TuneIn if we haven't done so in the last 4 minutes. We have
|
|
* to do this because TuneIn turns off metadata if it has not received a
|
|
* request within 5 minutes. This is necessary for long tracks > 5 minutes.
|
|
*/
|
|
public function updateMetadataOnTuneinAction()
|
|
{
|
|
if (!Application_Model_Preference::getTuneinEnabled()) {
|
|
$this->_helper->json->sendJson([0]);
|
|
}
|
|
|
|
$lastTuneInMetadataUpdate = Application_Model_Preference::geLastTuneinMetadataUpdate();
|
|
if (time() - $lastTuneInMetadataUpdate >= 240) {
|
|
$metadata = $metadata = Application_Model_Schedule::getCurrentPlayingTrack();
|
|
if (!is_null($metadata)) {
|
|
Application_Common_TuneIn::sendMetadataToTunein(
|
|
$metadata['title'],
|
|
$metadata['artist']
|
|
);
|
|
}
|
|
}
|
|
$this->_helper->json->sendJson([1]);
|
|
}
|
|
|
|
public function getUsabilityHintAction()
|
|
{
|
|
$userPath = $this->_getParam('userPath');
|
|
|
|
$hint = Application_Common_UsabilityHints::getUsabilityHint($userPath);
|
|
$this->_helper->json->sendJson($hint);
|
|
}
|
|
|
|
public function streamM3uAction()
|
|
{
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
header('Content-Type: application/x-mpegurl');
|
|
header('Content-Disposition: attachment; filename=stream.m3u');
|
|
$m3uFile = "#EXTM3U\r\n\r\n"; // Windows linebreaks eh
|
|
|
|
$stationName = Application_Model_Preference::GetStationName();
|
|
$streamData = Application_Model_StreamSetting::getEnabledStreamData();
|
|
|
|
foreach ($streamData as $stream) {
|
|
$m3uFile .= '#EXTINF,' . $stationName . ' - ' . strtoupper($stream['codec']) . "\r\n";
|
|
$m3uFile .= $stream['url'] . "\r\n\r\n";
|
|
}
|
|
echo $m3uFile;
|
|
}
|
|
|
|
public function recalculateScheduleAction()
|
|
{
|
|
$this->view->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
Zend_Session::start();
|
|
|
|
$scheduler = new Application_Model_Scheduler();
|
|
session_write_close();
|
|
|
|
$now = new DateTime('now', new DateTimeZone('UTC'));
|
|
|
|
$showInstances = CcShowInstancesQuery::create()
|
|
->filterByDbStarts($now, Criteria::GREATER_THAN)
|
|
// ->filterByDbModifiedInstance(false)
|
|
->orderByDbStarts()
|
|
->find();
|
|
// ->find($this->con);
|
|
$total = $showInstances->count();
|
|
$progress = 0;
|
|
foreach ($showInstances as $instance) {
|
|
echo round(floatval($progress / $total) * 100) . '% - ' . $instance->getDbId() . "\n<br>";
|
|
flush();
|
|
ob_flush();
|
|
// while(@ob_end_clean());
|
|
$scheduler->removeGaps2($instance->getDbId());
|
|
++$progress;
|
|
}
|
|
echo "Recalculated {$total} shows.";
|
|
}
|
|
|
|
private function returnJsonOrJsonp($request, $result)
|
|
{
|
|
$response = $this->getResponse();
|
|
|
|
$body = $this->_helper->json->encodeJson($result, false);
|
|
|
|
$callback = $request->getParam('callback');
|
|
if ($callback) {
|
|
$response->setHeader('Content-Type', 'application/javascript');
|
|
$body = sprintf('%s(%s)', $callback, $body);
|
|
} else {
|
|
$response->setHeader('Content-Type', 'application/json');
|
|
}
|
|
$response->setBody($body);
|
|
|
|
// enable cors access from configured URLs
|
|
CORSHelper::enableCrossOriginRequests($request, $response);
|
|
}
|
|
|
|
/**
|
|
* Respond with a JSON error message with a custom HTTP status code.
|
|
*
|
|
* This logic should be handled by Zend, but I lack understanding of this
|
|
* framework, and prefer not break it or spend too much time on it.
|
|
*
|
|
* @param mixed $status
|
|
* @param mixed $message
|
|
*/
|
|
private function jsonError($status, $message)
|
|
{
|
|
$this->getResponse()
|
|
->setHttpResponseCode($status)
|
|
->setHeader('Content-Type', 'application/json')
|
|
->setBody(json_encode(['error' => $message]));
|
|
}
|
|
}
|