Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Performance Info

UserPost

6:23 am
March 9, 2012


Kevin

Admin

posts 2603

41

I understand; no question about attachment comments or no attachment comments. But my question is specifically about comments on attachments to private posts. The scenario is that (with the constant SCOPER_PUBLIC_ATTACHMENT_COMMENTS defined) non-Administrators don't see "private" attachment comments, but Administrators do see them. Do you consider that inconsistent and undesirable?

To me, hiding private comments even from Administrator doesn't really make functional sense. Why would you even allow the comment to be submitted if nobody can see it? Or are you thinking it should only affect the general comment queries but not retrieval and display of comments when viewing a single attachment?

7:41 am
March 9, 2012


metal450

Member

posts 184

42

Ah, I see what you're saying.  Yeah, I guess it makes more sense to show everything to admins :)  (It seems in this case I was the one getting my signals crossed - the issue before was just that the returning of attachment comments varied based on account type, but that's not the issue we're talking about here.)

8:04 am
March 9, 2012


Kevin

Admin

posts 2603

43

I just updated the development code. Don't forget the new constant def:

define( 'SCOPER_PUBLIC_ATTACHMENT_COMMENTS', true );

8:26 am
March 9, 2012


metal450

Member

posts 184

44

Are we nearish a new version release?  If so, I'll just wait and test that.  If not, where do I find the dev version?


(Either way it might take me a bit to test it, I'm in Cambodia at the moment and the connection here is horrendous)

1:22 pm
November 20, 2012


metal450

Member

posts 184

45

Hey Kevin,

After a couple months' hiatus from webdev, I just finished fully testing the new RS 1.3.57; I'd been at 1.3.55 since we last spoke, due to the issue we were discussing here.  Unfortunately, 1.3.57 still appears not to work properly.  I was never quite certain how you intended these two defines to work, so I tried every combination.  Here's the result:

1) SCOPER_NO_ATTACHMENT_COMMENTS & SCOPER_PUBLIC_ATTACHMENT_COMMENTS not defined: enormous performance hit on every pageload, as per the original topic of this thread.  This is what we'd set out to fix.

2) SCOPER_NO_ATTACHMENT_COMMENTS & SCOPER_PUBLIC_ATTACHMENT_COMMENTS both defined: performance hit is fixed (overall php execution time comes down to a fraction of what it was), but now get_comments(array('status'=>'approve')) does not return comments on attachments for anyone except the admin - even for attachments to posts with no access restrictions whatsoever.  For instance: if you make a new public post which anyone can access, attach an image to it which anyone can access, and comment on it…the comment is not returned by get_comments() (unless you're the admin).

3) Only SCOPER_NO_ATTACHMENT_COMMENTS is defined: Same issue as #2: attachment comments are not returned for anyone but the admin, regardless of being public.

4) Only SCOPER_PUBLIC_ATTACHMENT_COMMENTS is defined: Same issue as #1: the behavior is correct, but the performance hit is still there.


Expected behavior: My understanding was that we could eliminate the huge performance hit by not worrying about comments on attachments to private posts; in other words, regardless of whether or not a given user has access to a private post, it would not show them comments on attachments to that post.  I thought, however, that fully public posts/attachments without any sort of access restrictions would not be affected; that is, since there's no access restrictions, access to comments would not be restricted either.


The offending query (taken with the debug-queries plugin enabled and slightly edited to show queries even for anonymous readers):


Time: 2.1282892227173

