LycheeOrg / Lychee

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
https://lycheeorg.github.io/
MIT License
3.32k stars 296 forks source link

Updating to latest HEAD seems to require PHP 8.1 #1670

Closed evoludolab closed 1 year ago

evoludolab commented 1 year ago

Detailed description of the problem [REQUIRED]

Updating to the latest HEAD (5a4c154 at time of writing) seems to have corrupted my SQLite database. Presumably this happened because I hadn't updated PHP beforehand (running PHP 8.0.26). After updating PHP, applying the migration again on my backup DB worked fine.

If my diagnosis is correct, would it be possible to check the PHP version first, throw an error/warning and skip the migration if the version is <8.1?

Output of the diagnostics [REQUIRED]

System Information
------------------
Lychee Version (git):                    num_albums_photos (48cfbcf) -- Could not compare.
DB Version:                              4.6.5

composer install:                        dev
APP_ENV:                                 local
APP_DEBUG:                               true

System:                                  Darwin
PHP Version:                             8.1.13
PHP User agent:                          Lychee/4 (https://lycheeorg.github.io/)
Timezone:                                UTC
Max uploaded file size:                  500M
Max post size:                           500M
Max execution time:                      0
SQLite Version:                          3.40.0

exec() Available:                        yes
Imagick Available:                       1
Imagick Enabled:                         1
Imagick Version:                         1691
GD Version:                              bundled (2.1.0 compatible)
Number of foreign key:                   9 found.

Config Information
------------------
version:                                 040605
check_for_updates:                       0
sorting_photos_col:                      taken_at
sorting_photos_order:                    ASC
sorting_albums_col:                      max_taken_at
sorting_albums_order:                    ASC
imagick:                                 1
skip_duplicates:                         1
small_max_width:                         0
small_max_height:                        360
medium_max_width:                        1920
medium_max_height:                       1080
lang:                                    en
layout:                                  1
image_overlay_type:                      exif
default_license:                         none
compression_quality:                     90
grants_full_photo_access:                1
delete_imported:                         0
mod_frame_enabled:                       1
mod_frame_refresh:                       30
thumb_2x:                                1
small_2x:                                1
medium_2x:                               1
landing_page_enable:                     0
site_owner:                              John Smith
landing_title:                           John Smith
landing_subtitle:                        Cats, Dogs & Humans Photography
sm_facebook_url:                         https://www.facebook.com/JohnSmith
sm_flickr_url:                           https://www.flickr.com/JohnSmith
sm_twitter_url:                          https://www.twitter.com/JohnSmith
sm_instagram_url:                        https://instagram.com/JohnSmith
sm_youtube_url:                          https://www.youtube.com/JohnSmith
landing_background:                      dist/cat.webp
site_title:                              Lychee v4
footer_show_copyright:                   1
site_copyright_begin:                    2019
site_copyright_end:                      2019
footer_additional_text:                  
footer_show_social_media:                0
public_search:                           0
SL_enable:                               0
SL_for_admin:                            0
public_recent:                           0
recent_age:                              1
public_starred:                          0
grants_download:                         0
photos_wraparound:                       1
map_display:                             1
zip64:                                   1
map_display_public:                      0
map_provider:                            Wikimedia
force_32bit_ids:                         0
map_include_subalbums:                   0
update_check_every_days:                 3
has_exiftool:                            1
share_button_visible:                    0
import_via_symlink:                      1
has_ffmpeg:                              1
location_decoding:                       0
location_decoding_timeout:               30
location_show:                           1
location_show_public:                    0
rss_enable:                              0
rss_recent_days:                         7
rss_max_items:                           100
prefer_available_xmp_metadata:           0
editor_enabled:                          1
lossless_optimization:                   0
swipe_tolerance_x:                       150
swipe_tolerance_y:                       250
local_takestamp_video_formats:           .avi|.mov
log_max_num_line:                        1000
unlock_password_photos_with_url_param:   0
nsfw_visible:                            1
nsfw_blur:                               0
nsfw_warning:                            0
nsfw_warning_admin:                      0
nsfw_banner_override:                    
map_display_direction:                   1
album_subtitle_type:                     oldstyle
upload_processing_limit:                 4
public_photos_hidden:                    1
new_photos_notification:                 0
legacy_id_redirection:                   1
zip_deflate_level:                       6
SA_enabled:                              1
album_decoration:                        original
album_decoration_orientation:            row
default_album_protection:                1
allow_username_change:                   1

Browser and system

Safari, macOS 12

qwerty287 commented 1 year ago

Yes, we've dropped PHP 8.0 support. 4.6.5 will be the last release that supports it. The reason is that PHP 8.0 is out of active support and we only support versions that are actively (and fully) supported by the PHP team.

qwerty287 commented 1 year ago

@evoludolab We added a PHP check now, however, I wonder why Composer didn't fail. Usually, Composer fails if your PHP version is too old. Looks like you didn't run composer install after pulling, or am I wrong here and Composer doesn't warn you?

evoludolab commented 1 year ago

@qwerty287 Indeed I didn't run composer after pulling but things went sideways already before, or at least without me being aware. I was merging upstream/master into my PR #1631 with GitHub Desktop. I assume a hook then triggered the migration, which destroyed my DB. Everything happened behind the scenes and looked like the merge was successful. Only afterwards I was left with the unpleasant surprise of a corrupted users table. With the warning sign in the title of #1618 I was of course aware that I would have to update at least to PHP 8.1 but not that it was needed before pulling. Hope that helps.