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>
1409 lines
59 KiB
PHP
1409 lines
59 KiB
PHP
<?php
|
|
|
|
final class Application_Model_Scheduler
|
|
{
|
|
private $con;
|
|
private $fileInfo = [
|
|
'id' => '',
|
|
'cliplength' => '',
|
|
'cuein' => '00:00:00',
|
|
'cueout' => '00:00:00',
|
|
'fadein' => '00:00:00',
|
|
'fadeout' => '00:00:00',
|
|
'sched_id' => null,
|
|
'type' => 0, // default type of '0' to represent files. type '1' represents a webstream
|
|
];
|
|
|
|
private $epochNow;
|
|
private $nowDT;
|
|
private $user;
|
|
|
|
private $crossfadeDuration;
|
|
private $applyCrossfades = true;
|
|
|
|
private $checkUserPermissions = true;
|
|
|
|
public function __construct($checkUserPermissions = true)
|
|
{
|
|
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
|
|
|
// subtracting one because sometimes when we cancel a track, we set its end time
|
|
// to epochNow and then send the new schedule to pypo. Sometimes the currently cancelled
|
|
// track can still be included in the new schedule because it may have a few ms left to play.
|
|
// subtracting 1 second from epochNow resolves this issue.
|
|
$this->epochNow = microtime(true) - 1;
|
|
$this->nowDT = DateTime::createFromFormat('U.u', $this->epochNow, new DateTimeZone('UTC'));
|
|
|
|
if ($this->nowDT === false) {
|
|
// DateTime::createFromFormat does not support millisecond string formatting in PHP 5.3.2 (Ubuntu 10.04).
|
|
// In PHP 5.3.3 (Ubuntu 10.10), this has been fixed.
|
|
$this->nowDT = DateTime::createFromFormat('U', time(), new DateTimeZone('UTC'));
|
|
}
|
|
|
|
$this->setCheckUserPermissions($checkUserPermissions);
|
|
|
|
if ($this->checkUserPermissions) {
|
|
$this->user = Application_Model_User::getCurrentUser();
|
|
}
|
|
|
|
$this->crossfadeDuration = Application_Model_Preference::GetDefaultCrossfadeDuration();
|
|
}
|
|
|
|
public function setCheckUserPermissions($value)
|
|
{
|
|
$this->checkUserPermissions = $value;
|
|
}
|
|
|
|
private function validateItemMove($itemsToMove, $destination)
|
|
{
|
|
$destinationInstanceId = $destination['instance'];
|
|
$destinationCcShowInstance = CcShowInstancesQuery::create()
|
|
->findPk($destinationInstanceId);
|
|
$isDestinationLinked = $destinationCcShowInstance->getCcShow()->isLinked();
|
|
|
|
foreach ($itemsToMove as $itemToMove) {
|
|
$sourceInstanceId = $itemToMove['instance'];
|
|
$ccShowInstance = CcShowInstancesQuery::create()
|
|
->findPk($sourceInstanceId);
|
|
|
|
// does the item being moved belong to a linked show
|
|
$isSourceLinked = $ccShowInstance->getCcShow()->isLinked();
|
|
|
|
if ($isDestinationLinked && !$isSourceLinked) {
|
|
throw new Exception('Cannot move items into linked shows');
|
|
}
|
|
if (!$isDestinationLinked && $isSourceLinked) {
|
|
throw new Exception('Cannot move items out of linked shows');
|
|
}
|
|
if ($isSourceLinked && $sourceInstanceId != $destinationInstanceId) {
|
|
throw new Exception(_('Cannot move items out of linked shows'));
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
* make sure any incoming requests for scheduling are legit.
|
|
*
|
|
* @param array $items, an array containing pks of cc_schedule items.
|
|
*/
|
|
private function validateRequest($items, $addRemoveAction = false, $cancelShow = false)
|
|
{
|
|
// $items is where tracks get inserted (they are schedule locations)
|
|
|
|
$nowEpoch = floatval($this->nowDT->format('U.u'));
|
|
|
|
$schedInfo = [];
|
|
$instanceInfo = [];
|
|
|
|
for ($i = 0; $i < count($items); ++$i) {
|
|
$id = $items[$i]['id'];
|
|
|
|
// could be added to the beginning of a show, which sends id = 0;
|
|
if ($id > 0) {
|
|
// schedule_id of where we are inserting after?
|
|
$schedInfo[$id] = $items[$i]['instance'];
|
|
}
|
|
|
|
// format is instance_id => timestamp
|
|
$instanceInfo[$items[$i]['instance']] = $items[$i]['timestamp'];
|
|
}
|
|
|
|
if (count($instanceInfo) === 0) {
|
|
throw new Exception('Invalid Request.');
|
|
}
|
|
|
|
$schedIds = [];
|
|
if (count($schedInfo) > 0) {
|
|
$schedIds = array_keys($schedInfo);
|
|
}
|
|
$schedItems = CcScheduleQuery::create()->findPKs($schedIds, $this->con);
|
|
$instanceIds = array_keys($instanceInfo);
|
|
$showInstances = CcShowInstancesQuery::create()->findPKs($instanceIds, $this->con);
|
|
|
|
// an item has been deleted
|
|
if (count($schedIds) !== count($schedItems)) {
|
|
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date! (sched mismatch)"));
|
|
}
|
|
|
|
// a show has been deleted
|
|
if (count($instanceIds) !== count($showInstances)) {
|
|
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date! (instance mismatch)"));
|
|
}
|
|
|
|
foreach ($schedItems as $schedItem) {
|
|
$id = $schedItem->getDbId();
|
|
$instance = $schedItem->getCcShowInstances($this->con);
|
|
|
|
if (intval($schedInfo[$id]) !== $instance->getDbId()) {
|
|
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
|
|
}
|
|
}
|
|
|
|
foreach ($showInstances as $instance) {
|
|
$id = $instance->getDbId();
|
|
$show = $instance->getCcShow($this->con);
|
|
|
|
if ($this->checkUserPermissions && $this->user->canSchedule($show->getDbId()) === false) {
|
|
throw new Exception(sprintf(_('You are not allowed to schedule show %s.'), $show->getDbName()));
|
|
}
|
|
|
|
if ($instance->getDbRecord()) {
|
|
throw new Exception(_('You cannot add files to recording shows.'));
|
|
}
|
|
|
|
$showEndEpoch = floatval($instance->getDbEnds('U.u'));
|
|
|
|
if ($showEndEpoch < $nowEpoch) {
|
|
throw new OutDatedScheduleException(sprintf(_('The show %s is over and cannot be scheduled.'), $show->getDbName()));
|
|
}
|
|
|
|
$ts = intval($instanceInfo[$id]);
|
|
$lastSchedTs = intval($instance->getDbLastScheduled('U')) ?: 0;
|
|
if ($ts < $lastSchedTs) {
|
|
Logging::info("ts {$ts} last sched {$lastSchedTs}");
|
|
|
|
throw new OutDatedScheduleException(sprintf(_('The show %s has been previously updated!'), $show->getDbName()));
|
|
}
|
|
|
|
/*
|
|
* Does the afterItem belong to a show that is linked AND
|
|
* currently playing?
|
|
* If yes, throw an exception
|
|
* unless it is a cancel show action then we don't check because otherwise
|
|
* ongoing linked shows can't be cancelled
|
|
*/
|
|
if ($addRemoveAction && !$cancelShow) {
|
|
$ccShow = $instance->getCcShow();
|
|
if ($ccShow->isLinked()) {
|
|
// get all the linked shows instances and check if
|
|
// any of them are currently playing
|
|
$ccShowInstances = $ccShow->getCcShowInstancess();
|
|
$timeNowUTC = gmdate(DEFAULT_TIMESTAMP_FORMAT);
|
|
foreach ($ccShowInstances as $ccShowInstance) {
|
|
if (
|
|
$ccShowInstance->getDbStarts() <= $timeNowUTC
|
|
&& $ccShowInstance->getDbEnds() > $timeNowUTC
|
|
) {
|
|
throw new Exception(_('Content in linked shows cannot be changed while on air!'));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private function validateMediaItems($mediaItems)
|
|
{
|
|
foreach ($mediaItems as $mediaItem) {
|
|
$id = $mediaItem['id'];
|
|
if ($mediaItem['type'] === 'playlist') {
|
|
$playlist = new Application_Model_Playlist($id, $this->con);
|
|
if ($playlist->containsMissingFiles()) {
|
|
throw new Exception(_('Cannot schedule a playlist that contains missing files.'));
|
|
}
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/*
|
|
* @param $id
|
|
* @param $type
|
|
* @param $show
|
|
*
|
|
* @return $files
|
|
*/
|
|
private function retrieveMediaFiles($id, $type, $show)
|
|
{
|
|
// if there is a show we need to set a show limit to pass to smart blocks in case they use time remaining
|
|
$showInstance = new Application_Model_ShowInstance($show);
|
|
$showLimit = $showInstance->getSecondsRemaining();
|
|
$showStart = $showInstance->getShowInstanceStart(null);
|
|
$originalShowLimit = $showLimit;
|
|
|
|
$files = [];
|
|
if ($type === 'audioclip') {
|
|
$file = CcFilesQuery::create()->findPK($id, $this->con);
|
|
|
|
if (is_null($file) || !$file->visible()) {
|
|
throw new Exception(_('A selected File does not exist!'));
|
|
}
|
|
$data = $this->fileInfo;
|
|
$data['id'] = $id;
|
|
|
|
$cuein = Application_Common_DateHelper::playlistTimeToSeconds($file->getDbCuein());
|
|
$cueout = Application_Common_DateHelper::playlistTimeToSeconds($file->getDbCueout());
|
|
$row_length = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein);
|
|
|
|
$data['cliplength'] = $row_length;
|
|
|
|
$data['cuein'] = $file->getDbCuein();
|
|
$data['cueout'] = $file->getDbCueout();
|
|
|
|
// fade is in format SS.uuuuuu
|
|
$data['fadein'] = Application_Model_Preference::GetDefaultFadeIn();
|
|
$data['fadeout'] = Application_Model_Preference::GetDefaultFadeOut();
|
|
|
|
$files[] = $data;
|
|
} elseif ($type === 'playlist') {
|
|
$pl = new Application_Model_Playlist($id);
|
|
$contents = $pl->getContents();
|
|
// because the time remaining is not updated until after the schedule inserts we need to track it for
|
|
// the entire add vs. querying on the smartblock level
|
|
foreach ($contents as $plItem) {
|
|
if ($plItem['type'] == 0) {
|
|
$data['id'] = $plItem['item_id'];
|
|
$data['cliplength'] = $plItem['length'];
|
|
$data['cuein'] = $plItem['cuein'];
|
|
$data['cueout'] = $plItem['cueout'];
|
|
$data['fadein'] = $plItem['fadein'];
|
|
$data['fadeout'] = $plItem['fadeout'];
|
|
$data['type'] = 0;
|
|
$files[] = $data;
|
|
} elseif ($plItem['type'] == 1) {
|
|
$data['id'] = $plItem['item_id'];
|
|
$data['cliplength'] = $plItem['length'];
|
|
$data['cuein'] = $plItem['cuein'];
|
|
$data['cueout'] = $plItem['cueout'];
|
|
$data['fadein'] = '00.500000'; // $plItem['fadein'];
|
|
$data['fadeout'] = '00.500000'; // $plItem['fadeout'];
|
|
$data['type'] = 1;
|
|
$files[] = $data;
|
|
} elseif ($plItem['type'] == 2) {
|
|
// if it's a block
|
|
$bl = new Application_Model_Block($plItem['item_id']);
|
|
if ($bl->isStatic()) {
|
|
foreach ($bl->getContents() as $track) {
|
|
$data['id'] = $track['item_id'];
|
|
$data['cliplength'] = $track['length'];
|
|
$data['cuein'] = $track['cuein'];
|
|
$data['cueout'] = $track['cueout'];
|
|
$data['fadein'] = $track['fadein'];
|
|
$data['fadeout'] = $track['fadeout'];
|
|
$data['type'] = 0;
|
|
$files[] = $data;
|
|
}
|
|
} else {
|
|
$defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn();
|
|
$defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut();
|
|
$dynamicFiles = $bl->getListOfFilesUnderLimit($showLimit, $showStart);
|
|
foreach ($dynamicFiles as $f) {
|
|
$fileId = $f['id'];
|
|
$file = CcFilesQuery::create()->findPk($fileId);
|
|
if (isset($file) && $file->visible()) {
|
|
$data['id'] = $file->getDbId();
|
|
$data['cuein'] = $file->getDbCuein();
|
|
$data['cueout'] = $file->getDbCueout();
|
|
|
|
$cuein = Application_Common_DateHelper::calculateLengthInSeconds($data['cuein']);
|
|
$cueout = Application_Common_DateHelper::calculateLengthInSeconds($data['cueout']);
|
|
$data['cliplength'] = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein);
|
|
|
|
// fade is in format SS.uuuuuu
|
|
$data['fadein'] = $defaultFadeIn;
|
|
$data['fadeout'] = $defaultFadeOut;
|
|
|
|
$data['type'] = 0;
|
|
$files[] = $data;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// if this is a playlist it might contain multiple time remaining smart blocks
|
|
// since the schedule isn't updated until after this insert we need to keep tally
|
|
$showLimit = $originalShowLimit - $this->timeLengthOfFiles($files);
|
|
}
|
|
} elseif ($type == 'stream') {
|
|
// need to return
|
|
$stream = CcWebstreamQuery::create()->findPK($id, $this->con);
|
|
|
|
if (is_null($stream) /* || !$file->visible() */) {
|
|
throw new Exception(_('A selected File does not exist!'));
|
|
}
|
|
$data = $this->fileInfo;
|
|
$data['id'] = $id;
|
|
$data['cliplength'] = $stream->getDbLength();
|
|
$data['cueout'] = $stream->getDbLength();
|
|
$data['type'] = 1;
|
|
|
|
// fade is in format SS.uuuuuu
|
|
$data['fadein'] = Application_Model_Preference::GetDefaultFadeIn();
|
|
$data['fadeout'] = Application_Model_Preference::GetDefaultFadeOut();
|
|
|
|
$files[] = $data;
|
|
} elseif ($type == 'block') {
|
|
$bl = new Application_Model_Block($id);
|
|
if ($bl->isStatic()) {
|
|
foreach ($bl->getContents() as $track) {
|
|
$data['id'] = $track['item_id'];
|
|
$data['cliplength'] = $track['length'];
|
|
$data['cuein'] = $track['cuein'];
|
|
$data['cueout'] = $track['cueout'];
|
|
$data['fadein'] = $track['fadein'];
|
|
$data['fadeout'] = $track['fadeout'];
|
|
$data['type'] = 0;
|
|
$files[] = $data;
|
|
}
|
|
} else {
|
|
$defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn();
|
|
$defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut();
|
|
$dynamicFiles = $bl->getListOfFilesUnderLimit($showLimit, $showStart);
|
|
foreach ($dynamicFiles as $f) {
|
|
$fileId = $f['id'];
|
|
$file = CcFilesQuery::create()->findPk($fileId);
|
|
if (isset($file) && $file->visible()) {
|
|
$data['id'] = $file->getDbId();
|
|
$data['cuein'] = $file->getDbCuein();
|
|
$data['cueout'] = $file->getDbCueout();
|
|
|
|
$cuein = Application_Common_DateHelper::calculateLengthInSeconds($data['cuein']);
|
|
$cueout = Application_Common_DateHelper::calculateLengthInSeconds($data['cueout']);
|
|
$data['cliplength'] = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein);
|
|
|
|
// fade is in format SS.uuuuuu
|
|
$data['fadein'] = $defaultFadeIn;
|
|
$data['fadeout'] = $defaultFadeOut;
|
|
|
|
$data['type'] = 0;
|
|
$files[] = $data;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return $files;
|
|
}
|
|
|
|
/*
|
|
* @param DateTime startDT in UTC
|
|
* @param string duration
|
|
* in format H:i:s.u (could be more that 24 hours)
|
|
*
|
|
* @return DateTime endDT in UTC
|
|
*/
|
|
private function findTimeDifference($p_startDT, $p_seconds)
|
|
{
|
|
$startEpoch = $p_startDT->format('U.u');
|
|
|
|
// add two float numbers to 6 subsecond precision
|
|
// DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number.
|
|
$newEpoch = bcsub($startEpoch, (string) $p_seconds, 6);
|
|
|
|
$dt = DateTime::createFromFormat('U.u', $newEpoch, new DateTimeZone('UTC'));
|
|
|
|
if ($dt === false) {
|
|
// PHP 5.3.2 problem
|
|
$dt = DateTime::createFromFormat('U', intval($newEpoch), new DateTimeZone('UTC'));
|
|
}
|
|
|
|
return $dt;
|
|
}
|
|
|
|
private function findTimeDifference2($p_startDT, $p_endDT)
|
|
{
|
|
$startEpoch = $p_startDT->format('U.u');
|
|
$endEpoch = $p_endDT->format('U.u');
|
|
|
|
// add two float numbers to 6 subsecond precision
|
|
// DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number.
|
|
$newEpoch = bcsub($endEpoch, (string) $startEpoch, 6);
|
|
|
|
$dt = DateTime::createFromFormat('U.u', $newEpoch, new DateTimeZone('UTC'));
|
|
|
|
if ($dt === false) {
|
|
// PHP 5.3.2 problem
|
|
$dt = DateTime::createFromFormat('U', intval($newEpoch), new DateTimeZone('UTC'));
|
|
}
|
|
|
|
return $dt;
|
|
}
|
|
|
|
/*
|
|
* @param DateTime startDT in UTC
|
|
* @param string duration
|
|
* in format H:i:s.u (could be more that 24 hours)
|
|
*
|
|
* @return DateTime endDT in UTC
|
|
*/
|
|
private function findEndTime($p_startDT, $p_duration)
|
|
{
|
|
$startEpoch = $p_startDT->format('U.u');
|
|
$durationSeconds = Application_Common_DateHelper::playlistTimeToSeconds($p_duration);
|
|
|
|
// add two float numbers to 6 subsecond precision
|
|
// DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number.
|
|
$endEpoch = bcadd($startEpoch, (string) $durationSeconds, 6);
|
|
|
|
$dt = DateTime::createFromFormat('U.u', $endEpoch, new DateTimeZone('UTC'));
|
|
|
|
if ($dt === false) {
|
|
// PHP 5.3.2 problem
|
|
$dt = DateTime::createFromFormat('U', intval($endEpoch), new DateTimeZone('UTC'));
|
|
}
|
|
|
|
return $dt;
|
|
}
|
|
|
|
private function findNextStartTime($DT, $instanceId)
|
|
{
|
|
// TODO: there is at least one case where this function creates a filler block with
|
|
// an incorrect length; should keep an eye on it
|
|
$sEpoch = $DT->format('U.u');
|
|
$nEpoch = $this->epochNow;
|
|
|
|
// check for if the show has started.
|
|
if (bccomp($nEpoch, $sEpoch, 6) === 1) {
|
|
$this->applyCrossfades = false;
|
|
// need some kind of placeholder for cc_schedule.
|
|
// playout_status will be -1.
|
|
$nextDT = $this->nowDT;
|
|
|
|
$length = bcsub($nEpoch, $sEpoch, 6);
|
|
$cliplength = Application_Common_DateHelper::secondsToPlaylistTime($length);
|
|
|
|
// fillers are for only storing a chunk of time space that has already passed.
|
|
$filler = new CcSchedule();
|
|
$filler->setDbStarts($DT)
|
|
->setDbEnds($this->nowDT)
|
|
->setDbClipLength($cliplength)
|
|
->setDbCueIn('00:00:00')
|
|
->setDbCueOut('00:00:00')
|
|
->setDbPlayoutStatus(-1)
|
|
->setDbInstanceId($instanceId)
|
|
->save($this->con);
|
|
} else {
|
|
$nextDT = $DT;
|
|
}
|
|
|
|
return $nextDT;
|
|
}
|
|
|
|
/*
|
|
* @param int $showInstance
|
|
* This function recalculates the start/end times of items in a gapless show to
|
|
* account for crossfade durations.
|
|
*/
|
|
private function calculateCrossfades($instanceId)
|
|
{
|
|
Logging::info('adjusting start, end times of scheduled items to account for crossfades show instance #' . $instanceId);
|
|
$instance = CcShowInstancesQuery::create()->findPk($instanceId);
|
|
|
|
if (is_null($instance)) {
|
|
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
|
|
}
|
|
|
|
$schedule = CcScheduleQuery::create()
|
|
->filterByDbInstanceId($instanceId)
|
|
->orderByDbStarts()
|
|
->find($this->con);
|
|
|
|
$now = new DateTime('now', new DateTimeZone('UTC'));
|
|
$itemStartDT = $instance->getDbStarts(null);
|
|
foreach ($schedule as $item) {
|
|
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
|
// If the track has already ended, don't change it.
|
|
if ($itemEndDT < $now) {
|
|
$itemStartDT = $itemEndDT;
|
|
|
|
continue;
|
|
}
|
|
$item->setDbStarts($itemStartDT)
|
|
->setDbEnds($itemEndDT)
|
|
->save($this->con);
|
|
$itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* @param int $showInstance
|
|
* @param array $exclude
|
|
* ids of sched items to remove from the calculation.
|
|
* This function squeezes all items of a show together so that
|
|
* there are no gaps between them.
|
|
*/
|
|
public function removeGaps($showInstance, $exclude = null)
|
|
{
|
|
Logging::info('removing gaps from show instance #' . $showInstance);
|
|
|
|
$instance = CcShowInstancesQuery::create()->findPk($showInstance, $this->con);
|
|
if (is_null($instance)) {
|
|
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
|
|
}
|
|
|
|
$schedule = CcScheduleQuery::create()
|
|
->filterByDbInstanceId($showInstance)
|
|
->filterByDbId($exclude, Criteria::NOT_IN)
|
|
->orderByDbStarts()
|
|
->find($this->con);
|
|
|
|
$now = new DateTime('now', new DateTimeZone('UTC'));
|
|
$itemStartDT = $instance->getDbStarts(null);
|
|
foreach ($schedule as $item) {
|
|
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
|
// If the track has already ended, don't change it.
|
|
if ($itemEndDT < $now) {
|
|
$itemStartDT = $itemEndDT;
|
|
|
|
continue;
|
|
}
|
|
|
|
$item->setDbStarts($itemStartDT)
|
|
->setDbEnds($itemEndDT);
|
|
|
|
$itemStartDT = $itemEndDT;
|
|
}
|
|
|
|
$schedule->save($this->con);
|
|
}
|
|
|
|
/** Temporary hack to copy the track cue in, out, and length from the cc_files table to fix
|
|
* incorrect track lengths (RKTN-260).
|
|
*
|
|
* @param mixed $showInstance
|
|
* @param null|mixed $exclude
|
|
*/
|
|
public function removeGaps2($showInstance, $exclude = null)
|
|
{
|
|
$instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con);
|
|
if (is_null($instance)) {
|
|
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
|
|
}
|
|
|
|
$itemStartDT = $instance->getDbStarts(null);
|
|
|
|
$schedule = CcScheduleQuery::create()
|
|
->filterByDbInstanceId($showInstance)
|
|
->filterByDbId($exclude, Criteria::NOT_IN)
|
|
->orderByDbStarts()
|
|
->find($this->con);
|
|
|
|
foreach ($schedule as $item) {
|
|
// START OF TIME RECALC HACK
|
|
|
|
// TODO: Copy the cue in, cue out, and track length from the cc_files table
|
|
$file = $item->getCcFiles($this->con);
|
|
if (!$file) {
|
|
continue;
|
|
}
|
|
$item->setDbCueIn($file->getDbCueIn());
|
|
$item->setDbCueOut($file->getDbCueOut());
|
|
|
|
$cueOut = new DateTime($file->getDbCueOut());
|
|
$cueIn = new DateTime($file->getDbCueIn());
|
|
$clipLength = $this->findTimeDifference2($cueIn, $cueOut);
|
|
|
|
// The clip length is supposed to be cue out - cue in:
|
|
// FIXME: How do we correctly do time arithmetic in PHP without losing the millseconds?
|
|
$item->setDbClipLength($clipLength->format(DEFAULT_INTERVAL_FORMAT));
|
|
$item->save($this->con);
|
|
// Ensure we don't get cached results
|
|
CcSchedulePeer::clearInstancePool();
|
|
// END OF TIME RECALC HACK
|
|
|
|
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
|
$item->setDbStarts($itemStartDT)
|
|
->setDbEnds($itemEndDT)
|
|
->save($this->con);
|
|
$itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration);
|
|
}
|
|
|
|
$instance->updateDbTimeFilled($this->con); // FIXME: TIME RECALC HACK (Albert)
|
|
|
|
$schedule->save($this->con);
|
|
}
|
|
|
|
/**
|
|
* Enter description here ...
|
|
*
|
|
* @param $scheduleItems cc_schedule items, where the items get inserted after
|
|
* @param $filesToInsert array of schedule item info, what gets inserted into cc_schedule
|
|
* @param mixed $mediaItems
|
|
* @param mixed $moveAction
|
|
* @param mixed $adjustSched
|
|
*/
|
|
private function insertAfter($scheduleItems, $mediaItems, $filesToInsert = null, $adjustSched = true, $moveAction = false)
|
|
{
|
|
try {
|
|
// temporary fix for CC-5665
|
|
set_time_limit(180);
|
|
|
|
$affectedShowInstances = [];
|
|
|
|
// dont want to recalculate times for moved items
|
|
// only moved items have a sched_id
|
|
$excludeIds = [];
|
|
|
|
$startProfile = microtime(true);
|
|
|
|
$temp = [];
|
|
$instance = null;
|
|
|
|
/* Items in shows are ordered by position number. We need to know
|
|
* the position when adding/moving items in linked shows so they are
|
|
* added or moved in the correct position
|
|
*/
|
|
$pos = 0;
|
|
|
|
$linked = false;
|
|
|
|
foreach ($scheduleItems as $schedule) {
|
|
// reset
|
|
$this->applyCrossfades = true;
|
|
|
|
$id = intval($schedule['id']);
|
|
|
|
/* Find out if the show where the cursor position (where an item will
|
|
* be inserted) is located is linked or not. If the show is linked,
|
|
* we need to make sure there isn't another cursor selection in one of it's
|
|
* linked shows. If there is that will cause a duplication, in the least,
|
|
* of inserted items
|
|
*/
|
|
if ($id != 0) {
|
|
$schedule_sql = 'SELECT * FROM cc_schedule WHERE id = ' . $id;
|
|
$ccSchedule = Application_Common_Database::prepareAndExecute(
|
|
$schedule_sql,
|
|
[],
|
|
Application_Common_Database::SINGLE
|
|
);
|
|
|
|
$show_sql = 'SELECT * FROM cc_show WHERE id IN ('
|
|
. 'SELECT show_id FROM cc_show_instances WHERE id = ' . $ccSchedule['instance_id'] . ')';
|
|
$ccShow = Application_Common_Database::prepareAndExecute(
|
|
$show_sql,
|
|
[],
|
|
Application_Common_Database::SINGLE
|
|
);
|
|
|
|
$linked = $ccShow['linked'];
|
|
if ($linked) {
|
|
$unique = $ccShow['id'] . $ccSchedule['position'];
|
|
if (!in_array($unique, $temp)) {
|
|
$temp[] = $unique;
|
|
} else {
|
|
continue;
|
|
}
|
|
}
|
|
} else {
|
|
$show_sql = 'SELECT * FROM cc_show WHERE id IN ('
|
|
. 'SELECT show_id FROM cc_show_instances WHERE id = ' . $schedule['instance'] . ')';
|
|
$ccShow = Application_Common_Database::prepareAndExecute(
|
|
$show_sql,
|
|
[],
|
|
Application_Common_Database::SINGLE
|
|
);
|
|
|
|
$linked = $ccShow['linked'];
|
|
if ($linked) {
|
|
$unique = $ccShow['id'] . 'a';
|
|
if (!in_array($unique, $temp)) {
|
|
$temp[] = $unique;
|
|
} else {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* If the show where the cursor position is located is linked
|
|
* we need to insert the items for each linked instance belonging
|
|
* to that show
|
|
*/
|
|
if ($linked) {
|
|
$instances = CcShowInstancesQuery::create()
|
|
->filterByDbShowId($ccShow['id'])
|
|
->filterByDbStarts(gmdate(DEFAULT_TIMESTAMP_FORMAT), Criteria::GREATER_THAN)
|
|
->find();
|
|
} else {
|
|
$instances = CcShowInstancesQuery::create()
|
|
->filterByDbId($schedule['instance'])
|
|
->find();
|
|
}
|
|
|
|
$excludePositions = [];
|
|
foreach ($instances as &$instance) {
|
|
// reset
|
|
$this->applyCrossfades = true;
|
|
|
|
// $instanceId = $instance["id"];
|
|
$instanceId = $instance->getDbId();
|
|
if ($id !== 0) {
|
|
/* We use the selected cursor's position to find the same
|
|
* positions in every other linked instance
|
|
*/
|
|
$pos = $ccSchedule['position'];
|
|
|
|
$linkedItem_sql = 'SELECT ends FROM cc_schedule '
|
|
. "WHERE instance_id = {$instanceId} "
|
|
. "AND position = {$pos} "
|
|
. 'AND playout_status != -1';
|
|
$linkedItemEnds = Application_Common_Database::prepareAndExecute(
|
|
$linkedItem_sql,
|
|
[],
|
|
Application_Common_Database::COLUMN
|
|
);
|
|
|
|
if (!$linkedItemEnds) {
|
|
// With dynamic smart blocks there may be different number of items in
|
|
// each show. In case the position does not exist we need to select
|
|
// the end time of the last position
|
|
$maxPos_sql = 'SELECT max(position) from cc_schedule '
|
|
. "WHERE instance_id = {$instanceId}";
|
|
$pos = Application_Common_Database::prepareAndExecute(
|
|
$maxPos_sql,
|
|
[],
|
|
Application_Common_Database::COLUMN
|
|
);
|
|
|
|
// show instance has no scheduled tracks
|
|
if (empty($pos)) {
|
|
$pos = 0;
|
|
$nextStartDT = new DateTime($instance->getDbStarts(), new DateTimeZone('UTC'));
|
|
} else {
|
|
$linkedItem_sql = 'SELECT ends FROM cc_schedule '
|
|
. "WHERE instance_id = {$instanceId} "
|
|
. "AND position = {$pos} "
|
|
. 'AND playout_status != -1';
|
|
$linkedItemEnds = Application_Common_Database::prepareAndExecute(
|
|
$linkedItem_sql,
|
|
[],
|
|
Application_Common_Database::COLUMN
|
|
);
|
|
|
|
$nextStartDT = $this->findNextStartTime(
|
|
new DateTime($linkedItemEnds, new DateTimeZone('UTC')),
|
|
$instanceId
|
|
);
|
|
}
|
|
} else {
|
|
$nextStartDT = $this->findNextStartTime(
|
|
new DateTime($linkedItemEnds, new DateTimeZone('UTC')),
|
|
$instanceId
|
|
);
|
|
|
|
++$pos;
|
|
}
|
|
}
|
|
// selected empty row to add after
|
|
else {
|
|
$showStartDT = new DateTime($instance->getDbStarts(), new DateTimeZone('UTC'));
|
|
$nextStartDT = $this->findNextStartTime($showStartDT, $instanceId);
|
|
|
|
// first item in show so start position counter at 0
|
|
$pos = 0;
|
|
|
|
/* Show is empty so we don't need to calculate crossfades
|
|
* for the first inserted item
|
|
*/
|
|
$this->applyCrossfades = false;
|
|
}
|
|
|
|
if (!in_array($instanceId, $affectedShowInstances)) {
|
|
$affectedShowInstances[] = $instanceId;
|
|
}
|
|
|
|
/*
|
|
* $adjustSched is true if there are schedule items
|
|
* following the item just inserted, per show instance
|
|
*/
|
|
if ($adjustSched === true) {
|
|
$pstart = microtime(true);
|
|
|
|
if ($this->applyCrossfades) {
|
|
$initalStartDT = clone $this->findTimeDifference(
|
|
$nextStartDT,
|
|
$this->crossfadeDuration
|
|
);
|
|
} else {
|
|
$initalStartDT = clone $nextStartDT;
|
|
}
|
|
|
|
$pend = microtime(true);
|
|
Logging::debug('finding all following items.');
|
|
Logging::debug(floatval($pend) - floatval($pstart));
|
|
}
|
|
|
|
// passing $schedule["instance"] so that the instance being scheduled
|
|
// can be used to determine the remaining time
|
|
// in the case of a fill remaining time smart block
|
|
if (is_null($filesToInsert)) {
|
|
$filesToInsert = [];
|
|
foreach ($mediaItems as $media) {
|
|
$filesToInsert = array_merge(
|
|
$filesToInsert,
|
|
$this->retrieveMediaFiles($media['id'], $media['type'], $schedule['instance'])
|
|
);
|
|
}
|
|
}
|
|
|
|
$doInsert = false;
|
|
$doUpdate = false;
|
|
$values = [];
|
|
|
|
// array that stores the cc_file ids so we can update the is_scheduled flag
|
|
$fileIds = [];
|
|
|
|
foreach ($filesToInsert as &$file) {
|
|
// item existed previously and is being moved.
|
|
// need to keep same id for resources if we want REST.
|
|
if (isset($file['sched_id'])) {
|
|
$adjustFromDT = clone $nextStartDT;
|
|
$doUpdate = true;
|
|
|
|
$movedItem_sql = 'SELECT * FROM cc_schedule '
|
|
. 'WHERE id = ' . $file['sched_id'];
|
|
$sched = Application_Common_Database::prepareAndExecute(
|
|
$movedItem_sql,
|
|
[],
|
|
Application_Common_Database::SINGLE
|
|
);
|
|
|
|
/* We need to keep a record of the original positon a track
|
|
* is being moved from so we can use it to retrieve the correct
|
|
* items in linked instances
|
|
*/
|
|
if (!isset($originalPosition)) {
|
|
$originalPosition = $sched['position'];
|
|
}
|
|
|
|
/* If we are moving an item in a linked show we need to get
|
|
* the relative item to move in each instance. We know what the
|
|
* relative item is by its position
|
|
*/
|
|
if ($linked) {
|
|
$movedItem_sql = 'SELECT * FROM cc_schedule '
|
|
. "WHERE position = {$originalPosition} "
|
|
. "AND instance_id = {$instanceId}";
|
|
|
|
$sched = Application_Common_Database::prepareAndExecute(
|
|
$movedItem_sql,
|
|
[],
|
|
Application_Common_Database::SINGLE
|
|
);
|
|
}
|
|
/* If we don't find a schedule item it means the linked
|
|
* shows have a different amount of items (dyanmic block)
|
|
* and we should skip the item move for this show instance
|
|
*/
|
|
if (!$sched) {
|
|
continue;
|
|
}
|
|
$excludeIds[] = intval($sched['id']);
|
|
|
|
$file['cliplength'] = $sched['clip_length'];
|
|
$file['cuein'] = $sched['cue_in'];
|
|
$file['cueout'] = $sched['cue_out'];
|
|
$file['fadein'] = $sched['fade_in'];
|
|
$file['fadeout'] = $sched['fade_out'];
|
|
} else {
|
|
$doInsert = true;
|
|
}
|
|
|
|
// default fades are in seconds
|
|
// we need to convert to '00:00:00' format
|
|
// added a check to only run the conversion if they are in seconds format
|
|
// otherwise php > 7.1 throws errors
|
|
if (is_numeric($file['fadein'])) {
|
|
$file['fadein'] = Application_Common_DateHelper::secondsToPlaylistTime($file['fadein']);
|
|
}
|
|
if (is_numeric($file['fadeout'])) {
|
|
$file['fadeout'] = Application_Common_DateHelper::secondsToPlaylistTime($file['fadeout']);
|
|
}
|
|
|
|
switch ($file['type']) {
|
|
case 0:
|
|
$fileId = $file['id'];
|
|
$streamId = 'null';
|
|
$fileIds[] = $fileId;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
$streamId = $file['id'];
|
|
$fileId = 'null';
|
|
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
if ($this->applyCrossfades) {
|
|
$nextStartDT = $this->findTimeDifference(
|
|
$nextStartDT,
|
|
$this->crossfadeDuration
|
|
);
|
|
$endTimeDT = $this->findEndTime($nextStartDT, $file['cliplength']);
|
|
$endTimeDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration);
|
|
/* Set it to false because the rest of the crossfades
|
|
* will be applied after we insert each item
|
|
*/
|
|
$this->applyCrossfades = false;
|
|
}
|
|
|
|
$endTimeDT = $this->findEndTime($nextStartDT, $file['cliplength']);
|
|
if ($doInsert) {
|
|
$values[] = '('
|
|
. "'{$nextStartDT->format(DEFAULT_MICROTIME_FORMAT)}', "
|
|
. "'{$endTimeDT->format(DEFAULT_MICROTIME_FORMAT)}', "
|
|
. "'{$file['cuein']}', "
|
|
. "'{$file['cueout']}', "
|
|
. "'{$file['fadein']}', "
|
|
. "'{$file['fadeout']}', "
|
|
. "'{$file['cliplength']}', "
|
|
. "{$pos}, "
|
|
. "{$instanceId}, "
|
|
. "{$fileId}, "
|
|
. "{$streamId})";
|
|
} elseif ($doUpdate) {
|
|
$update_sql = 'UPDATE cc_schedule SET '
|
|
. "starts = '{$nextStartDT->format(DEFAULT_MICROTIME_FORMAT)}', "
|
|
. "ends = '{$endTimeDT->format(DEFAULT_MICROTIME_FORMAT)}', "
|
|
. "cue_in = '{$file['cuein']}', "
|
|
. "cue_out = '{$file['cueout']}', "
|
|
. "fade_in = '{$file['fadein']}', "
|
|
. "fade_out = '{$file['fadeout']}', "
|
|
. "clip_length = '{$file['cliplength']}', "
|
|
. "position = {$pos}, "
|
|
. "instance_id = {$instanceId} "
|
|
. "WHERE id = {$sched['id']}";
|
|
|
|
Application_Common_Database::prepareAndExecute(
|
|
$update_sql,
|
|
[],
|
|
Application_Common_Database::EXECUTE
|
|
);
|
|
}
|
|
|
|
$nextStartDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration);
|
|
++$pos;
|
|
} // all files have been inserted/moved
|
|
if ($doInsert) {
|
|
$insert_sql = 'INSERT INTO cc_schedule '
|
|
. '(starts, ends, cue_in, cue_out, fade_in, fade_out, '
|
|
. 'clip_length, position, instance_id, file_id, stream_id) VALUES '
|
|
. implode(',', $values) . ' RETURNING id';
|
|
|
|
$stmt = $this->con->prepare($insert_sql);
|
|
if ($stmt->execute()) {
|
|
foreach ($stmt->fetchAll() as $row) {
|
|
$excludeIds[] = $row['id'];
|
|
}
|
|
}
|
|
}
|
|
|
|
$selectCriteria = new Criteria();
|
|
$selectCriteria->add(CcFilesPeer::ID, $fileIds, Criteria::IN);
|
|
$selectCriteria->addAnd(CcFilesPeer::IS_SCHEDULED, false);
|
|
$updateCriteria = new Criteria();
|
|
$updateCriteria->add(CcFilesPeer::IS_SCHEDULED, true);
|
|
BasePeer::doUpdate($selectCriteria, $updateCriteria, $this->con);
|
|
|
|
/* Reset files to insert so we can get a new set of files. We have
|
|
* to do this in case we are inserting a dynamic block
|
|
*/
|
|
if (!$moveAction) {
|
|
$filesToInsert = null;
|
|
}
|
|
|
|
if ($adjustSched === true) {
|
|
$followingItems_sql = 'SELECT * FROM cc_schedule '
|
|
. "WHERE starts >= '{$initalStartDT->format(DEFAULT_MICROTIME_FORMAT)}' "
|
|
. "AND instance_id = {$instanceId} ";
|
|
if (count($excludeIds) > 0) {
|
|
$followingItems_sql .= 'AND id NOT IN (' . implode(',', $excludeIds) . ') ';
|
|
}
|
|
$followingItems_sql .= 'ORDER BY starts';
|
|
$followingSchedItems = Application_Common_Database::prepareAndExecute(
|
|
$followingItems_sql
|
|
);
|
|
|
|
$pstart = microtime(true);
|
|
|
|
// recalculate the start/end times after the inserted items.
|
|
foreach ($followingSchedItems as $item) {
|
|
$endTimeDT = $this->findEndTime($nextStartDT, $item['clip_length']);
|
|
$endTimeDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration);
|
|
$update_sql = 'UPDATE cc_schedule SET '
|
|
. "starts = '{$nextStartDT->format(DEFAULT_MICROTIME_FORMAT)}', "
|
|
. "ends = '{$endTimeDT->format(DEFAULT_MICROTIME_FORMAT)}', "
|
|
. "position = {$pos} "
|
|
. "WHERE id = {$item['id']}";
|
|
Application_Common_Database::prepareAndExecute(
|
|
$update_sql,
|
|
[],
|
|
Application_Common_Database::EXECUTE
|
|
);
|
|
|
|
$nextStartDT = $this->findTimeDifference($endTimeDT, $this->crossfadeDuration);
|
|
++$pos;
|
|
}
|
|
|
|
$pend = microtime(true);
|
|
Logging::debug('adjusting all following items.');
|
|
Logging::debug(floatval($pend) - floatval($pstart));
|
|
}
|
|
if ($moveAction) {
|
|
$this->calculateCrossfades($instanceId);
|
|
}
|
|
} // for each instance
|
|
} // for each schedule location
|
|
|
|
$endProfile = microtime(true);
|
|
Logging::debug('finished adding scheduled items.');
|
|
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
|
|
|
// update the status flag in cc_schedule.
|
|
$instances = CcShowInstancesQuery::create()
|
|
->filterByPrimaryKeys($affectedShowInstances)
|
|
->find($this->con);
|
|
|
|
$startProfile = microtime(true);
|
|
|
|
foreach ($instances as $instance) {
|
|
$instance->updateScheduleStatus($this->con);
|
|
}
|
|
|
|
$endProfile = microtime(true);
|
|
Logging::debug('updating show instances status.');
|
|
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
|
|
|
$startProfile = microtime(true);
|
|
|
|
// update the last scheduled timestamp.
|
|
CcShowInstancesQuery::create()
|
|
->filterByPrimaryKeys($affectedShowInstances)
|
|
->update(['DbLastScheduled' => new DateTime('now', new DateTimeZone('UTC'))], $this->con);
|
|
|
|
$endProfile = microtime(true);
|
|
Logging::debug('updating last scheduled timestamp.');
|
|
Logging::debug(floatval($endProfile) - floatval($startProfile));
|
|
} catch (Exception $e) {
|
|
Logging::debug($e->getMessage());
|
|
|
|
throw $e;
|
|
}
|
|
}
|
|
|
|
private function updateMovedItem() {}
|
|
|
|
private function getInstances($instanceId)
|
|
{
|
|
$ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
|
|
$ccShow = $ccShowInstance->getCcShow();
|
|
if ($ccShow->isLinked()) {
|
|
return $ccShow->getFutureCcShowInstancess();
|
|
}
|
|
|
|
return [$ccShowInstance];
|
|
}
|
|
|
|
/*
|
|
* @param array $scheduleItems (schedule_id and instance_id it belongs to)
|
|
* @param array $mediaItems (file|block|playlist|webstream)
|
|
*/
|
|
public function scheduleAfter($scheduleItems, $mediaItems, $adjustSched = true)
|
|
{
|
|
$this->con->beginTransaction();
|
|
|
|
try {
|
|
// Increase the transaction isolation level to prevent two concurrent requests from potentially resulting
|
|
// in tracks scheduled at the same time.
|
|
$this->con->exec('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE');
|
|
|
|
$this->validateMediaItems($mediaItems); // Check for missing files, etc.
|
|
$this->validateRequest($scheduleItems, true);
|
|
|
|
/*
|
|
* create array of arrays
|
|
* array of schedule item info
|
|
* (sched_id is the cc_schedule id and is set if an item is being
|
|
* moved because it is already in cc_schedule)
|
|
* [0] = Array(
|
|
* id => 1,
|
|
* cliplength => 00:04:32,
|
|
* cuein => 00:00:00,
|
|
* cueout => 00:04:32,
|
|
* fadein => 00.5,
|
|
* fadeout => 00.5,
|
|
* sched_id => ,
|
|
* type => 0)
|
|
* [1] = Array(
|
|
* id => 2,
|
|
* cliplength => 00:05:07,
|
|
* cuein => 00:00:00,
|
|
* cueout => 00:05:07,
|
|
* fadein => 00.5,
|
|
* fadeout => 00.5,
|
|
* sched_id => ,
|
|
* type => 0)
|
|
*/
|
|
$this->insertAfter($scheduleItems, $mediaItems, null, $adjustSched);
|
|
|
|
$this->con->commit();
|
|
|
|
Application_Model_RabbitMq::PushSchedule();
|
|
} catch (Exception $e) {
|
|
$this->con->rollback();
|
|
|
|
throw $e;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* @param array $selectedItem
|
|
* @param array $afterItem
|
|
*/
|
|
public function moveItem($selectedItems, $afterItems, $adjustSched = true)
|
|
{
|
|
// $startProfile = microtime(true);
|
|
|
|
$this->con->beginTransaction();
|
|
// $this->con->useDebug(true);
|
|
|
|
try {
|
|
// Increase the transaction isolation level to prevent two concurrent requests from potentially resulting
|
|
// in tracks scheduled at the same time.
|
|
$this->con->exec('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE');
|
|
|
|
$this->validateItemMove($selectedItems, $afterItems[0]);
|
|
$this->validateRequest($selectedItems);
|
|
$this->validateRequest($afterItems);
|
|
|
|
$endProfile = microtime(true);
|
|
// Logging::debug("validating move request took:");
|
|
// Logging::debug(floatval($endProfile) - floatval($startProfile));
|
|
|
|
$afterInstance = CcShowInstancesQuery::create()->findPK($afterItems[0]['instance'], $this->con);
|
|
|
|
// map show instances to cc_schedule primary keys.
|
|
$modifiedMap = [];
|
|
$movedData = [];
|
|
|
|
// prepare each of the selected items.
|
|
for ($i = 0; $i < count($selectedItems); ++$i) {
|
|
$selected = CcScheduleQuery::create()->findPk($selectedItems[$i]['id'], $this->con);
|
|
$selectedInstance = $selected->getCcShowInstances($this->con);
|
|
|
|
$data = $this->fileInfo;
|
|
$data['id'] = $selected->getDbFileId();
|
|
$data['cliplength'] = $selected->getDbClipLength();
|
|
$data['cuein'] = $selected->getDbCueIn();
|
|
$data['cueout'] = $selected->getDbCueOut();
|
|
$data['fadein'] = $selected->getDbFadeIn();
|
|
$data['fadeout'] = $selected->getDbFadeOut();
|
|
$data['sched_id'] = $selected->getDbId();
|
|
|
|
$movedData[] = $data;
|
|
|
|
// figure out which items must be removed from calculated show times.
|
|
$showInstanceId = $selectedInstance->getDbId();
|
|
$schedId = $selected->getDbId();
|
|
if (isset($modifiedMap[$showInstanceId])) {
|
|
array_push($modifiedMap[$showInstanceId], $schedId);
|
|
} else {
|
|
$modifiedMap[$showInstanceId] = [$schedId];
|
|
}
|
|
}
|
|
|
|
// calculate times excluding the to be moved items.
|
|
foreach ($modifiedMap as $instance => $schedIds) {
|
|
$startProfile = microtime(true);
|
|
|
|
$this->removeGaps($instance, $schedIds);
|
|
|
|
// $endProfile = microtime(true);
|
|
// Logging::debug("removing gaps from instance $instance:");
|
|
// Logging::debug(floatval($endProfile) - floatval($startProfile));
|
|
}
|
|
|
|
// $startProfile = microtime(true);
|
|
|
|
$this->insertAfter($afterItems, null, $movedData, $adjustSched, true);
|
|
|
|
// $endProfile = microtime(true);
|
|
// Logging::debug("inserting after removing gaps.");
|
|
// Logging::debug(floatval($endProfile) - floatval($startProfile));
|
|
|
|
$modified = array_keys($modifiedMap);
|
|
// need to adjust shows we have moved items from.
|
|
foreach ($modified as $instanceId) {
|
|
$instance = CcShowInstancesQuery::create()->findPK($instanceId, $this->con);
|
|
$instance->updateScheduleStatus($this->con);
|
|
}
|
|
|
|
// $this->con->useDebug(false);
|
|
$this->con->commit();
|
|
|
|
Application_Model_RabbitMq::PushSchedule();
|
|
} catch (Exception $e) {
|
|
$this->con->rollback();
|
|
|
|
throw $e;
|
|
}
|
|
}
|
|
|
|
public function removeItems($scheduledItems, $adjustSched = true, $cancelShow = false)
|
|
{
|
|
$showInstances = [];
|
|
$this->con->beginTransaction();
|
|
|
|
try {
|
|
$this->validateRequest($scheduledItems, true, true);
|
|
|
|
$scheduledIds = [];
|
|
foreach ($scheduledItems as $item) {
|
|
$scheduledIds[] = $item['id'];
|
|
}
|
|
|
|
$removedItems = CcScheduleQuery::create()->findPks($scheduledIds);
|
|
|
|
// This array is used to keep track of every show instance that was
|
|
// effected by the track deletion. It will be used later on to
|
|
// remove gaps in the schedule and adjust crossfade times.
|
|
$effectedInstanceIds = [];
|
|
|
|
foreach ($removedItems as $removedItem) {
|
|
$instance = $removedItem->getCcShowInstances($this->con);
|
|
$effectedInstanceIds[$instance->getDbId()] = $instance->getDbId();
|
|
|
|
// check if instance is linked and if so get the schedule items
|
|
// for all linked instances so we can delete them too
|
|
if (!$cancelShow && $instance->getCcShow()->isLinked()) {
|
|
// returns all linked instances if linked
|
|
$ccShowInstances = $this->getInstances($instance->getDbId());
|
|
|
|
$instanceIds = [];
|
|
foreach ($ccShowInstances as $ccShowInstance) {
|
|
$instanceIds[] = $ccShowInstance->getDbId();
|
|
}
|
|
$effectedInstanceIds = array_merge($effectedInstanceIds, $instanceIds);
|
|
|
|
// Delete the same track, represented by $removedItem, in
|
|
// each linked show instance.
|
|
$itemsToDelete = CcScheduleQuery::create()
|
|
->filterByDbPosition($removedItem->getDbPosition())
|
|
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
|
->filterByDbId($removedItem->getDbId(), Criteria::NOT_EQUAL)
|
|
->delete($this->con);
|
|
}
|
|
|
|
// check to truncate the currently playing item instead of deleting it.
|
|
if ($removedItem->isCurrentItem($this->epochNow)) {
|
|
$nEpoch = $this->epochNow;
|
|
$sEpoch = $removedItem->getDbStarts('U.u');
|
|
|
|
$length = bcsub($nEpoch, $sEpoch, 6);
|
|
$cliplength = Application_Common_DateHelper::secondsToPlaylistTime($length);
|
|
|
|
$cueinSec = Application_Common_DateHelper::playlistTimeToSeconds($removedItem->getDbCueIn());
|
|
$cueOutSec = bcadd($cueinSec, $length, 6);
|
|
$cueout = Application_Common_DateHelper::secondsToPlaylistTime($cueOutSec);
|
|
|
|
// Set DbEnds - 1 second because otherwise there can be a timing issue
|
|
// when sending the new schedule to Pypo where Pypo thinks the track is still
|
|
// playing.
|
|
$removedItem->setDbCueOut($cueout)
|
|
->setDbClipLength($cliplength)
|
|
->setDbEnds($this->nowDT)
|
|
->save($this->con);
|
|
} else {
|
|
$removedItem->delete($this->con);
|
|
}
|
|
}
|
|
Application_Model_StoredFile::updatePastFilesIsScheduled();
|
|
|
|
if ($adjustSched === true) {
|
|
foreach ($effectedInstanceIds as $instance) {
|
|
$this->removeGaps($instance);
|
|
$this->calculateCrossfades($instance);
|
|
}
|
|
}
|
|
|
|
// update the status flag in cc_schedule.
|
|
$instances = CcShowInstancesQuery::create()
|
|
->filterByPrimaryKeys($effectedInstanceIds)
|
|
->find($this->con);
|
|
|
|
foreach ($instances as $instance) {
|
|
$instance->updateScheduleStatus($this->con);
|
|
$instance->correctSchedulePositions();
|
|
}
|
|
|
|
// update the last scheduled timestamp.
|
|
CcShowInstancesQuery::create()
|
|
->filterByPrimaryKeys($showInstances)
|
|
->update(['DbLastScheduled' => new DateTime('now', new DateTimeZone('UTC'))], $this->con);
|
|
|
|
$this->con->commit();
|
|
|
|
Application_Model_RabbitMq::PushSchedule();
|
|
} catch (Exception $e) {
|
|
$this->con->rollback();
|
|
|
|
throw $e;
|
|
}
|
|
}
|
|
|
|
// This is used to determine the duration of a files array
|
|
public function timeLengthOfFiles($files)
|
|
{
|
|
return array_reduce(
|
|
$files,
|
|
fn ($acc, $file) => $acc + Application_Common_DateHelper::playlistTimeToSeconds($file['cliplength']),
|
|
0.0
|
|
);
|
|
}
|
|
|
|
/*
|
|
* Used for cancelling the current show instance.
|
|
*
|
|
* @param $p_id id of the show instance to cancel.
|
|
*/
|
|
public function cancelShow($p_id)
|
|
{
|
|
$this->con->beginTransaction();
|
|
|
|
try {
|
|
$instance = CcShowInstancesQuery::create()->findPK($p_id);
|
|
|
|
if (!$instance->getDbRecord()) {
|
|
$items = CcScheduleQuery::create()
|
|
->filterByDbInstanceId($p_id)
|
|
->filterByDbEnds($this->nowDT, Criteria::GREATER_THAN)
|
|
->find($this->con);
|
|
|
|
if (count($items) > 0) {
|
|
$remove = [];
|
|
$ts = $this->nowDT->format('U');
|
|
|
|
for ($i = 0; $i < count($items); ++$i) {
|
|
$remove[$i]['instance'] = $p_id;
|
|
$remove[$i]['timestamp'] = $ts;
|
|
$remove[$i]['id'] = $items[$i]->getDbId();
|
|
}
|
|
|
|
$this->removeItems($remove, false, true);
|
|
}
|
|
} else {
|
|
$rebroadcasts = $instance->getCcShowInstancessRelatedByDbId(null, $this->con);
|
|
$rebroadcasts->delete($this->con);
|
|
}
|
|
|
|
$instance->setDbEnds($this->nowDT);
|
|
$instance->save($this->con);
|
|
|
|
$this->con->commit();
|
|
|
|
if ($instance->getDbRecord()) {
|
|
Application_Model_RabbitMq::SendMessageToShowRecorder('cancel_recording');
|
|
}
|
|
} catch (Exception $e) {
|
|
$this->con->rollback();
|
|
|
|
throw $e;
|
|
}
|
|
}
|
|
}
|
|
|
|
class OutDatedScheduleException extends Exception {}
|