Query: SELECT DISTINCT * FROM wp_comments JOIN wp_posts ON wp_posts.ID = wp_comments.comment_post_ID LEFT JOIN wp_posts as parent ON parent.ID = wp_posts.post_parent AND parent.post_type IN ('post','page') AND wp_posts.post_type = 'attachment' WHERE comment_approved = '1' AND ( ( wp_posts.post_type = 'post' AND ( ( wp_posts.post_status = 'publish' AND ( ( ( ( ( ( ( 1=1 AND wp_posts.ID NOT IN ('4', '5', '7', '8', '12', '14', '15', '16', '17', '18', '19', '20', '30', '33', '36', '37', '39', '41', '43', '44', '47', '50', '56', '61', '66', '76', '101', '102', '112', '117', '124', '127', '128', '130', '148', '149', '161', '217', '225', '226', '228', '229', '232', '234', '242', '243', '249', '252', '253', '259', '263', '264', '266', '267', '270', '277', '279', '286', '299', '302', '304', '305', '308', '310', '311', '320', '329', '333', '335', '338', '346', '349', '356', '359', '362', '364', '367', '371', '373', '377', '381', '382', '387', '388', '390', '392', '394', '397', '408', '409', '410', '414', '424', '442', '452', '456', '465', '1160', '1187', '1240', '1285', '1384', '1427', '1445', '1479', '1545', '1581', '1607', '1678', '1684', '1697', '1699', '1732', '1788', '1828', '1832', '1884', '1899', '2171', '2181', '2239', '2442', '2567', '2697', '2716', '2844', '2910', '2958', '2982', '3045', '3082', '3398', '3405', '3513', '3664', '3811', '3818', '3870', '3905', '3942', '3969', '4043', '4054', '4172', '4174', '4176', '4177', '4179', '4182', '4184', '4186', '4188', '4191', '4194', '4198', '4207', '4210', '4212', '4213', '4214', '4216', '4217', '4218', '4220', '4255', '4981', '4989', '4996', '4997', '5000', '5176', '5178', '5179', '5181', '5184', '5188', '5367', '5428', '5429', '5481', '5710', '5711', '5737', '5821', '5823', '5928', '5943', '5944', '5963', '6026', '6056', '6073', '6147', '7257', '7370', '8564', '8656', '11023', '11033', '11137', '11152', '11750', '12185', '12499', '12605', '12614', '12770', '12884', '12936', '13065', '13075', '13101', '13283', '13347', '13452', '13900', '13902', '14116', '14130', '14334', '14340', '14635', '14898', '14995', '15911', '15920', '16514', '16698', '17366', '17535', '17553', '17819', '17821', '17834', '17840', '17851', '17860', '17866', '17881', '17885', '17894', '17901', '17909', '17919', '17929', '17935', '17949', '18010', '18116', '18602', '18661', '19938', '20528', '20618', '20871', '21121', '21195', '21460', '21468', '21494', '21674', '21760', '21841', '21860', '21869', '21873', '21906', '21915', '21941', '21992', '22030', '22053', '22070', '22163', '22188', '22210', '22252', '22265', '22268', '22319', '22389', '22398', '22467', '22481', '22539') ) ) ) ) ) ) ) ) ) ) OR ( wp_posts.post_type = 'page' AND ( ( wp_posts.post_status = 'publish' AND ( ( ( ( ( ( ( 1=1 AND wp_posts.ID NOT IN ('4720', '4723', '4739', '4744', '4767', '4769', '4770', '4781', '4980') ) ) ) ) ) ) ) ) ) ) OR ( wp_posts.post_type = 'attachment' AND parent.post_status = 'publish' ) ) ORDER BY comment_date_gmt DESC LIMIT 14

Call from: require, require_once, include, get_footer, locate_template, load_template, require_once, suffusion_before_end_container, do_action, call_user_func_array, suffusion_print_left_sidebars, get_sidebar, locate_template, load_template, require_once, dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, Widget_RecentComments->widget, get_comments, WP_Comment_Query->query


This query was taken in case 4 (SCOPER_PUBLIC_ATTACHMENT_COMMENTS defined).  Here's the corresponding query in case 2 (both defined), which as you can see takes 1/10th the time (but does not properly return comments on attachments to public posts):


Time: 0.22323608398438

