Quote:
Originally Posted by ddmobley
In a search for an answer to the parsed posts disappearing, I have modified my system to preserve the parsed post cache for posts that are sticky. On my system, the only posts that would have HTML in them are sticky posts, so it was, to me, only a question of how to keep the software's maintenance from deleting posts from the parsed post cache that were stickly posts. Here's how I did it:
In includes/cron/cleanup2.php, there is a code segment that looks like:
Code:
// expired cached posts
$vbulletin->db->query_write("
DELETE FROM " . TABLE_PREFIX . "post_parsed
WHERE dateline < " . (TIMENOW - ($vbulletin->options['cachemaxage'] * 60 * 60 * 24))
);
I edited it to look like this:
Code:
// expired cached posts
$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"
);
Edit: I found I was getting a SQL error in my previous modification, and found a new way of keeping the post_parsed_cache clean. This above works.
This simply checks the thread table for the existence of a sticky post ID that matches the post ID of a post in the parsed post cache. If there is a match, it doesn't delete that post's cache, it leaves it indefinitely, or until the post is manually deleted.
|
This appears to work in 3.7 RC1 but the table "post_parsed" is now "postparsed".
So one would need to look for:
Code:
// expired cached posts
$vbulletin->db->query_write("
DELETE FROM " . TABLE_PREFIX . "postparsed
WHERE dateline < " . (TIMENOW - ($vbulletin->options['cachemaxage'] * 60 * 60 * 24))
);
and replace with:
Code:
// expired cached posts
$vbulletin->db->query_write("
DELETE parsed FROM " . TABLE_PREFIX . "postparsed 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"
);
Addendum: Alternatively, if you prefer not to stick all of the threads that you want to put HTML in, and you want to be the only one allowed to use HTML, the following
should work:
Code:
// expired cached posts
$vbulletin->db->query_write("
DELETE parsed FROM " . TABLE_PREFIX . "postparsed 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.postuserid != 1"
);
This assumes your user ID is 1. Substitute your user ID if that is not correct. Of course this can make for a large "postparsed" table.