shish / shimmie2

An easy-to-install community image gallery (aka booru)
http://code.shishnet.org/shimmie2/
GNU General Public License v2.0
404 stars 112 forks source link

Pool Image Addition is broken #1013

Closed Ayutac closed 9 months ago

Ayutac commented 9 months ago

Server Software about: title: "Wandering Inn Fanworks" theme: "twi" url: "https://fanworks.wanderinginn.com/"

versions: shimmie: "2.10.0-beta2+" 2af4a83fd19cb93128504086be9727382caa3728 schema: 21 php: "8.1.2-1ubuntu2.14" db: "pgsql PostgreSQL 14.10 (Ubuntu 14.10-0ubuntu0.22.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit" os: "Linux shelterv4 6.5.0-14-generic #14~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 20 18:15:30 UTC 2 x86_64" server: "Apache"

extensions: core: ["admin","alias_editor","bbcode","comment","download","et","ext_manager","four_oh_four","handle_pixel","help_pages","image","index","media","mime","replace_file","setup","static_files","system","tag_edit","tag_list","upgrade","upload","user","user_config","view"] extra: ["autocomplete","emoticons_list","et_server","favorites","graphql","handle_mp3","handle_svg","handle_video","home","image_view_counter","link_image","pools","post_titles","random_list","rating","regen_thumb","relationships","report_image","rotate","rss_comments","rss_images","sitemap","source_history","tag_categories","tag_editcloud","tag_history","tag_tools","tagger_xml","transcode","transcode_video"] handled_mimes: ["image/jpeg","image/gif","image/png","image/webp","audio/mpeg","image/svg+xml","video/x-ms-asf","video/x-msvideo","video/x-flv","video/x-matroska","video/mp4","video/ogg","video/quicktime","video/webm"]

stats: images: 4234 comments: 311 users: 96

media: memory_limit: "500MB" disk_use: "511GB" disk_total: "688GB"

thumbnails: engine: "convert" quality: 75 width: 192 height: 192 scaling: 100 mime: "image/jpeg"

Client Software (please complete the following information)

What steps trigger this bug

  1. Go to Pools
  2. Choose an existing pool or create a new one
  3. Try to import at least one image.

What did you expect to happen? Image imported

What actually happened?

Internal Error
Message: SQLSTATE[42703]: Undefined column: 7 ERROR: column "lastupdated" of relation "pools" does not exist LINE 2: ...ELECT COUNT(*) FROM pool_images WHERE pool_id=$1),lastupdate... ^

Query: UPDATE pools SET posts=(SELECT COUNT(*) FROM pool_images WHERE pool_id=:pid),lastupdated=CURRENT_TIMESTAMP WHERE id=:pid

Args: array ( 'pid' => 2, )

Version: 2.10.0-beta2 (on 8.1.2-1ubuntu2.14)

Stack Trace:

#0 /var/www/fanworks.wanderinginn.com/core/database.php(210): Shimmie2\Database->_execute()
#1 /var/www/fanworks.wanderinginn.com/ext/pools/main.php(1006): Shimmie2\Database->execute()
#2 /var/www/fanworks.wanderinginn.com/ext/pools/main.php(992): Shimmie2\Pools->update_count()
#3 /var/www/fanworks.wanderinginn.com/ext/pools/main.php(742): Shimmie2\Pools->add_post()
#4 /var/www/fanworks.wanderinginn.com/core/send_event.php(156): Shimmie2\Pools->onPoolAddPosts()
#5 /var/www/fanworks.wanderinginn.com/ext/pools/main.php(385): Shimmie2\send_event()
#6 /var/www/fanworks.wanderinginn.com/core/send_event.php(156): Shimmie2\Pools->onPageRequest()
#7 /var/www/fanworks.wanderinginn.com/index.php(89): Shimmie2\send_event()
#8 {main}
shish commented 9 months ago

This should be fixed now - also checking my assumptions, has this install been active for a while (or installed from 2.9.X and upgraded)? There was code in the past (like several months ago) that could create the pools table with a missing column, but any install from within the past few months should have the column included by default and I'm not sure why it would be missing o.o

AxelTerizaki commented 9 months ago

The install dates from 2021 or something like that, so yeah the column might be missing.

You could probably create a migration with a ADD COLUMN IF NOT EXISTS to fix that :)

shish commented 9 months ago

You could probably create a migration with a ADD COLUMN IF NOT EXISTS to fix that :)

Alas it's 2024 and the major databases still can't agree on syntax for that, if they support it at all x__x But yes taking that approach (but at the frontend layer) is what https://github.com/shish/shimmie2/commit/22cf7914a637ec047427f71881f8dd050ebee5e3 does :)