Query: SELECT * FROM wp_comments JOIN wp_posts ON wp_posts.ID = wp_comments.comment_post_ID WHERE 1=1 AND ( ( wp_posts.post_status = 'publish' AND ( ( ( wp_posts.post_type = 'post' AND ( ( ( ( ( ( 1=1 AND wp_posts.ID NOT IN ('4', '5', '7', '8', '12', '14', '15', '16', '17', '18', '19', '20', '30', '33', '36', '37', '39', '41', '43', '44', '47', '50', '56', '61', '66', '76', '101', '102', '112', '117', '124', '127', '128', '130', '148', '149', '161', '217', '225', '226', '228', '229', '232', '234', '242', '243', '249', '252', '253', '259', '263', '264', '266', '267', '270', '277', '279', '286', '299', '302', '304', '305', '308', '310', '311', '320', '329', '333', '335', '338', '346', '349', '356', '359', '362', '364', '367', '371', '373', '377', '381', '382', '387', '388', '390', '392', '394', '397', '408', '409', '410', '414', '424', '442', '452', '456', '465', '1160', '1187', '1240', '1285', '1384', '1427', '1445', '1479', '1545', '1581', '1607', '1678', '1684', '1697', '1699', '1732', '1788', '1828', '1832', '1884', '1899', '2171', '2181', '2239', '2442', '2567', '2697', '2716', '2844', '2910', '2958', '2982', '3045', '3082', '3398', '3405', '3513', '3664', '3811', '3818', '3870', '3905', '3942', '3969', '4043', '4054', '4172', '4174', '4176', '4177', '4179', '4182', '4184', '4186', '4188', '4191', '4194', '4198', '4207', '4210', '4212', '4213', '4214', '4216', '4217', '4218', '4220', '4255', '4981', '4989', '4996', '4997', '5000', '5176', '5178', '5179', '5181', '5184', '5188', '5367', '5428', '5429', '5481', '5710', '5711', '5737', '5821', '5823', '5928', '5943', '5944', '5963', '6026', '6056', '6073', '6147', '7257', '7370', '8564', '8656', '11023', '11033', '11137', '11152', '11750', '12185', '12499', '12605', '12614', '12770', '12884', '12936', '13065', '13075', '13101', '13283', '13347', '13452', '13900', '13902', '14116', '14130', '14334', '14340', '14635', '14898', '14995', '15911', '15920', '16514', '16698', '17366', '17535', '17553', '17819', '17821', '17834', '17840', '17851', '17860', '17866', '17881', '17885', '17894', '17901', '17909', '17919', '17929', '17935', '17949', '18010', '18116', '18602', '18661', '19938', '20528', '20618', '20871', '21121', '21195', '21460', '21468', '21494', '21674', '21760', '21841', '21860', '21869', '21873', '21906', '21915', '21941', '21992', '22030', '22053', '22070', '22163', '22188', '22210', '22252', '22265', '22268', '22319', '22389', '22398', '22467', '22481', '22539') ) ) ) ) ) ) ) ) OR ( ( wp_posts.post_type = 'page' AND ( ( ( ( ( ( 1=1 AND wp_posts.ID NOT IN ('4720', '4723', '4739', '4744', '4767', '4769', '4770', '4781', '4980') ) ) ) ) ) ) ) ) ) ) ) AND comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 14

Call from: require, require_once, include, get_footer, locate_template, load_template, require_once, suffusion_before_end_container, do_action, call_user_func_array, suffusion_print_left_sidebars, get_sidebar, locate_template, load_template, require_once, dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, Widget_RecentComments->widget, get_comments, WP_Comment_Query->query

1:28 pm
November 20, 2012


metal450

Member

posts 184

46

Addendum:  the performance hit is only relevant when viewing the site anonymously (i.e. not while logged in as an admin), which is why debug-queries had to be edited slightly to show the queries 'always' (not just to admins).


About the Agapetry forum

Currently Online:

7 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1387

Posts: 6017

Members:

There are 1497 members

There are 1 guests


Kevin has made 2603 posts

Top Posters:

metal450 - 184

Ragnar - 108

YikYak - 73

whiteorb - 49

Daisy - 35

Administrator: Kevin | Moderators: Kevin