vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Want to mod cleanup2.php for post_parsed cache (https://vborg.vbsupport.ru/showthread.php?t=156485)

ddmobley 08-28-2007 10:18 PM

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"
);


Marco van Herwaarden 08-29-2007 07:09 AM

What is your goal with this change?

ddmobley 09-12-2008 09:07 PM

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.

Marco van Herwaarden 09-22-2008 10:06 AM

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.


All times are GMT. The time now is 11:19 AM.

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.01037 seconds
  • Memory Usage 1,716KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete