Nathan Explosion Posted September 24, 2021 Posted September 24, 2021 (edited) Trying to use the "Topic Summary" cached content in an application, and hitting a brick wall. So, here goes again (tried already in the Slack channel) Do the following: Create a new PHP file in your IPS install root, add the code below and save it. Create a new topic, add an image attachment, submit the topic Open your PHP file in a browser. Q: why does the image information for the most recent topic (the one you created) get reproduced for all other topics, regardless of whether those other topics have no images or have images of their own? Important: it's going to return ALL topics so feel free to finesse the query to just a single forum. <?php require 'init.php'; \IPS\Session\Front::i(); $tids = \IPS\Db::i()->select('tid','forums_topics', array(),'tid DESC'); foreach ($tids as $tid) { $topic = \IPS\forums\Topic::load($tid); $images = $topic->imageAttachments(); var_dump($images); } Note: I know it's related to the cachekey being the same for all topics; mainly looking for a hint on whether that behaviour can be changed. Edited September 24, 2021 by Nathan Explosion
Daniel F Posted September 24, 2021 Posted September 24, 2021 Thanks, I have fixed this for an upcoming release. Nathan Explosion and SeNioR- 2
Nathan Explosion Posted January 25, 2022 Author Posted January 25, 2022 @Daniel F - did this fix make its way into a release? I've not seen anything in release notes that would describe it, so just checking in case I missed something.
Solution Daniel F Posted January 25, 2022 Solution Posted January 25, 2022 4.6.8- Fixed an caching issue in `\IPS\Content\Statistics`.
Nathan Explosion Posted January 25, 2022 Author Posted January 25, 2022 (edited) Great, thanks mate - hadn't bothered testing it until I saw something in the notes. And there's lovely 👍 C:\wamp\www\ips_46_dev\imagetest.php:9: array (size=2) 0 => array (size=25) 'attachment_id' => int 7 'location_key' => string 'forums_Forums' (length=13) 'id1' => int 9045 'id2' => int 134363 'temp' => null 'id3' => null 'lang' => null 'attach_id' => int 7 'attach_ext' => string 'png' (length=3) 'attach_file' => string 'Screenshot_5.png' (length=16) 'attach_location' => string 'monthly_2022_01/Screenshot_5.png.84eaf28cad8e8180ac656013f340bd03.png' (length=69) 'attach_thumb_location' => string '' (length=0) 'attach_thumb_width' => int 0 'attach_thumb_height' => int 0 'attach_is_image' => int 1 'attach_hits' => int 0 'attach_date' => int 1643127460 'attach_post_key' => string '' (length=0) 'attach_member_id' => int 1 'attach_filesize' => int 44115 'attach_img_width' => int 517 'attach_img_height' => int 342 'attach_is_archived' => int 0 'attach_security_key' => string '0bd559dda2983ec77484aa0565b3f674' (length=32) 'commentUrl' => string 'http://localhost/ips_46_dev/index.php?/topic/9045-more-images/&do=findComment&comment=134363' (length=92) 1 => array (size=25) 'attachment_id' => int 6 'location_key' => string 'forums_Forums' (length=13) 'id1' => int 9045 'id2' => int 134363 'temp' => null 'id3' => null 'lang' => null 'attach_id' => int 6 'attach_ext' => string 'png' (length=3) 'attach_file' => string 'Screenshot_2.png' (length=16) 'attach_location' => string 'monthly_2022_01/Screenshot_2.png.34fbc11507d07754db1428ca3ab20d2f.png' (length=69) 'attach_thumb_location' => string '' (length=0) 'attach_thumb_width' => int 0 'attach_thumb_height' => int 0 'attach_is_image' => int 1 'attach_hits' => int 0 'attach_date' => int 1643127460 'attach_post_key' => string '' (length=0) 'attach_member_id' => int 1 'attach_filesize' => int 42300 'attach_img_width' => int 517 'attach_img_height' => int 331 'attach_is_archived' => int 0 'attach_security_key' => string '0059e55a74d4383f81fd717b5a098e00' (length=32) 'commentUrl' => string 'http://localhost/ips_46_dev/index.php?/topic/9045-more-images/&do=findComment&comment=134363' (length=92) C:\wamp\www\ips_46_dev\imagetest.php:9: array (size=2) 0 => array (size=25) 'attachment_id' => int 5 'location_key' => string 'forums_Forums' (length=13) 'id1' => int 9044 'id2' => int 134362 'temp' => null 'id3' => null 'lang' => null 'attach_id' => int 5 'attach_ext' => string 'png' (length=3) 'attach_file' => string 'appurity_android_hdpi.png' (length=25) 'attach_location' => string 'monthly_2022_01/appurity_android_hdpi.png.a8aa536510389ada9a2d25b2725260ce.png' (length=78) 'attach_thumb_location' => string '' (length=0) 'attach_thumb_width' => int 0 'attach_thumb_height' => int 0 'attach_is_image' => int 1 'attach_hits' => int 0 'attach_date' => int 1643127363 'attach_post_key' => string '' (length=0) 'attach_member_id' => int 1 'attach_filesize' => int 69118 'attach_img_width' => int 480 'attach_img_height' => int 480 'attach_is_archived' => int 0 'attach_security_key' => string 'e2ab614780fe49a4412a84b04a0095b7' (length=32) 'commentUrl' => string 'http://localhost/ips_46_dev/index.php?/topic/9044-images/&do=findComment&comment=134362' (length=87) 1 => array (size=25) 'attachment_id' => int 4 'location_key' => string 'forums_Forums' (length=13) 'id1' => int 9044 'id2' => int 134362 'temp' => null 'id3' => null 'lang' => null 'attach_id' => int 4 'attach_ext' => string 'png' (length=3) 'attach_file' => string 'appurity_android_dpi.png' (length=24) 'attach_location' => string 'monthly_2022_01/appurity_android_dpi.png.cca173201044545ed3ae9c519cab3b57.png' (length=77) 'attach_thumb_location' => string '' (length=0) 'attach_thumb_width' => int 0 'attach_thumb_height' => int 0 'attach_is_image' => int 1 'attach_hits' => int 0 'attach_date' => int 1643127362 'attach_post_key' => string '' (length=0) 'attach_member_id' => int 1 'attach_filesize' => int 69118 'attach_img_width' => int 480 'attach_img_height' => int 480 'attach_is_archived' => int 0 'attach_security_key' => string '28af7c712c5508a97b92b86ee857b37e' (length=32) 'commentUrl' => string 'http://localhost/ips_46_dev/index.php?/topic/9044-images/&do=findComment&comment=134362' (length=87) C:\wamp\www\ips_46_dev\imagetest.php:9: array (size=0) empty C:\wamp\www\ips_46_dev\imagetest.php:9: array (size=0) empty C:\wamp\www\ips_46_dev\imagetest.php:9: array (size=0) empty Edited January 25, 2022 by Nathan Explosion
Recommended Posts