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

Updating breaks Lychee #1192

Closed
oblomow opened this issue Jan 14, 2022 · 58 comments · Fixed by #1194
Closed

Updating breaks Lychee #1192

oblomow opened this issue Jan 14, 2022 · 58 comments · Fixed by #1194

Comments

@oblomow
Copy link

oblomow commented Jan 14, 2022

Detailed description of the problem

Updating breaks Lychee. ( thank $deity for backups and databasedumps)

Steps to reproduce the issue

Steps to reproduce the behavior:

  1. log on to (working) Lychee
  2. Click on 'update'
  3. After updating there is an error about missing admin in the database. please run: php artisan lychee:reset_admin
  4. Error page:database out of date.

Screenshots
If applicable, add screenshots to help explain your problem.

Output of the diagnostics

Diagnostics

Info: Latest version of PHP is 8.1

System Information

Lychee Version (git): master (a7de020) - Up to date (13 hours ago).
DB Version: 4.4.0

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

System: FreeBSD
PHP Version: 8
PHP User agent: Lychee/4 (https://lycheeorg.github.io/)
Max uploaded file size: 100M
Max post size: 100M
Max execution time: 0
MySQL Version: 8.0.27

Imagick: 1
Imagick Active: 1
Imagick Version: 1692
GD Version: 2.3.1

Config Information

version: 040400
check_for_updates: 1
sorting_Photos_col: taken_at
sorting_Photos_order: ASC
sorting_Albums_col: title
sorting_Albums_order: DESC
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: date
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: 1
landing_owner: Marc
landing_title: Marc
landing_subtitle: Why stop now?
landing_facebook:
landing_flickr:
landing_twitter:
landing_instagram:
landing_youtube:
landing_background: dist/finland.jpg
site_title: fotos
site_copyright_enable: 1
site_copyright_begin: 1984
site_copyright_end: 2021
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: OpenStreetMap.org
force_32bit_ids: 0
map_include_subalbums: 0
update_check_every_days: 3
has_exiftool: 1
share_button_visible: 0
import_via_symlink: 0
has_ffmpeg: 0
location_decoding: 0
location_decoding_timeout: 30
location_show: 0
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

Browser and system

Browser: Firefox 96.0

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

Hi, Sorry for the break :(

Is there any way you can send us the dump of your database so we can figure out what is wrong ?

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

Yes, I can send the database. Is it possible to create some kind of 'trace' for you while I rerun the update?

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

I assume you did the migration via the UI, if so there is no possible trace.

However, if you have access to command line, you may want to try to run the update manually via:
php artisan migrate
This should also produce some kind of trace.

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

Yes, I have command line access. (oh before I forget: no worries about the breaking. I really like Lychee, and these things can happen)

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

This is also why this is only released on master and not an official release zip yet. :)

See more of the change log here: https://lycheeorg.github.io/docs/releases.html#master-branch

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

sudo -u www php artisan migrate

Nothing to migrate.

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

O.o

This does not match with your diagnostics:
version: 040400

while it should be :

Configs::where('key', 'version')->update(['value' => '040500']);

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

I have rolled back to a working system. But I guess you know that.

diagnostics still says:

Diagnostics
-------
Info: Latest version of PHP is 8.1




System Information
--------------
Lychee Version (git):            master (a7de020) - Up to date (14 hours ago).
DB Version:                      4.4.0

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

System:                          FreeBSD
PHP Version:                     8
PHP User agent:                  Lychee/4 (https://lycheeorg.github.io/)
Max uploaded file size:          100M
Max post size:                   100M
Max execution time:              200
MySQL Version:                   8.0.27

Imagick:                         1
Imagick Active:                  1
Imagick Version:                 1692
GD Version:                      2.3.1

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

hummmm. Not normal.

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

if I run the update from the webinterface I get;

Diagnostics
-------
Error: User Admin not found in database. Please run: "php artisan lychee:reset_admin"
Info: Latest version of PHP is 8.1

2022-01-14 11_48_51-Error - Database File Versions mismatch

an if I press upgrade I get a 500| SERVER ERROR

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

If I now run the command, I get:

sudo -u www php artisan migrate

Migrating: 2021_12_04_181200_refactor_models

In Connection.php line 705:

SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'lychee.sym_links' (SQL: drop table sym_ links)

In Connection.php line 494:

SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'lychee.sym_links'

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

Error: User Admin not found in database. Please run: "php artisan lychee:reset_admin"

That is definitively NOT normal.

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

in 4.4 there should be admin in the database.

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

should there be a 'admin' user in the users-table?

there are 2 users there. id 0, wih a 'hashed' username and id 1 (a guest user)

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

user with id 0 with hashed username is the admin user.
That's why I don't understand why it is saying there is no admin.

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

Is there anything else I can try or run to give you more insight?
I am no php-programmer, but am familiar with bash and mysql.

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

@nagmat84 :/

@kamil4
Copy link
Contributor

kamil4 commented Jan 14, 2022

Honestly, I hate that whole "update from the webinterface" thing; if it works, it works, but if it fails, who knows why? Since you have the commandline access, can you do all of it that way please and send us the logs? That will be much more useful...

Basically, revert the Lychee tree to the last working state (I assume that's commit a7de020 for you; check with git log --oneline -1) with a corresponding working version of the database in place). I'm assuming your Lychee tree is clean (check with git status). Then run git pull --rebase and let's see the output of that...

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

sudo -u www git log --oneline -1
a7de020 (HEAD -> master) Remove PHP7 leftovers (#1173)


sudo -u www git status
Refresh index: 100% (650/650), done.
On branch master
Your branch is ahead of 'origin/master' by 69 commits.
(use "git push" to publish your local commits)

Untracked files:
(use "git add ..." to include in what will be committed)
about.html
public/dist/finland.jpg

nothing added to commit but untracked files present (use "git add" to track)


git pull --rebase
remote: Enumerating objects: 5297, done.
remote: Counting objects: 100% (5296/5296), done.
remote: Compressing objects: 100% (1249/1249), done.
remote: Total 5297 (delta 4050), reused 5162 (delta 3980), pack-reused 1
Receiving objects: 100% (5297/5297), 1.47 MiB | 8.27 MiB/s, done.
Resolving deltas: 100% (4050/4050), completed with 151 local objects.
From https://github.com/LycheeOrg/Lychee
376f8c7..32c374d master -> origin/master

  • [new branch] consistent_json_api -> origin/consistent_json_api
  • [new branch] enable-phpstan -> origin/enable-phpstan
  • [new branch] livewire/more-work -> origin/livewire/more-work
  • [new branch] wip-symlink-except -> origin/wip-symlink-except
  • [new tag] v4.3.0 -> v4.3.0
  • [new tag] v4.3.4 -> v4.3.4
  • [new tag] v4.3.5 -> v4.3.5
  • [new tag] v4.3.6 -> v4.3.6
  • [new tag] v4.4.0 -> v4.4.0
    Updating a7de020..32c374d
    Fast-forward
    .github/workflows/Build.yml | 4 +-
    .phpstorm.meta.php | 66 +-
    app/Actions/Album/Action.php | 5 +-
    app/Actions/Album/Archive.php | 247 +++--
    app/Actions/Album/Create.php | 42 +-
    app/Actions/Album/CreateTag.php | 33 -
    app/Actions/Album/CreateTagAlbum.php | 30 +
    app/Actions/Album/Delete.php | 62 +-
    app/Actions/Album/Extensions/LocationData.php | 45 -
    app/Actions/Album/Extensions/StoreAlbum.php | 46 -
    app/Actions/Album/Merge.php | 59 +-
    app/Actions/Album/Move.php | 60 +-
    app/Actions/Album/Photos.php | 116 ---
    app/Actions/Album/PositionData.php | 33 +-
    app/Actions/Album/Prepare.php | 47 -
    app/Actions/Album/SetCover.php | 5 +-
    app/Actions/Album/SetDescription.php | 5 +-
    app/Actions/Album/SetLicense.php | 5 +-
    app/Actions/Album/SetNSFW.php | 17 +-
    app/Actions/Album/SetPublic.php | 26 +-
    app/Actions/Album/SetShowTags.php | 18 +-
    app/Actions/Album/SetSorting.php | 16 +-
    app/Actions/Album/SetTitle.php | 5 +-
    app/Actions/Album/Setter.php | 43 +-
    app/Actions/Album/Setters.php | 34 +-
    app/Actions/Album/Unlock.php | 49 +-
    app/Actions/AlbumAuthorisationProvider.php | 615 ++++++++++++
    app/Actions/Albums/Extensions/PublicIds.php | 177 ----
    app/Actions/Albums/Extensions/PublicViewable.php | 31 -
    app/Actions/Albums/Extensions/TopQuery.php | 23 -
    app/Actions/Albums/PositionData.php | 40 +-
    app/Actions/Albums/Prepare.php | 44 -
    app/Actions/Albums/Smart.php | 90 +-
    app/Actions/Albums/Tag.php | 39 -
    app/Actions/Albums/Top.php | 78 +-
    app/Actions/Albums/Tree.php | 109 ++-
    app/Actions/Diagnostics/Checks/MissingUserCheck.php | 2 +-
    app/Actions/Diagnostics/Info.php | 2 +-
    app/Actions/Import/Exec.php | 48 +-
    app/Actions/Import/Extensions/ImportPhoto.php | 51 -
    app/Actions/Import/FromUrl.php | 14 +-
    app/Actions/Install/ApplyMigration.php | 2 +-
    app/Actions/Photo/Archive.php | 322 +++---
    app/Actions/Photo/Create.php | 281 ++++--
    app/Actions/Photo/Delete.php | 23 +-
    app/Actions/Photo/Duplicate.php | 87 +-
    app/Actions/Photo/Extensions/ArchiveFileInfo.php | 115 +++
    app/Actions/Photo/Extensions/Checks.php | 47 +-
    app/Actions/Photo/Extensions/Checksum.php | 23 -
    app/Actions/Photo/Extensions/Constants.php | 6 +-
    app/Actions/Photo/Extensions/ImageEditing.php | 182 ----
    app/Actions/Photo/Extensions/Metadata.php | 40 -
    app/Actions/Photo/Extensions/ParentAlbum.php | 33 -
    app/Actions/Photo/Extensions/Save.php | 64 --
    app/Actions/Photo/Extensions/SourceFileInfo.php | 121 +++
    app/Actions/Photo/Extensions/VideoEditing.php | 171 ----
    app/Actions/Photo/Prepare.php | 56 --
    app/Actions/Photo/Random.php | 21 +-
    app/Actions/Photo/Rotate.php | 169 +---
    app/Actions/Photo/SetAlbum.php | 36 +-
    app/Actions/Photo/SetPublic.php | 2 +-
    app/Actions/Photo/SetStar.php | 2 +-
    app/Actions/Photo/Setter.php | 5 +-
    app/Actions/Photo/Setters.php | 4 +-
    app/Actions/Photo/Strategies/AddBaseStrategy.php | 161 +++
    app/Actions/Photo/Strategies/AddDuplicateStrategy.php | 43 +
    app/Actions/Photo/Strategies/AddPhotoPartnerStrategy.php | 48 +
    app/Actions/Photo/Strategies/AddStandaloneStrategy.php | 185 ++++
    app/Actions/Photo/Strategies/AddStrategyParameters.php | 29 +
    app/Actions/Photo/Strategies/AddVideoPartnerStrategy.php | 26 +
    app/Actions/Photo/Strategies/ImportMode.php | 71 ++
    app/Actions/Photo/Strategies/RotateStrategy.php | 187 ++++
    app/Actions/Photo/Strategies/StrategyDuplicate.php | 97 --
    app/Actions/Photo/Strategies/StrategyPhoto.php | 154 ---
    app/Actions/Photo/Strategies/StrategyPhotoBase.php | 104 --
    app/Actions/Photo/SymLinker.php | 16 -
    app/Actions/Photo/Toggle.php | 2 +-
    app/Actions/Photo/Toggles.php | 20 +-
    app/Actions/PhotoAuthorisationProvider.php | 297 ++++++
    app/Actions/RSS/Generate.php | 82 +-
    app/Actions/ReadAccessFunctions.php | 116 ---
    app/Actions/Search/AlbumSearch.php | 71 +-
    app/Actions/Search/PhotoSearch.php | 74 +-
    app/Actions/Settings/Login.php | 10 +-
    app/Actions/Sharing/ListShare.php | 83 +-
    app/Actions/User/Create.php | 16 +-
    app/Actions/User/Save.php | 4 +-
    app/Assets/Helpers.php | 68 +-
    app/Assets/SizeVariantLegacyNamingStrategy.php | 106 ++
    app/Casts/DateTimeWithTimezoneCast.php | 2 +-
    app/Casts/MustNotSetCast.php | 59 ++
    app/Console/Commands/ExifLens.php | 11 +-
    app/Console/Commands/GenerateThumbs.php | 72 +-
    app/Console/Commands/Ghostbuster.php | 196 ++--
    app/Console/Commands/PhotosAddedNotification.php | 79 +-
    app/Console/Commands/ResetAdmin.php | 16 +-
    app/Console/Commands/ShowLogs.php | 16 +-
    app/Console/Commands/Takedate.php | 15 +-
    app/Console/Commands/VideoData.php | 83 +-
    app/Contracts/AbstractAlbum.php | 33 +
    app/Contracts/AddPhotoStrategyInterface.php | 21 -
    app/Contracts/AlbumInterface.php | 10 -
    app/Contracts/BidirectionalRelation.php | 8 +
    app/Contracts/HasRandomID.php | 26 +
    app/Contracts/SizeVariantFactory.php | 136 +++
    app/Contracts/SizeVariantNamingStrategy.php | 41 +
    app/Exceptions/Handler.php | 16 +-
    app/Exceptions/Handlers/AccessDBDenied.php | 10 +-
    app/Exceptions/Handlers/ApplyComposer.php | 9 +-
    app/Exceptions/Handlers/InvalidPayload.php | 8 +-
    app/Exceptions/Handlers/ModelNotFound.php | 33 -
    app/Exceptions/Handlers/NoEncryptionKey.php | 6 +-
    app/Facades/AccessControl.php | 5 +-
    app/Facades/Helpers.php | 6 +-
    app/Factories/AlbumFactory.php | 157 ++-
    app/Factories/SmartFactory.php | 56 --
    app/Http/Controllers/Administration/SettingsController.php | 13 +-
    app/Http/Controllers/Administration/SharingController.php | 11 +-
    app/Http/Controllers/Administration/UserController.php | 54 +-
    app/Http/Controllers/AlbumController.php | 265 ++---
    app/Http/Controllers/AlbumsController.php | 24 +-
    app/Http/Controllers/DemoController.php | 44 +-
    app/Http/Controllers/FrameController.php | 2 +-
    app/Http/Controllers/LegacyController.php | 40 +
    app/Http/Controllers/PhotoController.php | 178 ++--
    app/Http/Controllers/PhotoEditorController.php | 35 +-
    app/Http/Controllers/RedirectController.php | 54 +-
    app/Http/Controllers/SessionController.php | 54 +-
    app/Http/Controllers/ViewController.php | 53 +-
    app/Http/Livewire/Album.php | 54 +-
    app/Http/Livewire/Albums.php | 13 +-
    app/Http/Livewire/Fullpage.php | 21 +-
    app/Http/Livewire/PhotoOverlay.php | 2 +-
    app/Http/Livewire/Sidebar.php | 15 +-
    app/Http/Middleware/ReadCheck.php | 41 +-
    app/Http/Middleware/UploadCheck.php | 94 +-
    app/Http/Requests/AlbumRequests/AlbumIDRequest.php | 9 +-
    app/Http/Requests/AlbumRequests/AlbumIDsRequest.php | 9 +-
    .../Requests/AlbumRequests/{AlbumIDRequestInt.php => AlbumModelIDRequest.php} | 11 +-
    app/Http/Requests/ImportRequests/ImportServerRequest.php | 3 +-
    app/Http/Requests/ImportRequests/ImportUrlRequest.php | 3 +-
    app/Http/Requests/PhotoRequests/PhotoIDRequest.php | 9 +-
    app/Http/Requests/PhotoRequests/PhotoIDsRequest.php | 9 +-
    app/Http/Requests/UserRequests/UserPostRequest.php | 4 +-
    app/Image/GdHandler.php | 28 +-
    app/Image/ImageHandler.php | 12 +-
    app/Image/ImageHandlerInterface.php | 8 +-
    app/Image/ImagickHandler.php | 2 +-
    app/Image/SizeVariantDefaultFactory.php | 389 ++++++++
    app/Legacy/Legacy.php | 40 +
    app/Locale/Italian.php | 1 -
    app/Mail/PhotosAdded.php | 11 +-
    app/Metadata/Extractor.php | 73 +-
    app/Metadata/GitHubFunctions.php | 2 +-
    app/Metadata/GitRequest.php | 2 +-
    app/ModelFunctions/ConfigFunctions.php | 2 +-
    app/ModelFunctions/SessionFunctions.php | 55 +-
    app/ModelFunctions/SymLinkFunctions.php | 69 +-
    app/Models/Album.php | 383 ++++----
    app/Models/BaseAlbumImpl.php | 256 +++++
    app/Models/Configs.php | 12 +-
    app/Models/Extensions/AlbumBooleans.php | 70 --
    app/Models/Extensions/AlbumBuilder.php | 58 ++
    app/Models/Extensions/AlbumCast.php | 99 --
    app/Models/Extensions/AlbumGetters.php | 121 ---
    app/Models/Extensions/AlbumSetters.php | 11 -
    app/Models/Extensions/AlbumStringify.php | 16 -
    app/Models/Extensions/BaseAlbum.php | 126 +++
    app/Models/Extensions/ConfigsHas.php | 6 +-
    app/Models/Extensions/CustomSort.php | 28 -
    app/Models/Extensions/ForwardsToParentImplementation.php | 460 +++++++++
    app/Models/Extensions/HasAttributesPatch.php | 25 +
    app/Models/Extensions/HasBidirectionalRelationships.php | 115 +++
    app/Models/Extensions/HasRandomIDAndLegacyTimeBasedID.php | 158 +++
    app/Models/Extensions/NodeTrait.php | 65 --
    app/Models/Extensions/PhotoBooleans.php | 36 +-
    app/Models/Extensions/PhotoCast.php | 155 ---
    app/Models/Extensions/PhotoGetters.php | 78 --
    app/Models/Extensions/SizeVariants.php | 257 +++++
    app/Models/Extensions/SortingDecorator.php | 115 +++
    app/Models/Extensions/TagAlbumBuilder.php | 48 +
    app/Models/Extensions/Thumb.php | 109 ++-
    app/Models/Extensions/UTCBasedTimes.php | 8 +-
    app/Models/Logs.php | 2 +-
    app/Models/Page.php | 2 -
    app/Models/PageContent.php | 2 -
    app/Models/Photo.php | 577 ++++++-----
    app/Models/SizeVariant.php | 242 +++++
    app/Models/SymLink.php | 233 ++---
    app/Models/TagAlbum.php | 110 +++
    app/Models/User.php | 41 +-
    app/Providers/AppServiceProvider.php | 34 +-
    app/Redirections/ToInstall.php | 4 +-
    app/Relations/BidirectionalRelationTrait.php | 13 +
    app/Relations/HasAlbumThumb.php | 290 ++++++
    app/Relations/HasManyBidirectionally.php | 59 ++
    app/Relations/HasManyChildAlbums.php | 100 ++
    app/Relations/HasManyChildPhotos.php | 106 ++
    app/Relations/HasManyPhotos.php | 105 ++
    app/Relations/HasManyPhotosByTag.php | 90 ++
    app/Relations/HasManyPhotosRecursively.php | 104 ++
    app/Relations/HasManySizeVariants.php | 110 +++
    app/Relations/LinkedPhotoCollection.php | 48 +
    app/Rules/AlbumIDListRule.php | 45 +
    app/Rules/AlbumIDRule.php | 38 +
    app/Rules/ModelIDListRule.php | 42 +
    app/Rules/ModelIDRule.php | 32 +
    app/SmartAlbums/BareSmartAlbum.php | 94 --
    app/SmartAlbums/BaseSmartAlbum.php | 133 +++
    app/SmartAlbums/PublicAlbum.php | 61 +-
    app/SmartAlbums/RecentAlbum.php | 40 +-
    app/SmartAlbums/SmartAlbum.php | 69 --
    app/SmartAlbums/StarredAlbum.php | 35 +-
    app/SmartAlbums/TagAlbum.php | 23 -
    app/SmartAlbums/UnsortedAlbum.php | 57 +-
    app/SmartAlbums/Utils/MimicModel.php | 84 ++
    app/View/Components/Album/Thumbimg.php | 1 +
    app/View/Components/Photo.php | 13 +-
    composer.json | 2 +-
    composer.lock | 991 ++++++++++---------
    config/app.php | 14 +
    database/migrations/2018_08_15_102039_move_albums.php | 2 +-
    database/migrations/2018_08_15_103716_move_photos.php | 134 +--
    database/migrations/2019_12_15_0700_add_share_button_visible_option.php | 9 +-
    database/migrations/2020_12_26_153220_nested_set_for_albums.php | 26 +-
    database/migrations/2021_01_09_163715_remove_max_min_takestamps.php | 35 +-
    database/migrations/2021_06_01_181900_refactor_timestamps_anew.php | 18 +-
    database/migrations/2021_06_06_151613_fix-takedate.php | 11 +-
    database/migrations/2021_12_04_181200_refactor_models.php | 1955 +++++++++++++++++++++++++++++++++++++
    database/migrations/2022_01_13_183131_bump_version040500.php | 27 +
    phpunit.xml | 1 +
    public/.htaccess | 2 +
    public/Lychee-front | 2 +-
    public/dist/frame.js | Bin 118286 -> 118741 bytes
    public/dist/main.js | Bin 865603 -> 868242 bytes
    public/dist/view.js | Bin 218017 -> 217226 bytes
    routes/web.php | 12 +-
    tests/Feature/AlbumTest.php | 64 +-
    tests/Feature/GeoDataTest.php | 71 +-
    tests/Feature/InstallTest.php | 35 +-
    tests/Feature/Lib/AlbumsUnitTest.php | 429 ++++----
    tests/Feature/Lib/PhotosUnitTest.php | 428 ++++----
    tests/Feature/Lib/SessionUnitTest.php | 118 ++-
    tests/Feature/Lib/UsersUnitTest.php | 197 ++--
    tests/Feature/NotificationTest.php | 56 +-
    tests/Feature/PhotosRotateTest.php | 50 +-
    tests/Feature/PhotosTest.php | 152 ++-
    tests/Feature/RSSTest.php | 12 +-
    tests/Feature/RedirectTest.php | 10 +-
    tests/Feature/UsersTest.php | 111 ++-
    version.md | 2 +-
    251 files changed, 13068 insertions(+), 7073 deletions(-)
    delete mode 100644 app/Actions/Album/CreateTag.php
    create mode 100644 app/Actions/Album/CreateTagAlbum.php
    delete mode 100644 app/Actions/Album/Extensions/LocationData.php
    delete mode 100644 app/Actions/Album/Extensions/StoreAlbum.php
    delete mode 100644 app/Actions/Album/Photos.php
    delete mode 100644 app/Actions/Album/Prepare.php
    create mode 100644 app/Actions/AlbumAuthorisationProvider.php
    delete mode 100644 app/Actions/Albums/Extensions/PublicIds.php
    delete mode 100644 app/Actions/Albums/Extensions/PublicViewable.php
    delete mode 100644 app/Actions/Albums/Extensions/TopQuery.php
    delete mode 100644 app/Actions/Albums/Prepare.php
    delete mode 100644 app/Actions/Albums/Tag.php
    delete mode 100644 app/Actions/Import/Extensions/ImportPhoto.php
    create mode 100644 app/Actions/Photo/Extensions/ArchiveFileInfo.php
    delete mode 100644 app/Actions/Photo/Extensions/Checksum.php
    delete mode 100644 app/Actions/Photo/Extensions/ImageEditing.php
    delete mode 100644 app/Actions/Photo/Extensions/Metadata.php
    delete mode 100644 app/Actions/Photo/Extensions/ParentAlbum.php
    delete mode 100644 app/Actions/Photo/Extensions/Save.php
    create mode 100644 app/Actions/Photo/Extensions/SourceFileInfo.php
    delete mode 100644 app/Actions/Photo/Extensions/VideoEditing.php
    delete mode 100644 app/Actions/Photo/Prepare.php
    create mode 100644 app/Actions/Photo/Strategies/AddBaseStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/AddDuplicateStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/AddPhotoPartnerStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/AddStandaloneStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/AddStrategyParameters.php
    create mode 100644 app/Actions/Photo/Strategies/AddVideoPartnerStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/ImportMode.php
    create mode 100644 app/Actions/Photo/Strategies/RotateStrategy.php
    delete mode 100644 app/Actions/Photo/Strategies/StrategyDuplicate.php
    delete mode 100644 app/Actions/Photo/Strategies/StrategyPhoto.php
    delete mode 100644 app/Actions/Photo/Strategies/StrategyPhotoBase.php
    delete mode 100644 app/Actions/Photo/SymLinker.php
    create mode 100644 app/Actions/PhotoAuthorisationProvider.php
    delete mode 100644 app/Actions/ReadAccessFunctions.php
    create mode 100644 app/Assets/SizeVariantLegacyNamingStrategy.php
    create mode 100644 app/Casts/MustNotSetCast.php
    create mode 100644 app/Contracts/AbstractAlbum.php
    delete mode 100644 app/Contracts/AddPhotoStrategyInterface.php
    delete mode 100644 app/Contracts/AlbumInterface.php
    create mode 100644 app/Contracts/BidirectionalRelation.php
    create mode 100644 app/Contracts/HasRandomID.php
    create mode 100644 app/Contracts/SizeVariantFactory.php
    create mode 100644 app/Contracts/SizeVariantNamingStrategy.php
    delete mode 100644 app/Exceptions/Handlers/ModelNotFound.php
    delete mode 100644 app/Factories/SmartFactory.php
    create mode 100644 app/Http/Controllers/LegacyController.php
    rename app/Http/Requests/AlbumRequests/{AlbumIDRequestInt.php => AlbumModelIDRequest.php} (61%)
    create mode 100644 app/Image/SizeVariantDefaultFactory.php
    create mode 100644 app/Models/BaseAlbumImpl.php
    delete mode 100644 app/Models/Extensions/AlbumBooleans.php
    create mode 100644 app/Models/Extensions/AlbumBuilder.php
    delete mode 100644 app/Models/Extensions/AlbumCast.php
    delete mode 100644 app/Models/Extensions/AlbumGetters.php
    delete mode 100644 app/Models/Extensions/AlbumSetters.php
    delete mode 100644 app/Models/Extensions/AlbumStringify.php
    create mode 100644 app/Models/Extensions/BaseAlbum.php
    delete mode 100644 app/Models/Extensions/CustomSort.php
    create mode 100644 app/Models/Extensions/ForwardsToParentImplementation.php
    create mode 100644 app/Models/Extensions/HasAttributesPatch.php
    create mode 100644 app/Models/Extensions/HasBidirectionalRelationships.php
    create mode 100644 app/Models/Extensions/HasRandomIDAndLegacyTimeBasedID.php
    delete mode 100644 app/Models/Extensions/NodeTrait.php
    delete mode 100644 app/Models/Extensions/PhotoCast.php
    delete mode 100644 app/Models/Extensions/PhotoGetters.php
    create mode 100644 app/Models/Extensions/SizeVariants.php
    create mode 100644 app/Models/Extensions/SortingDecorator.php
    create mode 100644 app/Models/Extensions/TagAlbumBuilder.php
    create mode 100644 app/Models/SizeVariant.php
    create mode 100644 app/Models/TagAlbum.php
    create mode 100644 app/Relations/BidirectionalRelationTrait.php
    create mode 100644 app/Relations/HasAlbumThumb.php
    create mode 100644 app/Relations/HasManyBidirectionally.php
    create mode 100644 app/Relations/HasManyChildAlbums.php
    create mode 100644 app/Relations/HasManyChildPhotos.php
    create mode 100644 app/Relations/HasManyPhotos.php
    create mode 100644 app/Relations/HasManyPhotosByTag.php
    create mode 100644 app/Relations/HasManyPhotosRecursively.php
    create mode 100644 app/Relations/HasManySizeVariants.php
    create mode 100644 app/Relations/LinkedPhotoCollection.php
    create mode 100644 app/Rules/AlbumIDListRule.php
    create mode 100644 app/Rules/AlbumIDRule.php
    create mode 100644 app/Rules/ModelIDListRule.php
    create mode 100644 app/Rules/ModelIDRule.php
    delete mode 100644 app/SmartAlbums/BareSmartAlbum.php
    create mode 100644 app/SmartAlbums/BaseSmartAlbum.php
    delete mode 100644 app/SmartAlbums/SmartAlbum.php
    delete mode 100644 app/SmartAlbums/TagAlbum.php
    create mode 100644 app/SmartAlbums/Utils/MimicModel.php
    create mode 100644 database/migrations/2021_12_04_181200_refactor_models.php
    create mode 100644 database/migrations/2022_01_13_183131_bump_version040500.php
    \n\033[38;5;010mpost merge hook start\033[0m\n
    \n\033[38;5;214m--no-dev mode detected\033[0m\n
    composer install --no-dev --prefer-dist --no-suggest
    Do not run Composer as root/super user! See https://getcomposer.org/root for details
    You are using Composer 1 which is deprecated. You should upgrade to Composer 2, see https://blog.packagist.com/deprecating-composer-1-support/
    Loading composer repositories with package information
    Installing dependencies from lock file
    Package operations: 1 install, 41 updates, 1 removal
  • Removing kalnoy/nestedset (v6.0.0)
  • Updating doctrine/dbal (3.2.0 => 3.2.1): Downloading (100%)
  • Updating symfony/polyfill-ctype (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating dragonmantank/cron-expression (v3.1.0 => v3.2.3): Downloading (100%)
  • Updating symfony/deprecation-contracts (v2.5.0 => v3.0.0): Downloading (100%)
  • Updating guzzlehttp/guzzle (7.4.0 => 7.4.1): Downloading (100%)
  • Updating symfony/polyfill-php80 (v1.23.1 => v1.24.0): Downloading (100%)
  • Updating symfony/polyfill-php73 (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating symfony/polyfill-mbstring (v1.23.1 => v1.24.0): Downloading (100%)
  • Updating symfony/http-foundation (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/event-dispatcher (v5.4.0 => v6.0.2): Downloading (100%)
  • Updating symfony/var-dumper (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/error-handler (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/http-kernel (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating vlucas/phpdotenv (v5.4.0 => v5.4.1): Downloading (100%)
  • Updating symfony/css-selector (v6.0.0 => v6.0.2): Downloading (100%)
  • Updating symfony/process (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/polyfill-php72 (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating symfony/polyfill-intl-normalizer (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating symfony/polyfill-intl-idn (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating symfony/mime (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/finder (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/polyfill-intl-grapheme (v1.23.1 => v1.24.0): Downloading (100%)
  • Updating symfony/string (v6.0.0 => v6.0.2): Downloading (100%)
  • Downgrading symfony/service-contracts (v2.5.0 => v2.4.1): Downloading (100%)
  • Updating symfony/console (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/polyfill-iconv (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating symfony/polyfill-php81 (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating symfony/translation (v6.0.0 => v6.0.2): Downloading (100%)
  • Updating laravel/framework (v8.75.0 => v8.78.1): Downloading (100%)
  • Updating livewire/livewire (v2.8.1 => v2.8.2): Downloading (100%)
  • Updating symfony/filesystem (v5.4.0 => v6.0.0): Downloading (100%)
  • Updating neutron/temporary-filesystem (3.0 => 3.0.1): Downloading (100%)
  • Updating spatie/image-optimizer (1.6.1 => 1.6.2): Downloading (100%)
  • Updating spatie/laravel-package-tools (1.9.2 => 1.10.0): Downloading (100%)
  • Updating symfony/cache (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating beberlei/assert (v3.3.1 => v3.3.2): Downloading (100%)
  • Updating web-auth/metadata-service (v3.3.10 => v3.3.11): Downloading (100%)
  • Updating fgrosse/phpasn1 (v2.3.0 => v2.4.0): Downloading (100%)
  • Updating web-auth/cose-lib (v3.3.10 => v3.3.11): Downloading (100%)
  • Updating spomky-labs/cbor-php (v2.0.1 => v2.1.0): Downloading (100%)
  • Updating web-auth/webauthn-lib (v3.3.10 => v3.3.11): Downloading (100%)
  • Installing lychee-org/nestedset (v5.0.9): Downloading (100%)
    Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
    Generating optimized autoload files
    composer/package-versions-deprecated: Generating version class...
    composer/package-versions-deprecated: ...done generating version class

Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover

Discovered Package: bepsvpt/secure-headers
Discovered Package: darkghosthunter/larapass
Discovered Package: fideloper/proxy
Discovered Package: graham-campbell/markdown
Discovered Package: livewire/livewire
Discovered Package: lychee-org/nestedset
Discovered Package: nesbot/carbon
Discovered Package: spatie/laravel-feed
Discovered Package: spatie/laravel-image-optimizer
Package manifest generated successfully.

sh scripts/install_files.sh
\n\033[38;5;011mcreating file for css personalization\033[0m
touch public/dist/user.css
\n\033[38;5;011mcreating default sqlite database\033[0m
touch database/database.sqlite
\n\033[38;5;011msetting up hooks for git pull and git commits\033[0m
cp scripts/pre-commit .git/hooks/
cp scripts/post-merge .git/hooks/
\n\033[38;5;214mTo disable the call of composer and migration on pull add\033[0m
\033[38;5;214ma file named '.NO_AUTO_COMPOSER_MIGRATE' in this directory.\033[0m\n
74 packages you are using are looking for funding.
Use the composer fund command to find out more!
php artisan migrate --force

Migrating: 2021_12_04_181200_refactor_models
Info: Renaming existing tables
Info: Creating new tables
Info: Start copying ...
Table 'users' 2/2 [============================] 100%
Error: Model ID 2 - OutOfBoundsException - ID-based creation time is out of reasonable bounds
Error: Model ID 3 - OutOfBoundsException - ID-based creation time is out of reasonable bounds
Error: Model ID 9 - OutOfBoundsException - ID-based creation time is out of reasonable bounds
Error: Model ID 11 - OutOfBoundsException - ID-based creation time is out of reasonable bounds
Error: Model ID 17 - OutOfBoundsException - ID-based creation time is out of reasonable bounds
Table 'albums' 145/145 [============================] 100%
Table 'user_base_album' 1/137 [>---------------------------] 0%

In 2021_12_04_181200_refactor_models.php line 1116:

Undefined array key 15023691398618

\n\033[38;5;010mpost merge hook finish\033[0m\n

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

after previous action :

image

resulting in:

image

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

In 2021_12_04_181200_refactor_models.php line 1116:

Undefined array key 15023691398618

That is bad. That part there, that's why it is crashing.

@nagmat84
Copy link
Collaborator

I might have an idea, why it fails, but it is a guess. Please follow the following steps again (sorry for your taking your time).

  1. Check out the last Lychee commit that did work for you and is the same as you made the DB backup with. (See @kami4 previous post
  2. Ensure that the GIT working copy is clean
  3. Restore your DB backup and ensure that it is working
  4. Pull the the update from master, i.e. git pull. (Don't run the migration yet).
  5. Re-cash you configuration via ./artisan optimize:clear && ./artisan config:cache && ./artisan optimize. This is extremely important.
    Background: We had some configuration changes in #1172 which ensure that the MySQL DB connection behaves deterministic regarding numeric IDs. Otherwise funny things might happen with a) a 32bit installation of MySQL on a 64bit platform and b) with 0 as an integer ID which is used by our admin user and which MySQL does not like by default. For efficiency reasons, Laravel compiles a shadow copy of all configuration options merged together. So after any upgrade which might change a configuration you must run ./artisan optimize:clear && ./artisan config:cache && ./artisan optimize otherwise you use an old configuration.
  6. Install the correct dependencies via composer install --no-dev.
    Background: We had to switch to our own fork of Nested Sets from lazychaser/laravel-nestedset to LycheeOrg/laravel-nestedset, because the original has some bugs regarding zero/null IDs.
  7. Now, run artisan migrate

If it still fails, then please provide me with a copy of your database. I am happy to help out. But I assume, that the problem stems from a missing step 5 or 6. An ID-related problem smells like that.

@ildyria Does the web installer ensures step 5 and 6? I am not sure about that.

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

@ildyria Does the web installer ensures step 5 and 6? I am not sure about that.

  1. No.
  2. unsure.

@kamil4
Copy link
Contributor

kamil4 commented Jan 14, 2022

  1. Isn't this only important if somebody ran the artisan optimize in the first place? Do we recommend anywhere in the docs that people do?

  2. We run it in the post-merge hook:

        composer install --no-dev --prefer-dist --no-suggest

@kamil4
Copy link
Contributor

kamil4 commented Jan 14, 2022

@oblomow Can you check if you have an album with id 15023691398618 in your database at all (in the albums table)? Based on some of the preceding messages it looks like you've modified things manually in the past so it could be that your database is simply inconsistent. If that's the case, you may need to remove the offending entry from user_album table prior to update (it will be the one with album_id = 15023691398618).

@nagmat84
Copy link
Collaborator

nagmat84 commented Jan 14, 2022

Isn't this only important if somebody ran the artisan optimize in the first place? Do we recommend anywhere in the docs that people do?

No, it isn't. artisan optimize only primes the cache. If you don't do it manually, Laravel will do it per request on a as-needed basis. artisan optimize only helps to mitigate some delay during the first couple of request until the cache is built. But then the cache is there. After an upgrade you need to clear it.

The important part is actually ./artisan optimize:clear && ./artisan config:clear. The third part is optional.

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

@kamil4 select * from albums where id=15023691398618 \G
Empty set (0.00 sec)

@kamil4
Copy link
Contributor

kamil4 commented Jan 14, 2022

@oblomow As I suspected. So now do this (on a DB instance before updating to the latest version):

delete from user_album where album_id = 15023691398618;

Hopefully that's the only such offender, but if not, you may need to do it repeatedly for the album IDs that fail...

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

sudo -u www git pull
remote: Enumerating objects: 5297, done.
remote: Counting objects: 100% (5296/5296), done.
remote: Compressing objects: 100% (1249/1249), done.
remote: Total 5297 (delta 4050), reused 5162 (delta 3980), pack-reused 1
Receiving objects: 100% (5297/5297), 1.47 MiB | 12.65 MiB/s, done.
Resolving deltas: 100% (4050/4050), completed with 151 local objects.
From https://github.com/LycheeOrg/Lychee
376f8c7..32c374d master -> origin/master

  • [new branch] consistent_json_api -> origin/consistent_json_api
  • [new branch] enable-phpstan -> origin/enable-phpstan
  • [new branch] livewire/more-work -> origin/livewire/more-work
  • [new branch] wip-symlink-except -> origin/wip-symlink-except
  • [new tag] v4.3.0 -> v4.3.0
  • [new tag] v4.3.4 -> v4.3.4
  • [new tag] v4.3.5 -> v4.3.5
  • [new tag] v4.3.6 -> v4.3.6
  • [new tag] v4.4.0 -> v4.4.0
    Updating a7de020..32c374d
    Fast-forward
    .github/workflows/Build.yml | 4 +-
    .phpstorm.meta.php | 66 +-
    app/Actions/Album/Action.php | 5 +-
    app/Actions/Album/Archive.php | 247 +++--
    app/Actions/Album/Create.php | 42 +-
    app/Actions/Album/CreateTag.php | 33 -
    app/Actions/Album/CreateTagAlbum.php | 30 +
    app/Actions/Album/Delete.php | 62 +-
    app/Actions/Album/Extensions/LocationData.php | 45 -
    app/Actions/Album/Extensions/StoreAlbum.php | 46 -
    app/Actions/Album/Merge.php | 59 +-
    app/Actions/Album/Move.php | 60 +-
    app/Actions/Album/Photos.php | 116 ---
    app/Actions/Album/PositionData.php | 33 +-
    app/Actions/Album/Prepare.php | 47 -
    app/Actions/Album/SetCover.php | 5 +-
    app/Actions/Album/SetDescription.php | 5 +-
    app/Actions/Album/SetLicense.php | 5 +-
    app/Actions/Album/SetNSFW.php | 17 +-
    app/Actions/Album/SetPublic.php | 26 +-
    app/Actions/Album/SetShowTags.php | 18 +-
    app/Actions/Album/SetSorting.php | 16 +-
    app/Actions/Album/SetTitle.php | 5 +-
    app/Actions/Album/Setter.php | 43 +-
    app/Actions/Album/Setters.php | 34 +-
    app/Actions/Album/Unlock.php | 49 +-
    app/Actions/AlbumAuthorisationProvider.php | 615 ++++++++++++
    app/Actions/Albums/Extensions/PublicIds.php | 177 ----
    app/Actions/Albums/Extensions/PublicViewable.php | 31 -
    app/Actions/Albums/Extensions/TopQuery.php | 23 -
    app/Actions/Albums/PositionData.php | 40 +-
    app/Actions/Albums/Prepare.php | 44 -
    app/Actions/Albums/Smart.php | 90 +-
    app/Actions/Albums/Tag.php | 39 -
    app/Actions/Albums/Top.php | 78 +-
    app/Actions/Albums/Tree.php | 109 ++-
    app/Actions/Diagnostics/Checks/MissingUserCheck.php | 2 +-
    app/Actions/Diagnostics/Info.php | 2 +-
    app/Actions/Import/Exec.php | 48 +-
    app/Actions/Import/Extensions/ImportPhoto.php | 51 -
    app/Actions/Import/FromUrl.php | 14 +-
    app/Actions/Install/ApplyMigration.php | 2 +-
    app/Actions/Photo/Archive.php | 322 +++---
    app/Actions/Photo/Create.php | 281 ++++--
    app/Actions/Photo/Delete.php | 23 +-
    app/Actions/Photo/Duplicate.php | 87 +-
    app/Actions/Photo/Extensions/ArchiveFileInfo.php | 115 +++
    app/Actions/Photo/Extensions/Checks.php | 47 +-
    app/Actions/Photo/Extensions/Checksum.php | 23 -
    app/Actions/Photo/Extensions/Constants.php | 6 +-
    app/Actions/Photo/Extensions/ImageEditing.php | 182 ----
    app/Actions/Photo/Extensions/Metadata.php | 40 -
    app/Actions/Photo/Extensions/ParentAlbum.php | 33 -
    app/Actions/Photo/Extensions/Save.php | 64 --
    app/Actions/Photo/Extensions/SourceFileInfo.php | 121 +++
    app/Actions/Photo/Extensions/VideoEditing.php | 171 ----
    app/Actions/Photo/Prepare.php | 56 --
    app/Actions/Photo/Random.php | 21 +-
    app/Actions/Photo/Rotate.php | 169 +---
    app/Actions/Photo/SetAlbum.php | 36 +-
    app/Actions/Photo/SetPublic.php | 2 +-
    app/Actions/Photo/SetStar.php | 2 +-
    app/Actions/Photo/Setter.php | 5 +-
    app/Actions/Photo/Setters.php | 4 +-
    app/Actions/Photo/Strategies/AddBaseStrategy.php | 161 +++
    app/Actions/Photo/Strategies/AddDuplicateStrategy.php | 43 +
    app/Actions/Photo/Strategies/AddPhotoPartnerStrategy.php | 48 +
    app/Actions/Photo/Strategies/AddStandaloneStrategy.php | 185 ++++
    app/Actions/Photo/Strategies/AddStrategyParameters.php | 29 +
    app/Actions/Photo/Strategies/AddVideoPartnerStrategy.php | 26 +
    app/Actions/Photo/Strategies/ImportMode.php | 71 ++
    app/Actions/Photo/Strategies/RotateStrategy.php | 187 ++++
    app/Actions/Photo/Strategies/StrategyDuplicate.php | 97 --
    app/Actions/Photo/Strategies/StrategyPhoto.php | 154 ---
    app/Actions/Photo/Strategies/StrategyPhotoBase.php | 104 --
    app/Actions/Photo/SymLinker.php | 16 -
    app/Actions/Photo/Toggle.php | 2 +-
    app/Actions/Photo/Toggles.php | 20 +-
    app/Actions/PhotoAuthorisationProvider.php | 297 ++++++
    app/Actions/RSS/Generate.php | 82 +-
    app/Actions/ReadAccessFunctions.php | 116 ---
    app/Actions/Search/AlbumSearch.php | 71 +-
    app/Actions/Search/PhotoSearch.php | 74 +-
    app/Actions/Settings/Login.php | 10 +-
    app/Actions/Sharing/ListShare.php | 83 +-
    app/Actions/User/Create.php | 16 +-
    app/Actions/User/Save.php | 4 +-
    app/Assets/Helpers.php | 68 +-
    app/Assets/SizeVariantLegacyNamingStrategy.php | 106 ++
    app/Casts/DateTimeWithTimezoneCast.php | 2 +-
    app/Casts/MustNotSetCast.php | 59 ++
    app/Console/Commands/ExifLens.php | 11 +-
    app/Console/Commands/GenerateThumbs.php | 72 +-
    app/Console/Commands/Ghostbuster.php | 196 ++--
    app/Console/Commands/PhotosAddedNotification.php | 79 +-
    app/Console/Commands/ResetAdmin.php | 16 +-
    app/Console/Commands/ShowLogs.php | 16 +-
    app/Console/Commands/Takedate.php | 15 +-
    app/Console/Commands/VideoData.php | 83 +-
    app/Contracts/AbstractAlbum.php | 33 +
    app/Contracts/AddPhotoStrategyInterface.php | 21 -
    app/Contracts/AlbumInterface.php | 10 -
    app/Contracts/BidirectionalRelation.php | 8 +
    app/Contracts/HasRandomID.php | 26 +
    app/Contracts/SizeVariantFactory.php | 136 +++
    app/Contracts/SizeVariantNamingStrategy.php | 41 +
    app/Exceptions/Handler.php | 16 +-
    app/Exceptions/Handlers/AccessDBDenied.php | 10 +-
    app/Exceptions/Handlers/ApplyComposer.php | 9 +-
    app/Exceptions/Handlers/InvalidPayload.php | 8 +-
    app/Exceptions/Handlers/ModelNotFound.php | 33 -
    app/Exceptions/Handlers/NoEncryptionKey.php | 6 +-
    app/Facades/AccessControl.php | 5 +-
    app/Facades/Helpers.php | 6 +-
    app/Factories/AlbumFactory.php | 157 ++-
    app/Factories/SmartFactory.php | 56 --
    app/Http/Controllers/Administration/SettingsController.php | 13 +-
    app/Http/Controllers/Administration/SharingController.php | 11 +-
    app/Http/Controllers/Administration/UserController.php | 54 +-
    app/Http/Controllers/AlbumController.php | 265 ++---
    app/Http/Controllers/AlbumsController.php | 24 +-
    app/Http/Controllers/DemoController.php | 44 +-
    app/Http/Controllers/FrameController.php | 2 +-
    app/Http/Controllers/LegacyController.php | 40 +
    app/Http/Controllers/PhotoController.php | 178 ++--
    app/Http/Controllers/PhotoEditorController.php | 35 +-
    app/Http/Controllers/RedirectController.php | 54 +-
    app/Http/Controllers/SessionController.php | 54 +-
    app/Http/Controllers/ViewController.php | 53 +-
    app/Http/Livewire/Album.php | 54 +-
    app/Http/Livewire/Albums.php | 13 +-
    app/Http/Livewire/Fullpage.php | 21 +-
    app/Http/Livewire/PhotoOverlay.php | 2 +-
    app/Http/Livewire/Sidebar.php | 15 +-
    app/Http/Middleware/ReadCheck.php | 41 +-
    app/Http/Middleware/UploadCheck.php | 94 +-
    app/Http/Requests/AlbumRequests/AlbumIDRequest.php | 9 +-
    app/Http/Requests/AlbumRequests/AlbumIDsRequest.php | 9 +-
    .../Requests/AlbumRequests/{AlbumIDRequestInt.php => AlbumModelIDRequest.php} | 11 +-
    app/Http/Requests/ImportRequests/ImportServerRequest.php | 3 +-
    app/Http/Requests/ImportRequests/ImportUrlRequest.php | 3 +-
    app/Http/Requests/PhotoRequests/PhotoIDRequest.php | 9 +-
    app/Http/Requests/PhotoRequests/PhotoIDsRequest.php | 9 +-
    app/Http/Requests/UserRequests/UserPostRequest.php | 4 +-
    app/Image/GdHandler.php | 28 +-
    app/Image/ImageHandler.php | 12 +-
    app/Image/ImageHandlerInterface.php | 8 +-
    app/Image/ImagickHandler.php | 2 +-
    app/Image/SizeVariantDefaultFactory.php | 389 ++++++++
    app/Legacy/Legacy.php | 40 +
    app/Locale/Italian.php | 1 -
    app/Mail/PhotosAdded.php | 11 +-
    app/Metadata/Extractor.php | 73 +-
    app/Metadata/GitHubFunctions.php | 2 +-
    app/Metadata/GitRequest.php | 2 +-
    app/ModelFunctions/ConfigFunctions.php | 2 +-
    app/ModelFunctions/SessionFunctions.php | 55 +-
    app/ModelFunctions/SymLinkFunctions.php | 69 +-
    app/Models/Album.php | 383 ++++----
    app/Models/BaseAlbumImpl.php | 256 +++++
    app/Models/Configs.php | 12 +-
    app/Models/Extensions/AlbumBooleans.php | 70 --
    app/Models/Extensions/AlbumBuilder.php | 58 ++
    app/Models/Extensions/AlbumCast.php | 99 --
    app/Models/Extensions/AlbumGetters.php | 121 ---
    app/Models/Extensions/AlbumSetters.php | 11 -
    app/Models/Extensions/AlbumStringify.php | 16 -
    app/Models/Extensions/BaseAlbum.php | 126 +++
    app/Models/Extensions/ConfigsHas.php | 6 +-
    app/Models/Extensions/CustomSort.php | 28 -
    app/Models/Extensions/ForwardsToParentImplementation.php | 460 +++++++++
    app/Models/Extensions/HasAttributesPatch.php | 25 +
    app/Models/Extensions/HasBidirectionalRelationships.php | 115 +++
    app/Models/Extensions/HasRandomIDAndLegacyTimeBasedID.php | 158 +++
    app/Models/Extensions/NodeTrait.php | 65 --
    app/Models/Extensions/PhotoBooleans.php | 36 +-
    app/Models/Extensions/PhotoCast.php | 155 ---
    app/Models/Extensions/PhotoGetters.php | 78 --
    app/Models/Extensions/SizeVariants.php | 257 +++++
    app/Models/Extensions/SortingDecorator.php | 115 +++
    app/Models/Extensions/TagAlbumBuilder.php | 48 +
    app/Models/Extensions/Thumb.php | 109 ++-
    app/Models/Extensions/UTCBasedTimes.php | 8 +-
    app/Models/Logs.php | 2 +-
    app/Models/Page.php | 2 -
    app/Models/PageContent.php | 2 -
    app/Models/Photo.php | 577 ++++++-----
    app/Models/SizeVariant.php | 242 +++++
    app/Models/SymLink.php | 233 ++---
    app/Models/TagAlbum.php | 110 +++
    app/Models/User.php | 41 +-
    app/Providers/AppServiceProvider.php | 34 +-
    app/Redirections/ToInstall.php | 4 +-
    app/Relations/BidirectionalRelationTrait.php | 13 +
    app/Relations/HasAlbumThumb.php | 290 ++++++
    app/Relations/HasManyBidirectionally.php | 59 ++
    app/Relations/HasManyChildAlbums.php | 100 ++
    app/Relations/HasManyChildPhotos.php | 106 ++
    app/Relations/HasManyPhotos.php | 105 ++
    app/Relations/HasManyPhotosByTag.php | 90 ++
    app/Relations/HasManyPhotosRecursively.php | 104 ++
    app/Relations/HasManySizeVariants.php | 110 +++
    app/Relations/LinkedPhotoCollection.php | 48 +
    app/Rules/AlbumIDListRule.php | 45 +
    app/Rules/AlbumIDRule.php | 38 +
    app/Rules/ModelIDListRule.php | 42 +
    app/Rules/ModelIDRule.php | 32 +
    app/SmartAlbums/BareSmartAlbum.php | 94 --
    app/SmartAlbums/BaseSmartAlbum.php | 133 +++
    app/SmartAlbums/PublicAlbum.php | 61 +-
    app/SmartAlbums/RecentAlbum.php | 40 +-
    app/SmartAlbums/SmartAlbum.php | 69 --
    app/SmartAlbums/StarredAlbum.php | 35 +-
    app/SmartAlbums/TagAlbum.php | 23 -
    app/SmartAlbums/UnsortedAlbum.php | 57 +-
    app/SmartAlbums/Utils/MimicModel.php | 84 ++
    app/View/Components/Album/Thumbimg.php | 1 +
    app/View/Components/Photo.php | 13 +-
    composer.json | 2 +-
    composer.lock | 991 ++++++++++---------
    config/app.php | 14 +
    database/migrations/2018_08_15_102039_move_albums.php | 2 +-
    database/migrations/2018_08_15_103716_move_photos.php | 134 +--
    database/migrations/2019_12_15_0700_add_share_button_visible_option.php | 9 +-
    database/migrations/2020_12_26_153220_nested_set_for_albums.php | 26 +-
    database/migrations/2021_01_09_163715_remove_max_min_takestamps.php | 35 +-
    database/migrations/2021_06_01_181900_refactor_timestamps_anew.php | 18 +-
    database/migrations/2021_06_06_151613_fix-takedate.php | 11 +-
    database/migrations/2021_12_04_181200_refactor_models.php | 1955 +++++++++++++++++++++++++++++++++++++
    database/migrations/2022_01_13_183131_bump_version040500.php | 27 +
    phpunit.xml | 1 +
    public/.htaccess | 2 +
    public/Lychee-front | 2 +-
    public/dist/frame.js | Bin 118286 -> 118741 bytes
    public/dist/main.js | Bin 865603 -> 868242 bytes
    public/dist/view.js | Bin 218017 -> 217226 bytes
    routes/web.php | 12 +-
    tests/Feature/AlbumTest.php | 64 +-
    tests/Feature/GeoDataTest.php | 71 +-
    tests/Feature/InstallTest.php | 35 +-
    tests/Feature/Lib/AlbumsUnitTest.php | 429 ++++----
    tests/Feature/Lib/PhotosUnitTest.php | 428 ++++----
    tests/Feature/Lib/SessionUnitTest.php | 118 ++-
    tests/Feature/Lib/UsersUnitTest.php | 197 ++--
    tests/Feature/NotificationTest.php | 56 +-
    tests/Feature/PhotosRotateTest.php | 50 +-
    tests/Feature/PhotosTest.php | 152 ++-
    tests/Feature/RSSTest.php | 12 +-
    tests/Feature/RedirectTest.php | 10 +-
    tests/Feature/UsersTest.php | 111 ++-
    version.md | 2 +-
    251 files changed, 13068 insertions(+), 7073 deletions(-)
    delete mode 100644 app/Actions/Album/CreateTag.php
    create mode 100644 app/Actions/Album/CreateTagAlbum.php
    delete mode 100644 app/Actions/Album/Extensions/LocationData.php
    delete mode 100644 app/Actions/Album/Extensions/StoreAlbum.php
    delete mode 100644 app/Actions/Album/Photos.php
    delete mode 100644 app/Actions/Album/Prepare.php
    create mode 100644 app/Actions/AlbumAuthorisationProvider.php
    delete mode 100644 app/Actions/Albums/Extensions/PublicIds.php
    delete mode 100644 app/Actions/Albums/Extensions/PublicViewable.php
    delete mode 100644 app/Actions/Albums/Extensions/TopQuery.php
    delete mode 100644 app/Actions/Albums/Prepare.php
    delete mode 100644 app/Actions/Albums/Tag.php
    delete mode 100644 app/Actions/Import/Extensions/ImportPhoto.php
    create mode 100644 app/Actions/Photo/Extensions/ArchiveFileInfo.php
    delete mode 100644 app/Actions/Photo/Extensions/Checksum.php
    delete mode 100644 app/Actions/Photo/Extensions/ImageEditing.php
    delete mode 100644 app/Actions/Photo/Extensions/Metadata.php
    delete mode 100644 app/Actions/Photo/Extensions/ParentAlbum.php
    delete mode 100644 app/Actions/Photo/Extensions/Save.php
    create mode 100644 app/Actions/Photo/Extensions/SourceFileInfo.php
    delete mode 100644 app/Actions/Photo/Extensions/VideoEditing.php
    delete mode 100644 app/Actions/Photo/Prepare.php
    create mode 100644 app/Actions/Photo/Strategies/AddBaseStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/AddDuplicateStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/AddPhotoPartnerStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/AddStandaloneStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/AddStrategyParameters.php
    create mode 100644 app/Actions/Photo/Strategies/AddVideoPartnerStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/ImportMode.php
    create mode 100644 app/Actions/Photo/Strategies/RotateStrategy.php
    delete mode 100644 app/Actions/Photo/Strategies/StrategyDuplicate.php
    delete mode 100644 app/Actions/Photo/Strategies/StrategyPhoto.php
    delete mode 100644 app/Actions/Photo/Strategies/StrategyPhotoBase.php
    delete mode 100644 app/Actions/Photo/SymLinker.php
    create mode 100644 app/Actions/PhotoAuthorisationProvider.php
    delete mode 100644 app/Actions/ReadAccessFunctions.php
    create mode 100644 app/Assets/SizeVariantLegacyNamingStrategy.php
    create mode 100644 app/Casts/MustNotSetCast.php
    create mode 100644 app/Contracts/AbstractAlbum.php
    delete mode 100644 app/Contracts/AddPhotoStrategyInterface.php
    delete mode 100644 app/Contracts/AlbumInterface.php
    create mode 100644 app/Contracts/BidirectionalRelation.php
    create mode 100644 app/Contracts/HasRandomID.php
    create mode 100644 app/Contracts/SizeVariantFactory.php
    create mode 100644 app/Contracts/SizeVariantNamingStrategy.php
    delete mode 100644 app/Exceptions/Handlers/ModelNotFound.php
    delete mode 100644 app/Factories/SmartFactory.php
    create mode 100644 app/Http/Controllers/LegacyController.php
    rename app/Http/Requests/AlbumRequests/{AlbumIDRequestInt.php => AlbumModelIDRequest.php} (61%)
    create mode 100644 app/Image/SizeVariantDefaultFactory.php
    create mode 100644 app/Models/BaseAlbumImpl.php
    delete mode 100644 app/Models/Extensions/AlbumBooleans.php
    create mode 100644 app/Models/Extensions/AlbumBuilder.php
    delete mode 100644 app/Models/Extensions/AlbumCast.php
    delete mode 100644 app/Models/Extensions/AlbumGetters.php
    delete mode 100644 app/Models/Extensions/AlbumSetters.php
    delete mode 100644 app/Models/Extensions/AlbumStringify.php
    create mode 100644 app/Models/Extensions/BaseAlbum.php
    delete mode 100644 app/Models/Extensions/CustomSort.php
    create mode 100644 app/Models/Extensions/ForwardsToParentImplementation.php
    create mode 100644 app/Models/Extensions/HasAttributesPatch.php
    create mode 100644 app/Models/Extensions/HasBidirectionalRelationships.php
    create mode 100644 app/Models/Extensions/HasRandomIDAndLegacyTimeBasedID.php
    delete mode 100644 app/Models/Extensions/NodeTrait.php
    delete mode 100644 app/Models/Extensions/PhotoCast.php
    delete mode 100644 app/Models/Extensions/PhotoGetters.php
    create mode 100644 app/Models/Extensions/SizeVariants.php
    create mode 100644 app/Models/Extensions/SortingDecorator.php
    create mode 100644 app/Models/Extensions/TagAlbumBuilder.php
    create mode 100644 app/Models/SizeVariant.php
    create mode 100644 app/Models/TagAlbum.php
    create mode 100644 app/Relations/BidirectionalRelationTrait.php
    create mode 100644 app/Relations/HasAlbumThumb.php
    create mode 100644 app/Relations/HasManyBidirectionally.php
    create mode 100644 app/Relations/HasManyChildAlbums.php
    create mode 100644 app/Relations/HasManyChildPhotos.php
    create mode 100644 app/Relations/HasManyPhotos.php
    create mode 100644 app/Relations/HasManyPhotosByTag.php
    create mode 100644 app/Relations/HasManyPhotosRecursively.php
    create mode 100644 app/Relations/HasManySizeVariants.php
    create mode 100644 app/Relations/LinkedPhotoCollection.php
    create mode 100644 app/Rules/AlbumIDListRule.php
    create mode 100644 app/Rules/AlbumIDRule.php
    create mode 100644 app/Rules/ModelIDListRule.php
    create mode 100644 app/Rules/ModelIDRule.php
    delete mode 100644 app/SmartAlbums/BareSmartAlbum.php
    create mode 100644 app/SmartAlbums/BaseSmartAlbum.php
    delete mode 100644 app/SmartAlbums/SmartAlbum.php
    delete mode 100644 app/SmartAlbums/TagAlbum.php
    create mode 100644 app/SmartAlbums/Utils/MimicModel.php
    create mode 100644 database/migrations/2021_12_04_181200_refactor_models.php
    create mode 100644 database/migrations/2022_01_13_183131_bump_version040500.php
    \n\033[38;5;010mpost merge hook start\033[0m\n
    \n\033[38;5;214m--no-dev mode detected\033[0m\n
    composer install --no-dev --prefer-dist --no-suggest
    Cannot create cache directory /nonexistent/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
    Cannot create cache directory /nonexistent/.composer/cache/files/, or directory is not writable. Proceeding without cache
    You are using Composer 1 which is deprecated. You should upgrade to Composer 2, see https://blog.packagist.com/deprecating-composer-1-support/
    Loading composer repositories with package information
    Installing dependencies from lock file
    Package operations: 1 install, 41 updates, 1 removal
  • Removing kalnoy/nestedset (v6.0.0)
  • Updating doctrine/dbal (3.2.0 => 3.2.1): Downloading (100%)
  • Updating symfony/polyfill-ctype (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating dragonmantank/cron-expression (v3.1.0 => v3.2.3): Downloading (100%)
  • Updating symfony/deprecation-contracts (v2.5.0 => v3.0.0): Downloading (100%)
  • Updating guzzlehttp/guzzle (7.4.0 => 7.4.1): Downloading (100%)
  • Updating symfony/polyfill-php80 (v1.23.1 => v1.24.0): Downloading (100%)
  • Updating symfony/polyfill-php73 (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating symfony/polyfill-mbstring (v1.23.1 => v1.24.0): Downloading (100%)
  • Updating symfony/http-foundation (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/event-dispatcher (v5.4.0 => v6.0.2): Downloading (100%)
  • Updating symfony/var-dumper (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/error-handler (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/http-kernel (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating vlucas/phpdotenv (v5.4.0 => v5.4.1): Downloading (100%)
  • Updating symfony/css-selector (v6.0.0 => v6.0.2): Downloading (100%)
  • Updating symfony/process (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/polyfill-php72 (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating symfony/polyfill-intl-normalizer (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating symfony/polyfill-intl-idn (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating symfony/mime (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/finder (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/polyfill-intl-grapheme (v1.23.1 => v1.24.0): Downloading (100%)
  • Updating symfony/string (v6.0.0 => v6.0.2): Downloading (100%)
  • Downgrading symfony/service-contracts (v2.5.0 => v2.4.1): Downloading (100%)
  • Updating symfony/console (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating symfony/polyfill-iconv (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating symfony/polyfill-php81 (v1.23.0 => v1.24.0): Downloading (100%)
  • Updating symfony/translation (v6.0.0 => v6.0.2): Downloading (100%)
  • Updating laravel/framework (v8.75.0 => v8.78.1): Downloading (100%)
  • Updating livewire/livewire (v2.8.1 => v2.8.2): Downloading (100%)
  • Updating symfony/filesystem (v5.4.0 => v6.0.0): Downloading (100%)
  • Updating neutron/temporary-filesystem (3.0 => 3.0.1): Downloading (100%)
  • Updating spatie/image-optimizer (1.6.1 => 1.6.2): Downloading (100%)
  • Updating spatie/laravel-package-tools (1.9.2 => 1.10.0): Downloading (100%)
  • Updating symfony/cache (v5.4.0 => v5.4.2): Downloading (100%)
  • Updating beberlei/assert (v3.3.1 => v3.3.2): Downloading (100%)
  • Updating web-auth/metadata-service (v3.3.10 => v3.3.11): Downloading (100%)
  • Updating fgrosse/phpasn1 (v2.3.0 => v2.4.0): Downloading (100%)
  • Updating web-auth/cose-lib (v3.3.10 => v3.3.11): Downloading (100%)
  • Updating spomky-labs/cbor-php (v2.0.1 => v2.1.0): Downloading (100%)
  • Updating web-auth/webauthn-lib (v3.3.10 => v3.3.11): Downloading (100%)
  • Installing lychee-org/nestedset (v5.0.9): Downloading (100%)
    Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
    Generating optimized autoload files
    composer/package-versions-deprecated: Generating version class...
    composer/package-versions-deprecated: ...done generating version class

Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover

Discovered Package: bepsvpt/secure-headers
Discovered Package: darkghosthunter/larapass
Discovered Package: fideloper/proxy
Discovered Package: graham-campbell/markdown
Discovered Package: livewire/livewire
Discovered Package: lychee-org/nestedset
Discovered Package: nesbot/carbon
Discovered Package: spatie/laravel-feed
Discovered Package: spatie/laravel-image-optimizer
Package manifest generated successfully.

sh scripts/install_files.sh
\n\033[38;5;011mcreating file for css personalization\033[0m
touch public/dist/user.css
\n\033[38;5;011mcreating default sqlite database\033[0m
touch database/database.sqlite
\n\033[38;5;011msetting up hooks for git pull and git commits\033[0m
cp scripts/pre-commit .git/hooks/
cp scripts/post-merge .git/hooks/
\n\033[38;5;214mTo disable the call of composer and migration on pull add\033[0m
\033[38;5;214ma file named '.NO_AUTO_COMPOSER_MIGRATE' in this directory.\033[0m\n
74 packages you are using are looking for funding.
Use the composer fund command to find out more!
php artisan migrate --force

Migrating: 2021_12_04_181200_refactor_models
Info: Renaming existing tables
Info: Creating new tables
Info: Start copying ...
Table 'users' 2/2 [============================] 100%
Error: Model ID 2 - OutOfBoundsException - ID-based creation time is out of reasonable bounds
Error: Model ID 3 - OutOfBoundsException - ID-based creation time is out of reasonable bounds
Error: Model ID 9 - OutOfBoundsException - ID-based creation time is out of reasonable bounds
Error: Model ID 11 - OutOfBoundsException - ID-based creation time is out of reasonable bounds
Error: Model ID 17 - OutOfBoundsException - ID-based creation time is out of reasonable bounds
Table 'albums' 145/145 [============================] 100%
Table 'user_base_album' 83/137 [================>-----------] 60%

In 2021_12_04_181200_refactor_models.php line 1116:

Undefined array key 15023691398618

\n\033[38;5;010mpost merge hook finish\033[0m\n

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

@oblomow As I suspected. So now do this (on a DB instance before updating to the latest version):

delete from user_album where album_id = 15023691398618;

Hopefully that's the only such offender, but if not, you may need to do it repeatedly for the album IDs that fail...

will do that. I will first restore the working situation.

@nagmat84
Copy link
Collaborator

It seems that there are more users than I expected which fiddled with their database manually and - as we had no foreign constraints until now - broke it. Given my previous post, I start working on an improved version of the migration which first checks, whether there are any inconsistencies and which will terminate the migration with an error if it finds inconsistencies.

@kamil4
Copy link
Contributor

kamil4 commented Jan 14, 2022

@nagmat84 It makes me wonder if we should add such sanity check to the DB migration file and either delete the offenders or bail out early before leaving the DB in an (even more) inconsistent state?

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

@kamil4 this should be added in the Diagnostic page.

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

It seems that there are more users than I expected which fiddled with their database manually and - as we had no foreign constraints until now - broke it. Given my previous post, I start working on an improved version of the migration which first checks, whether there are any inconsistencies and which will terminate the migration with an error if it finds inconsistencies.

I never fiddled with my database. However I am a long term Lychee user, enduring many updates, upgrades and migrations. Perhaps migrating to the 'new' Lychee introduced an error.

@nagmat84
Copy link
Collaborator

@nagmat84 It makes me wonder if we should add such sanity check to the DB migration file and either delete the offenders or bail out early before leaving the DB in an (even more) inconsistent state?

I assume our posts were written simultaneously. See here. I am already on it. Give me 15min.

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

SELECT * FROM user_album WHERE album_id NOT IN (SELECT id FROM albums);
+----+----------------+---------+
| id | album_id | user_id |
+----+----------------+---------+
| 91 | 15023691398618 | 1 |
+----+----------------+---------+
1 row in set (0.00 sec)

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

No, but it is quite possible you shared album with id 15023691398618 to user 1, and then deleted said album and the database did not update.

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

the last update didn't crash it. Thanks guys for all your quick support! If you're in the neighbourhood and the pubs are open again I will you buy you a beer!

Diagnostics
-------
Info: Latest version of PHP is 8.1




System Information
--------------
Lychee Version (git):            master (32c374d) - Probably more than 30 commits behind master
DB Version:                      4.5.0

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

System:                          FreeBSD
PHP Version:                     8
PHP User agent:                  Lychee/4 (https://lycheeorg.github.io/)
Max uploaded file size:          100M
Max post size:                   100M
Max execution time:              200
MySQL Version:                   8.0.27

Imagick:                         1
Imagick Active:                  1
Imagick Version:                 1692
GD Version:                      2.3.1

@kamil4
Copy link
Contributor

kamil4 commented Jan 14, 2022

I think @ildyria is in Nijmegen. The rest of us are all over the world 😃.

Glad to hear it worked!

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

HA! That's easy. I'm in Nijmegen as well.

@kamil4
Copy link
Contributor

kamil4 commented Jan 14, 2022

@oblomow Out of curiousity how old is your DB instance? I'm wondering about those album IDs like 2, 3, etc. I've seen them like that on screenshots from early versions of Lychee but I've never experienced them myself (and I started with a 3.x version).

@ildyria Don't we have some DB magic in place that deletes said records form user_album when either the user or the album are deleted?

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

@kamil4 I don't know. Quite old. That's for sure. If you really want to know, I can start digging.

@nagmat84
Copy link
Collaborator

nagmat84 commented Jan 14, 2022

@ildyria Don't we have some DB magic in place that deletes said records form user_album when either the user or the album are deleted?

I am not ildyria, but no, we had not. This was also fixed with my huge PR. Before that there was a comment which said basically something like "oh, oh, I wonder what happens with the albums owned by this user" above the line which deleted a user.

I think, we know the answer.

@kamil4
Copy link
Contributor

kamil4 commented Jan 14, 2022

@oblomow No worries, don't bother. I simply thought at first that you generated those short IDs while manually editing the database but when you denied I remembered that I've seen such short album IDs before -- on our home page no less!

We really should regenerate our screenshots -- what we have there is museum-grade at this point 😉. They are pretty pictures though...

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

@oblomow then you should know that there bar and restaurants are still closed. :'D

@oblomow
Copy link
Author

oblomow commented Jan 14, 2022

@ildyria " If you're in the neighbourhood and the pubs are open again I will you buy you a beer!"

@ildyria
Copy link
Member

ildyria commented Jan 14, 2022

read too fast.

@nagmat84 nagmat84 linked a pull request Jan 14, 2022 that will close this issue
@nagmat84 nagmat84 mentioned this issue Jan 15, 2022
nagmat84 added a commit that referenced this issue Jan 16, 2022
* Checks DB consistency

* add checks and don't break check on old version

* fix bug

* remove commented code

* synch front while we are at it.

* remove corruption check from diagnostics, it is done in the migration.

* Added auto-fix.

Co-authored-by: ildyria <[email protected]>
@gdureuil
Copy link

gdureuil commented Jan 20, 2022

Sorry to rain on you parade, but I have the exact same problem while trying to update today. I'm comming from the exact same git revision. I read this whole thread, but have no orphaned album entries.

My install is also very old, comming from before the fork (version 2.x maybe ?) and switch to laravel.

The query SELECT * FROM user_album WHERE album_id NOT IN (SELECT id FROM albums); gives no result.

Here are my diagnostic, and git pull output.

`

Diagnostics
-------
Warning: Dropbox import not working. dropbox_key is empty.
Warning: lossless_optimization set to 1 but cwebp not found!
Warning: lossless_optimization set to 1 but svgo not found!
Warning: You may experience problems when uploading a photo of large size or handling many/large albums. Take a look in the FAQ for details.
Info: Latest version of PHP is 8.1




System Information
--------------
Lychee Version (git):            master (a7de020) - Data not in Cache
DB Version:                      4.4.0

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

System:                          Linux
PHP Version:                     8
PHP User agent:                  Lychee/4 (https://lycheeorg.github.io/)
Max uploaded file size:          100M
Max post size:                   100M
Max execution time:              60
MySQL Version:                   10.3.31-MariaDB-0+deb10u1-log

Imagick:                         1
Imagick Active:                  1
Imagick Version:                 1690
GD Version:                      2.2.5




Config Information
--------------
version:                         040400
check_for_updates:               0
sorting_Photos_col:              title
sorting_Photos_order:            ASC
sorting_Albums_col:              title
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:                            fr
layout:                          0
image_overlay_type:              none
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:                   
landing_title:                   
landing_subtitle:                
landing_facebook:                
landing_flickr:                  
landing_twitter:                 
landing_instagram:               
landing_youtube:                 
landing_background:              
site_title:                      BakaGamer - Screenshots
site_copyright_enable:           0
site_copyright_begin:            2010
site_copyright_end:              2021
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:                      1
location_decoding:               0
location_decoding_timeout:       30
location_show:                   0
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:           1
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:                    1
nsfw_warning_admin:              0
map_display_direction:           1
album_subtitle_type:             oldstyle
upload_processing_limit:         3
public_photos_hidden:            1
new_photos_notification:         0`

`git pull --rebase
warning: redirecting to https://github.com/LycheeOrg/Lychee.git/
remote: Enumerating objects: 599, done.
remote: Counting objects: 100% (599/599), done.
remote: Compressing objects: 100% (188/188), done.
remote: Total 599 (delta 437), reused 545 (delta 407), pack-reused 0
Receiving objects: 100% (599/599), 433.65 KiB | 5.49 MiB/s, done.
Resolving deltas: 100% (437/437), completed with 126 local objects.
From https://www.github.com/LycheeOrg/Lychee
a7de020..49fd769 master -> origin/master
de78bd7..633b4c6 consistent_json_api -> origin/consistent_json_api

  • [new branch] markdown-support -> origin/markdown-support
    Updating a7de020..49fd769
    Fast-forward
    .github/workflows/Build.yml | 4 +-
    .phpstorm.meta.php | 66 +-
    app/Actions/Album/Action.php | 5 +-
    app/Actions/Album/Archive.php | 247 +++---
    app/Actions/Album/Create.php | 42 +-
    app/Actions/Album/CreateTag.php | 33 -
    app/Actions/Album/CreateTagAlbum.php | 30 +
    app/Actions/Album/Delete.php | 62 +-
    app/Actions/Album/Extensions/LocationData.php | 45 -
    app/Actions/Album/Extensions/StoreAlbum.php | 46 -
    app/Actions/Album/Merge.php | 59 +-
    app/Actions/Album/Move.php | 60 +-
    app/Actions/Album/Photos.php | 116 ---
    app/Actions/Album/PositionData.php | 33 +-
    app/Actions/Album/Prepare.php | 47 -
    app/Actions/Album/SetCover.php | 5 +-
    app/Actions/Album/SetDescription.php | 5 +-
    app/Actions/Album/SetLicense.php | 5 +-
    app/Actions/Album/SetNSFW.php | 17 +-
    app/Actions/Album/SetPublic.php | 26 +-
    app/Actions/Album/SetShowTags.php | 18 +-
    app/Actions/Album/SetSorting.php | 16 +-
    app/Actions/Album/SetTitle.php | 5 +-
    app/Actions/Album/Setter.php | 43 +-
    app/Actions/Album/Setters.php | 34 +-
    app/Actions/Album/Unlock.php | 49 +-
    app/Actions/AlbumAuthorisationProvider.php | 615 +++++++++++++
    app/Actions/Albums/Extensions/PublicIds.php | 177 ----
    app/Actions/Albums/Extensions/PublicViewable.php | 31 -
    app/Actions/Albums/Extensions/TopQuery.php | 23 -
    app/Actions/Albums/PositionData.php | 40 +-
    app/Actions/Albums/Prepare.php | 44 -
    app/Actions/Albums/Smart.php | 90 +-
    app/Actions/Albums/Tag.php | 39 -
    app/Actions/Albums/Top.php | 78 +-
    app/Actions/Albums/Tree.php | 109 ++-
    app/Actions/Diagnostics/Checks/MissingUserCheck.php | 23 -
    app/Actions/Diagnostics/Info.php | 2 +-
    app/Actions/Import/Exec.php | 48 +-
    app/Actions/Import/Extensions/ImportPhoto.php | 51 --
    app/Actions/Import/FromUrl.php | 14 +-
    app/Actions/Install/ApplyMigration.php | 2 +-
    app/Actions/Photo/Archive.php | 322 ++++---
    app/Actions/Photo/Create.php | 281 +++---
    app/Actions/Photo/Delete.php | 23 +-
    app/Actions/Photo/Duplicate.php | 87 +-
    app/Actions/Photo/Extensions/ArchiveFileInfo.php | 115 +++
    app/Actions/Photo/Extensions/Checks.php | 47 +-
    app/Actions/Photo/Extensions/Checksum.php | 23 -
    app/Actions/Photo/Extensions/Constants.php | 6 +-
    app/Actions/Photo/Extensions/ImageEditing.php | 182 ----
    app/Actions/Photo/Extensions/Metadata.php | 40 -
    app/Actions/Photo/Extensions/ParentAlbum.php | 33 -
    app/Actions/Photo/Extensions/Save.php | 64 --
    app/Actions/Photo/Extensions/SourceFileInfo.php | 121 +++
    app/Actions/Photo/Extensions/VideoEditing.php | 171 ----
    app/Actions/Photo/Prepare.php | 56 --
    app/Actions/Photo/Random.php | 21 +-
    app/Actions/Photo/Rotate.php | 169 +---
    app/Actions/Photo/SetAlbum.php | 36 +-
    app/Actions/Photo/SetPublic.php | 2 +-
    app/Actions/Photo/SetStar.php | 2 +-
    app/Actions/Photo/Setter.php | 5 +-
    app/Actions/Photo/Setters.php | 4 +-
    app/Actions/Photo/Strategies/AddBaseStrategy.php | 161 ++++
    app/Actions/Photo/Strategies/AddDuplicateStrategy.php | 43 +
    app/Actions/Photo/Strategies/AddPhotoPartnerStrategy.php | 48 ++
    app/Actions/Photo/Strategies/AddStandaloneStrategy.php | 185 ++++
    app/Actions/Photo/Strategies/AddStrategyParameters.php | 29 +
    app/Actions/Photo/Strategies/AddVideoPartnerStrategy.php | 26 +
    app/Actions/Photo/Strategies/ImportMode.php | 71 ++
    app/Actions/Photo/Strategies/RotateStrategy.php | 187 ++++
    app/Actions/Photo/Strategies/StrategyDuplicate.php | 97 ---
    app/Actions/Photo/Strategies/StrategyPhoto.php | 154 ----
    app/Actions/Photo/Strategies/StrategyPhotoBase.php | 104 ---
    app/Actions/Photo/SymLinker.php | 16 -
    app/Actions/Photo/Toggle.php | 2 +-
    app/Actions/Photo/Toggles.php | 20 +-
    app/Actions/PhotoAuthorisationProvider.php | 297 +++++++
    app/Actions/RSS/Generate.php | 82 +-
    app/Actions/ReadAccessFunctions.php | 116 ---
    app/Actions/Search/AlbumSearch.php | 71 +-
    app/Actions/Search/PhotoSearch.php | 74 +-
    app/Actions/Settings/Login.php | 10 +-
    app/Actions/Sharing/ListShare.php | 83 +-
    app/Actions/User/Create.php | 16 +-
    app/Actions/User/Save.php | 4 +-
    app/Assets/Helpers.php | 68 +-
    app/Assets/SizeVariantLegacyNamingStrategy.php | 106 +++
    app/Casts/DateTimeWithTimezoneCast.php | 2 +-
    app/Casts/MustNotSetCast.php | 59 ++
    app/Console/Commands/ExifLens.php | 11 +-
    app/Console/Commands/GenerateThumbs.php | 72 +-
    app/Console/Commands/Ghostbuster.php | 196 +++--
    app/Console/Commands/PhotosAddedNotification.php | 79 +-
    app/Console/Commands/ResetAdmin.php | 16 +-
    app/Console/Commands/ShowLogs.php | 16 +-
    app/Console/Commands/Takedate.php | 15 +-
    app/Console/Commands/VideoData.php | 83 +-
    app/Contracts/AbstractAlbum.php | 33 +
    app/Contracts/AddPhotoStrategyInterface.php | 21 -
    app/Contracts/AlbumInterface.php | 10 -
    app/Contracts/BidirectionalRelation.php | 8 +
    app/Contracts/HasRandomID.php | 26 +
    app/Contracts/SizeVariantFactory.php | 136 +++
    app/Contracts/SizeVariantNamingStrategy.php | 41 +
    app/Exceptions/Handler.php | 16 +-
    app/Exceptions/Handlers/AccessDBDenied.php | 10 +-
    app/Exceptions/Handlers/ApplyComposer.php | 9 +-
    app/Exceptions/Handlers/InvalidPayload.php | 8 +-
    app/Exceptions/Handlers/ModelNotFound.php | 33 -
    app/Exceptions/Handlers/NoEncryptionKey.php | 6 +-
    app/Facades/AccessControl.php | 5 +-
    app/Facades/Helpers.php | 6 +-
    app/Factories/AlbumFactory.php | 157 +++-
    app/Factories/SmartFactory.php | 56 --
    app/Http/Controllers/Administration/SettingsController.php | 13 +-
    app/Http/Controllers/Administration/SharingController.php | 11 +-
    app/Http/Controllers/Administration/UserController.php | 54 +-
    app/Http/Controllers/AlbumController.php | 265 +++---
    app/Http/Controllers/AlbumsController.php | 24 +-
    app/Http/Controllers/DemoController.php | 44 +-
    app/Http/Controllers/FrameController.php | 2 +-
    app/Http/Controllers/LegacyController.php | 40 +
    app/Http/Controllers/PhotoController.php | 178 ++--
    app/Http/Controllers/PhotoEditorController.php | 35 +-
    app/Http/Controllers/RedirectController.php | 54 +-
    app/Http/Controllers/SessionController.php | 54 +-
    app/Http/Controllers/ViewController.php | 53 +-
    app/Http/Livewire/Album.php | 54 +-
    app/Http/Livewire/Albums.php | 13 +-
    app/Http/Livewire/Fullpage.php | 21 +-
    app/Http/Livewire/PhotoOverlay.php | 2 +-
    app/Http/Livewire/Sidebar.php | 15 +-
    app/Http/Middleware/ReadCheck.php | 41 +-
    app/Http/Middleware/UploadCheck.php | 94 +-
    app/Http/Requests/AlbumRequests/AlbumIDRequest.php | 9 +-
    app/Http/Requests/AlbumRequests/AlbumIDsRequest.php | 9 +-
    app/Http/Requests/AlbumRequests/{AlbumIDRequestInt.php => AlbumModelIDRequest.php} | 11 +-
    app/Http/Requests/ImportRequests/ImportServerRequest.php | 3 +-
    app/Http/Requests/ImportRequests/ImportUrlRequest.php | 3 +-
    app/Http/Requests/PhotoRequests/PhotoIDRequest.php | 9 +-
    app/Http/Requests/PhotoRequests/PhotoIDsRequest.php | 9 +-
    app/Http/Requests/UserRequests/UserPostRequest.php | 4 +-
    app/Image/GdHandler.php | 28 +-
    app/Image/ImageHandler.php | 12 +-
    app/Image/ImageHandlerInterface.php | 8 +-
    app/Image/ImagickHandler.php | 2 +-
    app/Image/SizeVariantDefaultFactory.php | 389 +++++++++
    app/Legacy/Legacy.php | 40 +
    app/Locale/Italian.php | 1 -
    app/Mail/PhotosAdded.php | 11 +-
    app/Metadata/Extractor.php | 73 +-
    app/Metadata/GitHubFunctions.php | 2 +-
    app/Metadata/GitRequest.php | 2 +-
    app/ModelFunctions/ConfigFunctions.php | 2 +-
    app/ModelFunctions/SessionFunctions.php | 55 +-
    app/ModelFunctions/SymLinkFunctions.php | 69 +-
    app/Models/Album.php | 383 ++++-----
    app/Models/BaseAlbumImpl.php | 256 ++++++
    app/Models/Configs.php | 12 +-
    app/Models/Extensions/AlbumBooleans.php | 70 --
    app/Models/Extensions/AlbumBuilder.php | 58 ++
    app/Models/Extensions/AlbumCast.php | 99 ---
    app/Models/Extensions/AlbumGetters.php | 121 ---
    app/Models/Extensions/AlbumSetters.php | 11 -
    app/Models/Extensions/AlbumStringify.php | 16 -
    app/Models/Extensions/BaseAlbum.php | 126 +++
    app/Models/Extensions/ConfigsHas.php | 6 +-
    app/Models/Extensions/CustomSort.php | 28 -
    app/Models/Extensions/ForwardsToParentImplementation.php | 460 ++++++++++
    app/Models/Extensions/HasAttributesPatch.php | 25 +
    app/Models/Extensions/HasBidirectionalRelationships.php | 115 +++
    app/Models/Extensions/HasRandomIDAndLegacyTimeBasedID.php | 158 ++++
    app/Models/Extensions/NodeTrait.php | 65 --
    app/Models/Extensions/PhotoBooleans.php | 36 +-
    app/Models/Extensions/PhotoCast.php | 155 ----
    app/Models/Extensions/PhotoGetters.php | 78 --
    app/Models/Extensions/SizeVariants.php | 257 ++++++
    app/Models/Extensions/SortingDecorator.php | 115 +++
    app/Models/Extensions/TagAlbumBuilder.php | 48 ++
    app/Models/Extensions/Thumb.php | 109 ++-
    app/Models/Extensions/UTCBasedTimes.php | 8 +-
    app/Models/Logs.php | 2 +-
    app/Models/Page.php | 2 -
    app/Models/PageContent.php | 2 -
    app/Models/Photo.php | 577 +++++++------
    app/Models/SizeVariant.php | 242 ++++++
    app/Models/SymLink.php | 233 ++---
    app/Models/TagAlbum.php | 110 +++
    app/Models/User.php | 41 +-
    app/Providers/AppServiceProvider.php | 34 +-
    app/Redirections/ToInstall.php | 4 +-
    app/Relations/BidirectionalRelationTrait.php | 13 +
    app/Relations/HasAlbumThumb.php | 290 +++++++
    app/Relations/HasManyBidirectionally.php | 59 ++
    app/Relations/HasManyChildAlbums.php | 100 +++
    app/Relations/HasManyChildPhotos.php | 106 +++
    app/Relations/HasManyPhotos.php | 105 +++
    app/Relations/HasManyPhotosByTag.php | 90 ++
    app/Relations/HasManyPhotosRecursively.php | 104 +++
    app/Relations/HasManySizeVariants.php | 110 +++
    app/Relations/LinkedPhotoCollection.php | 48 ++
    app/Rules/AlbumIDListRule.php | 45 +
    app/Rules/AlbumIDRule.php | 38 +
    app/Rules/ModelIDListRule.php | 42 +
    app/Rules/ModelIDRule.php | 32 +
    app/SmartAlbums/BareSmartAlbum.php | 94 --
    app/SmartAlbums/BaseSmartAlbum.php | 133 +++
    app/SmartAlbums/PublicAlbum.php | 61 +-
    app/SmartAlbums/RecentAlbum.php | 40 +-
    app/SmartAlbums/SmartAlbum.php | 69 --
    app/SmartAlbums/StarredAlbum.php | 35 +-
    app/SmartAlbums/TagAlbum.php | 23 -
    app/SmartAlbums/UnsortedAlbum.php | 57 +-
    app/SmartAlbums/Utils/MimicModel.php | 84 ++
    app/View/Components/Album/Thumbimg.php | 1 +
    app/View/Components/Photo.php | 13 +-
    composer.json | 2 +-
    composer.lock | 991 +++++++++++----------
    config/app.php | 14 +
    database/migrations/2018_08_15_102039_move_albums.php | 2 +-
    database/migrations/2018_08_15_103716_move_photos.php | 134 +--
    database/migrations/2019_12_15_0700_add_share_button_visible_option.php | 9 +-
    database/migrations/2020_12_26_153220_nested_set_for_albums.php | 26 +-
    database/migrations/2021_01_09_163715_remove_max_min_takestamps.php | 35 +-
    database/migrations/2021_06_01_181900_refactor_timestamps_anew.php | 18 +-
    database/migrations/2021_06_06_151613_fix-takedate.php | 11 +-
    database/migrations/2021_12_04_181200_refactor_models.php | 2085 +++++++++++++++++++++++++++++++++++++++++++++
    database/migrations/2022_01_13_183131_bump_version040500.php | 27 +
    database/migrations/2022_01_16_181337_optimize_tables.php | 71 ++
    phpunit.xml | 1 +
    public/.htaccess | 2 +
    public/Lychee-front | 2 +-
    public/dist/frame.js | Bin 118286 -> 118741 bytes
    public/dist/leaflet.markercluster.js.map | Bin 41725 -> 41953 bytes
    public/dist/main.css | Bin 91540 -> 91549 bytes
    public/dist/main.js | Bin 865603 -> 868530 bytes
    public/dist/view.js | Bin 218017 -> 217226 bytes
    routes/web.php | 12 +-
    tests/Feature/AlbumTest.php | 64 +-
    tests/Feature/GeoDataTest.php | 71 +-
    tests/Feature/InstallTest.php | 35 +-
    tests/Feature/Lib/AlbumsUnitTest.php | 429 +++++-----
    tests/Feature/Lib/PhotosUnitTest.php | 428 +++++-----
    tests/Feature/Lib/SessionUnitTest.php | 118 ++-
    tests/Feature/Lib/UsersUnitTest.php | 197 +++--
    tests/Feature/NotificationTest.php | 56 +-
    tests/Feature/PhotosRotateTest.php | 50 +-
    tests/Feature/PhotosTest.php | 152 ++--
    tests/Feature/RSSTest.php | 12 +-
    tests/Feature/RedirectTest.php | 10 +-
    tests/Feature/UsersTest.php | 111 +--
    version.md | 2 +-
    254 files changed, 13268 insertions(+), 7095 deletions(-)
    delete mode 100644 app/Actions/Album/CreateTag.php
    create mode 100644 app/Actions/Album/CreateTagAlbum.php
    delete mode 100644 app/Actions/Album/Extensions/LocationData.php
    delete mode 100644 app/Actions/Album/Extensions/StoreAlbum.php
    delete mode 100644 app/Actions/Album/Photos.php
    delete mode 100644 app/Actions/Album/Prepare.php
    create mode 100644 app/Actions/AlbumAuthorisationProvider.php
    delete mode 100644 app/Actions/Albums/Extensions/PublicIds.php
    delete mode 100644 app/Actions/Albums/Extensions/PublicViewable.php
    delete mode 100644 app/Actions/Albums/Extensions/TopQuery.php
    delete mode 100644 app/Actions/Albums/Prepare.php
    delete mode 100644 app/Actions/Albums/Tag.php
    delete mode 100644 app/Actions/Diagnostics/Checks/MissingUserCheck.php
    delete mode 100644 app/Actions/Import/Extensions/ImportPhoto.php
    create mode 100644 app/Actions/Photo/Extensions/ArchiveFileInfo.php
    delete mode 100644 app/Actions/Photo/Extensions/Checksum.php
    delete mode 100644 app/Actions/Photo/Extensions/ImageEditing.php
    delete mode 100644 app/Actions/Photo/Extensions/Metadata.php
    delete mode 100644 app/Actions/Photo/Extensions/ParentAlbum.php
    delete mode 100644 app/Actions/Photo/Extensions/Save.php
    create mode 100644 app/Actions/Photo/Extensions/SourceFileInfo.php
    delete mode 100644 app/Actions/Photo/Extensions/VideoEditing.php
    delete mode 100644 app/Actions/Photo/Prepare.php
    create mode 100644 app/Actions/Photo/Strategies/AddBaseStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/AddDuplicateStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/AddPhotoPartnerStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/AddStandaloneStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/AddStrategyParameters.php
    create mode 100644 app/Actions/Photo/Strategies/AddVideoPartnerStrategy.php
    create mode 100644 app/Actions/Photo/Strategies/ImportMode.php
    create mode 100644 app/Actions/Photo/Strategies/RotateStrategy.php
    delete mode 100644 app/Actions/Photo/Strategies/StrategyDuplicate.php
    delete mode 100644 app/Actions/Photo/Strategies/StrategyPhoto.php
    delete mode 100644 app/Actions/Photo/Strategies/StrategyPhotoBase.php
    delete mode 100644 app/Actions/Photo/SymLinker.php
    create mode 100644 app/Actions/PhotoAuthorisationProvider.php
    delete mode 100644 app/Actions/ReadAccessFunctions.php
    create mode 100644 app/Assets/SizeVariantLegacyNamingStrategy.php
    create mode 100644 app/Casts/MustNotSetCast.php
    create mode 100644 app/Contracts/AbstractAlbum.php
    delete mode 100644 app/Contracts/AddPhotoStrategyInterface.php
    delete mode 100644 app/Contracts/AlbumInterface.php
    create mode 100644 app/Contracts/BidirectionalRelation.php
    create mode 100644 app/Contracts/HasRandomID.php
    create mode 100644 app/Contracts/SizeVariantFactory.php
    create mode 100644 app/Contracts/SizeVariantNamingStrategy.php
    delete mode 100644 app/Exceptions/Handlers/ModelNotFound.php
    delete mode 100644 app/Factories/SmartFactory.php
    create mode 100644 app/Http/Controllers/LegacyController.php
    rename app/Http/Requests/AlbumRequests/{AlbumIDRequestInt.php => AlbumModelIDRequest.php} (61%)
    create mode 100644 app/Image/SizeVariantDefaultFactory.php
    create mode 100644 app/Models/BaseAlbumImpl.php
    delete mode 100644 app/Models/Extensions/AlbumBooleans.php
    create mode 100644 app/Models/Extensions/AlbumBuilder.php
    delete mode 100644 app/Models/Extensions/AlbumCast.php
    delete mode 100644 app/Models/Extensions/AlbumGetters.php
    delete mode 100644 app/Models/Extensions/AlbumSetters.php
    delete mode 100644 app/Models/Extensions/AlbumStringify.php
    create mode 100644 app/Models/Extensions/BaseAlbum.php
    delete mode 100644 app/Models/Extensions/CustomSort.php
    create mode 100644 app/Models/Extensions/ForwardsToParentImplementation.php
    create mode 100644 app/Models/Extensions/HasAttributesPatch.php
    create mode 100644 app/Models/Extensions/HasBidirectionalRelationships.php
    create mode 100644 app/Models/Extensions/HasRandomIDAndLegacyTimeBasedID.php
    delete mode 100644 app/Models/Extensions/NodeTrait.php
    delete mode 100644 app/Models/Extensions/PhotoCast.php
    delete mode 100644 app/Models/Extensions/PhotoGetters.php
    create mode 100644 app/Models/Extensions/SizeVariants.php
    create mode 100644 app/Models/Extensions/SortingDecorator.php
    create mode 100644 app/Models/Extensions/TagAlbumBuilder.php
    create mode 100644 app/Models/SizeVariant.php
    create mode 100644 app/Models/TagAlbum.php
    create mode 100644 app/Relations/BidirectionalRelationTrait.php
    create mode 100644 app/Relations/HasAlbumThumb.php
    create mode 100644 app/Relations/HasManyBidirectionally.php
    create mode 100644 app/Relations/HasManyChildAlbums.php
    create mode 100644 app/Relations/HasManyChildPhotos.php
    create mode 100644 app/Relations/HasManyPhotos.php
    create mode 100644 app/Relations/HasManyPhotosByTag.php
    create mode 100644 app/Relations/HasManyPhotosRecursively.php
    create mode 100644 app/Relations/HasManySizeVariants.php
    create mode 100644 app/Relations/LinkedPhotoCollection.php
    create mode 100644 app/Rules/AlbumIDListRule.php
    create mode 100644 app/Rules/AlbumIDRule.php
    create mode 100644 app/Rules/ModelIDListRule.php
    create mode 100644 app/Rules/ModelIDRule.php
    delete mode 100644 app/SmartAlbums/BareSmartAlbum.php
    create mode 100644 app/SmartAlbums/BaseSmartAlbum.php
    delete mode 100644 app/SmartAlbums/SmartAlbum.php
    delete mode 100644 app/SmartAlbums/TagAlbum.php
    create mode 100644 app/SmartAlbums/Utils/MimicModel.php
    create mode 100644 database/migrations/2021_12_04_181200_refactor_models.php
    create mode 100644 database/migrations/2022_01_13_183131_bump_version040500.php
    create mode 100644 database/migrations/2022_01_16_181337_optimize_tables.php
    mode change 100644 => 100755 public/dist/leaflet.markercluster.js.map

post merge hook start

--no-dev mode detected

composer install --no-dev --prefer-dist --no-suggest
PHP Deprecated: Required parameter $path follows optional parameter $schema in /usr/share/php/JsonSchema/Constraints/UndefinedConstraint.php on line 62

Deprecated: Required parameter $path follows optional parameter $schema in /usr/share/php/JsonSchema/Constraints/UndefinedConstraint.php on line 62
PHP Deprecated: Required parameter $path follows optional parameter $schema in /usr/share/php/JsonSchema/Constraints/UndefinedConstraint.php on line 108

Deprecated: Required parameter $path follows optional parameter $schema in /usr/share/php/JsonSchema/Constraints/UndefinedConstraint.php on line 108
Deprecation Notice: Method ReflectionParameter::getClass() is deprecated in /usr/share/php/Composer/Repository/RepositoryManager.php:130
Deprecation Notice: Method ReflectionParameter::getClass() is deprecated in /usr/share/php/Composer/Repository/RepositoryManager.php:130
Deprecation Notice: Method ReflectionParameter::getClass() is deprecated in /usr/share/php/Composer/Repository/RepositoryManager.php:130
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies from lock file
PHP Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php:84
Stack trace:
#0 [internal function]: array_merge()
#1 /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php(84): call_user_func_array()
#2 /usr/share/php/Composer/DependencyResolver/Solver.php(387): Composer\DependencyResolver\DefaultPolicy->selectPreferredPackages()
#3 /usr/share/php/Composer/DependencyResolver/Solver.php(742): Composer\DependencyResolver\Solver->selectAndInstall()
#4 /usr/share/php/Composer/DependencyResolver/Solver.php(231): Composer\DependencyResolver\Solver->runSat()
#5 /usr/share/php/Composer/Installer.php(475): Composer\DependencyResolver\Solver->solve()
#6 /usr/share/php/Composer/Installer.php(229): Composer\Installer->doInstall()
#7 /usr/share/php/Composer/Command/InstallCommand.php(121): Composer\Installer->run()
#8 /usr/share/php/Symfony/Component/Console/Command/Command.php(255): Composer\Command\InstallCommand->execute()
#9 /usr/share/php/Symfony/Component/Console/Application.php(953): Symfony\Component\Console\Command\Command->run()
#10 /usr/share/php/Symfony/Component/Console/Application.php(248): Symfony\Component\Console\Application->doRunCommand()
#11 /usr/share/php/Composer/Console/Application.php(258): Symfony\Component\Console\Application->doRun()
#12 /usr/share/php/Symfony/Component/Console/Application.php(148): Composer\Console\Application->doRun()
#13 /usr/share/php/Composer/Console/Application.php(104): Symfony\Component\Console\Application->run()
#14 /usr/bin/composer(57): Composer\Console\Application->run()
#15 {main}
thrown in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php on line 84

Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php:84
Stack trace:
#0 [internal function]: array_merge()
#1 /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php(84): call_user_func_array()
#2 /usr/share/php/Composer/DependencyResolver/Solver.php(387): Composer\DependencyResolver\DefaultPolicy->selectPreferredPackages()
#3 /usr/share/php/Composer/DependencyResolver/Solver.php(742): Composer\DependencyResolver\Solver->selectAndInstall()
#4 /usr/share/php/Composer/DependencyResolver/Solver.php(231): Composer\DependencyResolver\Solver->runSat()
#5 /usr/share/php/Composer/Installer.php(475): Composer\DependencyResolver\Solver->solve()
#6 /usr/share/php/Composer/Installer.php(229): Composer\Installer->doInstall()
#7 /usr/share/php/Composer/Command/InstallCommand.php(121): Composer\Installer->run()
#8 /usr/share/php/Symfony/Component/Console/Command/Command.php(255): Composer\Command\InstallCommand->execute()
#9 /usr/share/php/Symfony/Component/Console/Application.php(953): Symfony\Component\Console\Command\Command->run()
#10 /usr/share/php/Symfony/Component/Console/Application.php(248): Symfony\Component\Console\Application->doRunCommand()
#11 /usr/share/php/Composer/Console/Application.php(258): Symfony\Component\Console\Application->doRun()
#12 /usr/share/php/Symfony/Component/Console/Application.php(148): Composer\Console\Application->doRun()
#13 /usr/share/php/Composer/Console/Application.php(104): Symfony\Component\Console\Application->run()
#14 /usr/bin/composer(57): Composer\Console\Application->run()
#15 {main}
thrown in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php on line 84
php artisan migrate --force

In 2021_12_04_181200_refactor_models.php line 2076:

Interface "Kalnoy\Nestedset\Node" not found

post merge hook finish

Current branch master is up to date.`

@nagmat84
Copy link
Collaborator

nagmat84 commented Jan 20, 2022

Your problem seems to have a complete different cause. Migration fails not due your DB being inconsistent, but because Kalnoy\Nestedset\Node is missing (cp. 3rd line from below). In turn, this is the case because upgrading the package dependencies via composer install --no-dev fails with an exception. The interesting part is

Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies from lock file
PHP Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /usr/sharephp/Composer/DependencyResolver/DefaultPolicy.php:84

Unfortunately, I am not a composer expert. But I would recommend

  1. Don't run composer as the super-user (root user). It is important to run composer as the same user which executes the PHP files later, most likely this will be the user which also runs the process of your web-server. On most systems this is either www-data or apache or nginx (depending on your distribution and webserver). Otherwise composer downloads all package files with the wrong ownership and Lychee won't be able to load them. As a safety measure I usually recommend something like this cd ~www-data; sudo -u www-data /bin/bash and therewith execute all Lychee/Artisan/GIT command within a shell that is owned by the correct user.
  2. Please remove all content below the ./vendor directory, chown all files in the Lychee directory to the correct user recursively and then re-run composer install --no-dev, but this time with the correct user (see above). Probably this should fix the issue.
  3. Check the version of composer. Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters might also indicate that your composer version is too old for PHP 8. Before you install the dependencies, run a composer self-update via composer self-update.

@gdureuil
Copy link

Must have missed running it as www-data user on a previous update and it seems to have broken. I do a backup and will run the commands you said, while being careful of the user. Thanks for your hellp, I will report soon.

@gdureuil
Copy link

Seems like the composer verion on debian 10, in repositories is version 1.x and we need 2.x. Can you please confirm that ? If that's the case, I'll need to update that, and maybe you'll need to put checks on composer version in Leechy.

@nagmat84
Copy link
Collaborator

Yes, I can confirm.

Generally, it is not recommended to use a system-wide composer executable. Even on a rolling-release system like mine (Gentoo), these packages are ridiculously out-dated. Usually, you should use a local, project-specific composer installation. I try to provide you the necessary steps. If this still does not help, we should take this conversation to Gitter. We should stop to hijack this thread. Your problem has nothing to do with the problem of the OP. In particular it is not a Lychee issue, but your personal problem due to an ancient server installation ;-)

@gdureuil
Copy link

No worries, I updated Composer myself and doing tests. I should be ok. If you have no news from me, assume, it went nicely. Sorry for the thread hijack.

@nagmat84
Copy link
Collaborator

nagmat84 commented Jan 20, 2022

I assume that your installation resides in /var/www/html/lychee and that your apache user is www-data. If not, adopt accordingly.

  1. sudo apt-get remove composer (Optional, but recommended).
    De-install your system-wide installation of composer. Most mature PHP packages (like Nextcloud, etc.) do not need it, because they ship with their own version. Uninstalling composer prevents you from accidentally running the system-wide version if you forget to put ./ in front of the composer command and thereby breaking things again. However, I don't know if you have any Debian packages which actually require a system-wide composer. So look out for any related messages returned by apt-get remove.

  2. cd /var/wwwhtml/lychee/vendor followed by sudo rm -rf *
    Nuke the vendor directory

  3. cd .. followed by sudo chown -R www-data:www-data *
    Move one level up to the Lychee main directory and make everything owned by www-data.

  4. sudo -u www-data /bin/bash
    From here on, we do everything in a shell owned by the www-data user.

  5. Run the following lines as instructed by https://getcomposer.org/download/

    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    php composer-setup.php
    php -r "unlink('composer-setup.php');"
    

    This will install a local, project-specific version of composer into the Lychee main directory

  6. git checkout master, git pull and git reset --hard master
    Make sure you have the latest version of master and a clean working copy.

  7. ./composer install --no-dev
    Install all dependencies; checkout for any errors. Please note, the ./ in the beginning. This ensures that you run the correct version of composer.

  8. ./artisan migrate
    Migrate your database. Please make sure you have a backup.

  9. exit
    Leaves the shell owned by www-data

@gdureuil
Copy link

Thanks for the guide. I updated composer manualy and updated components. then ran the update and all went well at first glance. Thanks for your time ! If I have other problems i'll create a new issue.

@vyruss
Copy link

vyruss commented Oct 24, 2022

I assume that your installation resides in /var/www/html/lychee and that your apache user is www-data. If not, adopt accordingly.

1. `sudo apt-get remove composer` (Optional, but recommended).

...

Thank you @nagmat84 - can you please add this fix to the Wiki or main Doc site as it affected me and probably others as well?

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 a pull request may close this issue.

6 participants