8000 feat(legacy): update deprecated PHP code by mp3butcher · Pull Request #2789 · libretime/libretime · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 17 commits into from
Mar 12, 2025

Conversation

mp3butcher
Copy link
Contributor
@mp3butcher mp3butcher commented Nov 27, 2023

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

@mp3butcher mp3butcher changed the title update deprecated code feat(application): update deprecated PHP Nov 27, 2023
@mp3butcher mp3butcher changed the title feat(application): update deprecated PHP feat(legacy): update deprecated PHP Nov 27, 2023
Copy link
Contributor
@paddatrapper paddatrapper left a 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?

@mp3butcher
Copy link
Contributor Author

@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?

@paddatrapper
Copy link
Contributor

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()
     {
-        $ 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)

@mp3butcher mp3butcher force-pushed the ubuntu22.04 branch 2 times, most recently from ac2906e to 4e509dd Compare November 28, 2023 13:05
@mp3butcher mp3butcher force-pushed the ubuntu22.04 branch 3 times, most recently from 24ec6ec to 831c9c5 Compare November 28, 2023 17:21
@mp3butcher mp3butcher changed the title feat(legacy): update deprecated PHP feat(legacy): update deprecated PHP code Nov 28, 2023
@mp3butcher mp3butcher changed the title feat(legacy): update deprecated PHP code feat(legacy): update deprecated PHP code forbid usage of strftime()-style date formatting (and so remove call to deprecated strftime) Nov 28, 2023
@mp3butcher mp3butcher changed the title feat(legacy): update deprecated PHP code forbid usage of strftime()-style date formatting (and so remove call to deprecated strftime) feat(legacy): update deprecated PHP code Nov 28, 2023
@mp3butcher mp3butcher force-pushed the ubuntu22.04 branch 4 times, most recently from 4f28717 to cac7f6e Compare November 30, 2023 16:14
@mp3butcher mp3butcher force-pushed the ubuntu22.04 branch 2 times, most recently from 98c65c7 to 1d85653 Compare November 30, 2023 17:11
@jooola
Copy link
Contributor
jooola commented Dec 18, 2023

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

@jooola
Copy link
Contributor
jooola commented Jan 13, 2024

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.

@paddatrapper
Copy link
Contributor

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

Copy link
Contributor
@paddatrapper paddatrapper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
codecov bot commented Feb 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.36% 8000 . Comparing base (2b119ad) to head (f86305c).
Report is 85 commits behind head on main.

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.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jooola
Copy link
Contributor
jooola commented Feb 2, 2024

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.

@jooola
Copy link
Contributor
jooola commented Feb 2, 2024

Maybe enabling https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict in our files is also a good idea?

@mp3butcher
Copy link
Contributor Author
mp3butcher commented Feb 4, 2024

i pushed a commit on libretime/propel1#2 but i'm not fixing this pr since you take over .....

Copy link
Contributor
@paddatrapper paddatrapper left a 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

paddatrapper pushed a commit that referenced this pull request Feb 25, 2025
### 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>
Copy link
Contributor
@paddatrapper paddatrapper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@paddatrapper paddatrapper merged commit 3a8dcbc into libretime:main Mar 12, 2025
14 checks passed
paddatrapper pushed a commit that referenced this pull request Mar 12, 2025
🤖 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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0