-
-
Notifications
You must be signed in to change notification settings - Fork 231
feat(legacy): update deprecated PHP code #2789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These all look reasonable. Can you please add CI runs against PHP 8.x here and fix the linting failures?
b7f0e9f
to
666f3f9
Compare
@paddatrapper Hi,
|
Ah, I misunderstood the purpose of this PR and thought you were adding support for PHP 8.
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()
{
- $ DEFAULT_TIMESTAMP_FORMAT, floor(hrtime(true)) - self::PENDING_FILE_TIMEOUT_SECONDS);
+ $ floor(hrtime(true)) - self::PENDING_FILE_TIMEOUT_SECONDS);
self::$_pendingFiles = CcFilesQuery::create()
->filterByDbImportStatus(CcFiles::IMPORT_STATUS_PENDING)
->filterByDbUtime($oneHourAgo, Criteria::LESS_EQUAL) |
ac2906e
to
4e509dd
Compare
24ec6ec
to
831c9c5
Compare
4f28717
to
cac7f6e
Compare
98c65c7
to
1d85653
Compare
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: #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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
All the changes under 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 libretime/propel1#2 but i'm not fixing this pr since you take over ..... |
This PR is not adding that support, so they will fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libretime/propel1#1 is now merged, can you please regenerate the files here? Then this should be ready to merge
### Description add Liquidsoap2.0 files (port syntax 1.4 to 2.0) ### Testing Notes I ran libretime on ubuntu 22.04 and liquidsoap2.0 this pr is just the beginning, just 2 files added it's a clean one... in order to work under 22.04,it requires changes in 1. this pr 1. (#2789) 1. libretime/propel (libretime/propel1#1) or change legacy /composer.json ``` "type": "vcs", - "url": "https://github.com/libretime/propel1" + "url": "https://github.com/mp3butcher/propel1" }, { "type": "vcs", @@ -30,7 +30,7 @@ "james-heinrich/getid3": "^1.9", "league/uri": "^6.7", "libretime/celery-php": "dev-main", - "libretime/propel1": "dev-main", + "mp3butcher/propel1": "main", "php-amqplib/php-amqplib": "^3.0", ``` 4. and few mods in install ``` case "$ID-$VERSION_ID" in ubuntu-20.04) is_ubuntu=true && distro="focal" ;; + ubuntu-22.04) is_ubuntu=true && distro="jammy" ;; debian-11) is_debian=true && distro="bullseye" ;; *) error "could not determine supported distribution '$ID-$VERSION_ID' @@ -375,8 +376,12 @@ prepare_packages_install() { if $is_ubuntu; then install_packages software-properties-common - add-apt-repository -y ppa:libretime/libretime + +if echo $distro | grep -q 'focal'; then + add-apt-repository -y ppa:libretime/libretime + fi + if echo $distro | grep -q 'jammy'; then + apt-get install php-cli php-dev php php-fpm php-pear php-yaml php-gd php-bcmath php-curl + fi DEBIAN_FRONTEND=noninteractive apt-get -q update fi } ``` It will require testing changes against ubuntu 20.4 and debian,that's why i think a testing branch can be wise --------- Co-authored-by: mp3butcher <mp3butcher@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🤖 I have created a release *beep* *boop* --- ## [4.3.0](4.2.0...4.3.0) (2025-03-12) ### Features * add flac support to Web player ([#3128](#3128)) ([203c927](203c927)) * add Norwegian Bokmål locale ([#3073](#3073)) ([e614fbc](e614fbc)) * **analyzer:** parse comment fields from mp3 files ([#3082](#3082)) ([02a779b](02a779b)) * **api:** added filters on genre & md5 for files api ([#3127](#3127)) ([b1bdd6d](b1bdd6d)) * **api:** enable writes to schedule table ([#3109](#3109)) ([2ac7e8a](2ac7e8a)) * **legacy:** implement subset sum solution to show scheduling ([#3019](#3019)) ([5b5c68c](5b5c68c)), closes [#3018](#3018) * **legacy:** order by filename when lptime is null ([#3069](#3069)) ([8c26505](8c26505)) * **legacy:** show filename and size on edit page and add filename datatable column ([#3083](#3083)) ([16deaf0](16deaf0)), closes [#3053](#3053) * **legacy:** trused header sso auth ([#3095](#3095)) ([2985d85](2985d85)) * **legacy:** update deprecated PHP code ([#2789](#2789)) ([3a8dcbc](3a8dcbc)) * **playout:** add Liquidsoap 2.0 support ([#2786](#2786)) ([f9c0bd5](f9c0bd5)) * use custom intro/outro playlists per show ([#2941](#2941)) ([299be3c](299be3c)) ### Bug Fixes * add missing file for nb_NO locale ([#3075](#3075)) ([a3865aa](a3865aa)) * **analyzer:** make ffmpeg filters less aggressive ([#3086](#3086)) ([32cad0f](32cad0f)), closes [#2629](#2629) * docker warnings "keywords casing do not match" ([#3048](#3048)) ([e095cb2](e095cb2)) * intro/outro playlist unset was impossible ([#3101](#3101)) ([7992a9b](7992a9b)) * **legacy:** additional specifics added to CSVexport.js for RFC 4180 ([#3131](#3131)) ([644d2b9](644d2b9)), closes [#2477](#2477) * **legacy:** fix filename criteria searching ([#3068](#3068)) ([c883d0f](c883d0f)) * **legacy:** migrations from airtime 2.5.1 ([#3123](#3123)) ([82d5af2](82d5af2)) * **legacy:** support Postgresql 12 syntax ([#3103](#3103)) ([0b221f4](0b221f4)), closes [#3102](#3102) * **playout:** improve the way hashlib is called in libretime_playout/player ([#3135](#3135)) ([5b4c720](5b4c720)), closes [#3134](#3134) * regenerate API schema ([38a0bf9](38a0bf9)) * regenerate API schema ([ce257a1](ce257a1)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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