Skip to content
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

500 HttpException while upgrading Lychee from 4.5.3 to 4.6.0 #1506

Closed
prbt2016 opened this issue Sep 5, 2022 · 9 comments · Fixed by #1516
Closed

500 HttpException while upgrading Lychee from 4.5.3 to 4.6.0 #1506

prbt2016 opened this issue Sep 5, 2022 · 9 comments · Fixed by #1516
Labels
bug Something isn't working

Comments

@prbt2016
Copy link

prbt2016 commented Sep 5, 2022

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)

@ildyria ildyria added bug Something isn't working High Priority High priority issues labels Sep 5, 2022
@nagmat84
Copy link
Collaborator

nagmat84 commented Sep 5, 2022

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.

@ildyria
Copy link
Member

ildyria commented Sep 5, 2022

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.

@nagmat84
Copy link
Collaborator

nagmat84 commented Sep 5, 2022

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.

@prbt2016
Copy link
Author

prbt2016 commented Sep 6, 2022

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.

@ildyria ildyria removed the High Priority High priority issues label Sep 6, 2022
@nagmat84 nagmat84 mentioned this issue Sep 10, 2022
nagmat84 added a commit that referenced this issue Sep 28, 2022
* Run `optimize:clear` during update

* Put optimize command on steroids

* Repair optimize command

* Adopted scripts

* Apply suggestions from code review

Co-authored-by: Kamil Iskra <kamil.01482@iskra.name>

* Fixed unfinished sentence

Co-authored-by: Matthias Nagel <matthias.h.nagel@gmail.com>
Co-authored-by: Kamil Iskra <kamil.01482@iskra.name>
@prbt2016
Copy link
Author

prbt2016 commented Sep 29, 2022

Hello @nagmat84 , @ildyria

The above error is still thrown i.e .

image

Error still shown thrown even after adding these commit files f905e22 to 4.6.0 package and performing an upgrade from 4.5.3:

@ildyria
Copy link
Member

ildyria commented Sep 29, 2022

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.

@nagmat84
Copy link
Collaborator

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?

@prbt2016
Copy link
Author

prbt2016 commented Sep 29, 2022

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).

@jameswill
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants