Lychee icon indicating copy to clipboard operation
Lychee copied to clipboard

500 HttpException while upgrading Lychee from 4.5.3 to 4.6.0

Open prbt2016 opened this issue 2 years ago • 4 comments

Detailed description of the problem [REQUIRED]

A clear and concise description of what the bug is.

I was in the process of upgrading Lychee 4.5.3 to 4.6.0 on 7.9.2009 (Core) with PHP 8.0, MYSQL 5.7, Apache 2.4 using the manual update method mentioned in docs :

https://lycheeorg.github.io/docs/update.html#update-manually

However after migrating the user and successful migration completion .

When I visit the URL i.e :

http://domain.com/{{lychee-folder}}/public/gallery

The following is thrown i.e :

500 HttpException Undefined variable $locale (View: /{{PATH}}/{{TO}}/{{LYCHEE}}/resources/views/gallery.blade.php)

Any way to resolve this? . Is it a known issue?

Steps to reproduce the issue

Steps to reproduce the behavior:

  1. Try to upgrade Lychee using the following docs https://lycheeorg.github.io/docs/update.html#update-manually
  2. Migrate user entering the user credentials.
  3. Migration successful
  4. Visit the URL http://domain.com/{{lychee-folder}}/public/gallery
  5. 500 HttpException Undefined variable $locale (View: /{{PATH}}/{{TO}}/{{LYCHEE}}/resources/views/gallery.blade.php) is thrown.

Screenshots image

Output of the diagnostics [REQUIRED]

Output from php artisan lychee:diagnostics

System Information
------------------
Lychee Version (release):        4.6.0
DB Version:                      4.6.0

composer install:                --no-dev
APP_ENV:                         production
APP_DEBUG:                       false

System:                          Linux
PHP Version:                     8.0.16
PHP User agent:                  Lychee/4 (https://lycheeorg.github.io/)
Timezone:                        UTC
Max uploaded file size:          20M
Max post size:                   8M
Max execution time:              0
MySQL Version:                   5.7.39

exec() Available:                yes
Imagick Available:               -
Imagick Enabled:                 1
Imagick Version:                 -
GD Version:                      bundled (2.1.0 compatible)

Config Information
------------------
version:                         040600
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:                 0
small_max_width:                 0
small_max_height:                360
medium_max_width:                1920
medium_max_height:               1080
lang:                            en
layout:                          1
image_overlay_type:              desc
default_license:                 none
compression_quality:             90
full_photo:                      1
delete_imported:                 0
Mod_Frame:                       1
Mod_Frame_refresh:               30
thumb_2x:                        1
small_2x:                        1
medium_2x:                       1
landing_page_enable:             0
landing_owner:                   John Smith
landing_title:                   John Smith
landing_subtitle:                Cats, Dogs & Humans Photography
landing_facebook:                https://www.facebook.com/JohnSmith
landing_flickr:                  https://www.flickr.com/JohnSmith
landing_twitter:                 https://www.twitter.com/JohnSmith
landing_instagram:               https://instagram.com/JohnSmith
landing_youtube:                 https://www.youtube.com/JohnSmith
landing_background:              dist/cat.jpg
site_title:                      Lychee v4
site_copyright_enable:           1
site_copyright_begin:            2019
site_copyright_end:              2019
additional_footer_text:
display_social_in_gallery:       0
public_search:                   0
SL_enable:                       0
SL_for_admin:                    0
public_recent:                   0
recent_age:                      1
public_starred:                  0
downloadable:                    0
photos_wraparound:               1
map_display:                     0
zip64:                           1
map_display_public:              0
map_provider:                    Wikimedia
force_32bit_ids:                 0
map_include_subalbums:           0
update_check_every_days:         3
has_exiftool:                    0
share_button_visible:            0
import_via_symlink:              0
has_ffmpeg:                      0
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
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

Browser and system

Mozilla Firefox 104.0.1 (64-bit) CentOS Linux release 7.9.2009 (Core)

prbt2016 avatar Sep 05 '22 10:09 prbt2016

This is definitely a new bug. We have just recently removed the variable $locale and obviously this is an oversight, i.e. something is still referring to this variable.

I am only wondering why this has not been noticed before during our tests.

nagmat84 avatar Sep 05 '22 10:09 nagmat84

I think this is a caching problem. I can't find the $locale variable in any of the resource files.

Edit: just migrated my Prod to latest master, no such error.

ildyria avatar Sep 05 '22 10:09 ildyria

Please try to run the command

./artisan optimize:clear

The output should look like this

Cached events cleared!
Compiled views cleared!
Route cache cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!

The important points are clearing the cache for views, routes and configuration.

@LycheeOrg/reviewers Maybe we should add the command artisan optimize:clear to the hooks for git pull and composer install. We already had some bug reports due to caching problems.

nagmat84 avatar Sep 05 '22 18:09 nagmat84

Hello @nagmat84 ,

After issuing command php artisan optimize:clear Lychee works fine . It would be great if this is handled by code itself in the background, as many users on shared hosting won't have access to command line and hence won't be able to do the same and face the same issue due to caching of the old files.

Regards.

prbt2016 avatar Sep 06 '22 03:09 prbt2016

Hello @nagmat84 , @ildyria

The above error is still thrown i.e .

image

Error still shown thrown even after adding these commit files https://github.com/LycheeOrg/Lychee/commit/f905e22ebb3662e179556e248ba2589bedd14edd to 4.6.0 package and performing an upgrade from 4.5.3:

prbt2016 avatar Sep 29 '22 09:09 prbt2016

What is meant as "during update" is when you use git to pull the data. In your case it sounds like to me that you are replacing the files with a drag & drop/ftp as a result, this optimize:clear is not run.

ildyria avatar Sep 29 '22 09:09 ildyria

Weird. If I remember correctly, @ildyria removed the $locale variable in favor of the Lang facade some time ago and there shouldn't be any references to the $locale variable anymore.

Did you also run

./artisan optimize:clear

from the CLI and did that command succeed?

nagmat84 avatar Sep 29 '22 09:09 nagmat84

Hello @nagmat84 ,

./artisan optimize:clear

After running this Lychee works fine .

@ildyria I am not using git update to pull files . Using the manual update method :

https://lycheeorg.github.io/docs/update.html#update-manually

In your case it sounds like to me that you are replacing the files with a drag & drop/ftp as a result,

Exactly , with the 4.6.0 files + the commited one's (i.e replacing composer.json , /scripts/post-merge and adding /app/Console/Commands/Optimize.php).

prbt2016 avatar Sep 29 '22 09:09 prbt2016

Hi,

I am also getting the same error when upgrading from 4.5.3 to 4.6.1. The migration applies successfully. However when I try to access the admin url it throws the following error.

**_HttpException

Undefined variable $locale (View: [[PATH]]/resources/views/gallery.blade.php)_**

I am on a shared hosting environment so won't be able to execute ./artisan optimize:clear command as I do not have CLI access.

jameswill avatar Oct 11 '22 12:10 jameswill