Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-28-2007, 10:18 PM
ddmobley ddmobley is offline
 
Join Date: May 2006
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Want to mod cleanup2.php for post_parsed cache

I am looking for a mod to cleanup2.php in the includes/cron directory that deals with cleaning up the post_parsed cache.

The current code looks like this:

Code:
$vbulletin->db->query_write("
	DELETE FROM " . TABLE_PREFIX . "post_parsed
	WHERE dateline < " . (TIMENOW - ($vbulletin->options['cachemaxage'] * 60 * 60 * 24))
);
What I want is to modify this code where it also compares the sticky field in the thread table. If the thread is sticky then the postid in post_parsed which matches the firstpostid of the sticky thread would not be deleted.

Is this doable?

I believe I have written my own solution. If anyone sees anything wrong with this, please respond. I modified the code above to look like this:

Code:
// expired cached posts
$vbulletin->db->query_write("
	DELETE FROM " . TABLE_PREFIX . "post_parsed
	WHERE dateline < " . (TIMENOW - ($vbulletin->options['cachemaxage'] * 60 * 60 * 24)) . "
	AND NOT EXISTS (SELECT firstpostid FROM " . TABLE_PREFIX . "thread WHERE firstpostid = postid)"
);

This is my latest code:

Code:
$vbulletin->db->query_write("
	DELETE parsed FROM " . TABLE_PREFIX . "post_parsed AS parsed
	LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON thread.firstpostid = parsed.postid
	WHERE parsed.dateline < " . (TIMENOW - ($vbulletin->options['cachemaxage'] * 60 * 60 * 24)) . "
	AND thread.sticky = 0"
);
Reply With Quote
  #2  
Old 08-29-2007, 07:09 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is your goal with this change?
Reply With Quote
  #3  
Old 09-12-2008, 09:07 PM
ddmobley ddmobley is offline
 
Join Date: May 2006
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I added a mod to allow certain usergroups to post HTML to the forums, but when the post with the HTML expires in the cache, the next reader to view the post who doesn't have the HTML status causes a cached post of just raw HTML code to be saved. This mod was to allow me to stick posts, and leave the cache with the HTML approved version in place. It still doesn't work like I want, as periodically, the cache gets deleted anyway and a page of raw HTML gets displayed. Even setting the particular forum as HTML for the forum level doesn't work. It shouldn't be so difficult to allow admins to post HTML and not other users.

I guess the real solution is to just set the dateline of the post_parsed record to some unbelievably forward-in-time number.
Reply With Quote
  #4  
Old 09-22-2008, 10:06 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The real solution would be to fix the modification you are using. Parsing should not be based on the member viewing, but on the member who posted.

Like it currently works it is even dangerous by the sound of it. How about the following:
- Mallicous user tries to hack your site by posting mallicious HTML. Not a real problem as default vB will not parse it and your modification will probably be setup not to parse the HTML from this "regular" member. But what if an admin (or someone set to have HTML permission) is the first to view the post (or the first after a cache clean), now it would be parsed and your site is successfully hacked.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:50 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08206 seconds
  • Memory Usage 2,187KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete