feat(legacy): update deprecated PHP code
Description
update deprecated code. It's mergeable with master without syntax conflicts across php versions remove deprecated((https://www.php.net/manual/fr/function.strftime.php)) and unsafe (https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=strftime) strftime syntax
@paddatrapper Hi, I'm not very familiar with CI but:
- these changes does't seem to involve php version conflicts (only deprecation)
- lint error is not clear at all. How do I debug these logs?
these changes does't seem to involve php version conflicts (only deprecation)
Ah, I misunderstood the purpose of this PR and thought you were adding support for PHP 8.
lint error is not clear at all. How do I debug these logs?
The failing 7.4 PHP linting CI shows diffs on formatting changes that need to be applied to your code. You can also test this locally via pre-commit. For example the following change highlights a space that needs removing:
--- /home/runner/work/libretime/libretime/legacy/application/services/MediaService.php
+++ /home/runner/work/libretime/libretime/legacy/application/services/MediaService.php
@@ -135,7 +135,7 @@
*/
public static function areFilesStuckInPending()
{
- $oneHourAgo = gmdate( DEFAULT_TIMESTAMP_FORMAT, floor(hrtime(true)) - self::PENDING_FILE_TIMEOUT_SECONDS);
+ $oneHourAgo = gmdate(DEFAULT_TIMESTAMP_FORMAT, floor(hrtime(true)) - self::PENDING_FILE_TIMEOUT_SECONDS);
self::$_pendingFiles = CcFilesQuery::create()
->filterByDbImportStatus(CcFiles::IMPORT_STATUS_PENDING)
->filterByDbUtime($oneHourAgo, Criteria::LESS_EQUAL)
There are a lot of resources in regard to the PHP 8.0 support, I think it's wise to take a look at them and use the existing work of others: https://github.com/libretime/libretime/issues/2047
This PR is not testable, the docker dev setup does not work out of the box when bumping the php version to 8.1.
Please make sure to fix this, so this PR is self contained.
I thought the point of this PR was that is isn't upgrading PHP to 8.0. Rather it's a prerequisite for that to happen later
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 70.36%. Comparing base (
2b119ad) to head (f86305c). Report is 85 commits behind head on main.
:exclamation: Current head f86305c differs from pull request most recent head 6b218cc
Please upload reports for the commit 6b218cc to get more accurate results.
Additional details and impacted files
@@ Coverage Diff @@
## main #2789 +/- ##
=======================================
Coverage 70.36% 70.36%
=======================================
Files 149 149
Lines 4033 4033
=======================================
Hits 2838 2838
Misses 1195 1195
| Flag | Coverage Δ | |
|---|---|---|
| analyzer | 47.00% <100.00%> (ø) |
|
| api | 93.72% <ø> (ø) |
|
| api-client | 64.40% <ø> (ø) |
|
| playout | 47.40% <ø> (ø) |
|
| shared | 89.09% <ø> (ø) |
|
| worker | 89.21% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
All the changes under /legacy/application/models/airtime must come from the Propel Library, as those files as autogenerated. See the properl-gen make target in /legacy/Makefile.
Please propose a change against the propel library and we can then update the files by regenerating them here.
Other than that, the rest looks good.
Maybe enabling https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict in our files is also a good idea?
i pushed a commit on https://github.com/libretime/propel1/pull/2 but i'm not fixing this pr since you take over .....