PDA

View Full Version : Custom BBCodes not working after rebuilding post cache


squishi
11-15-2014, 07:24 PM
The title says it all.

I have reprocessed the post cache of all my forum's posts.
Now the custom [ YOUTUBE][/YOUTUBE] bbcodes (without the space) no longer work in older posts.
When I post a new one, the embedded videos do show. Old posts just show the bbcode.

kh99
11-15-2014, 08:27 PM
Hmm...maybe it doesn't work right if you rebuild the post cache from the admincp. You could try just deleting the post cache and see what happens (it will get rebuilt as users view posts).

ozzy47
11-15-2014, 10:12 PM
If you edit one of the older posts, what is it showing exactly for the full bbcode? Is it any different from a post that is working?

Lynne
11-16-2014, 05:29 PM
If you disable post caching does it work or not?

squishi
11-17-2014, 06:21 AM
Where can I find the setting to turn off the post cache? :confused:

When I edit an older post, the youtube embed words again.
So there is nothing wrong with the bbcodes, they just don't get replaced when rebuilding the post cache.

ozzy47
11-17-2014, 09:14 AM
If you edit one of the older posts, what is it showing exactly for the full bbcode? Is it any different from a post that is working?

Like is the code in lowercase and and the working code is in uppercase? Or do you just click on edit post, then save changing nothing, and it works?

Lynne
11-17-2014, 04:58 PM
Where can I find the setting to turn off the post cache? :confused:

AdminCP > Settings > Options > Server Settings > Cached Posts Lifespan > 0

squishi
11-18-2014, 07:27 AM
I set the post cache lifetime to 0 and then revisted older posts with an embed.
They are not showing the embedded video, just the code.

The case of the bbcode should not matter. WHen I add a new post, the bbcode can be upper or lower case. I expect the same behavior from the post parser.

--------------- Added 1416302924 at 1416302924 ---------------

I have also just disabled all plugins and turned the post cache time to 0.
The custom BBCodes are still not parsed.

--------------- Added 1416302989 at 1416302989 ---------------

When I edit an older post and just hit the save button, the code gets parsed and the video shows.

kh99
11-18-2014, 07:52 AM
Try running the "Hourly cleanup #2" scheduled task. That should remove cached posts that are older than the limit (all of them, since you have it set to 0). From what you said it definitely sounds like it's a problem with the posts in the rebuild cache, so you just need to clear it.

squishi
11-18-2014, 03:12 PM
I did rebuild all posts twice, using the maintenance task. That should have rebuilt the posts.
But it's actually what has caused the problem.

I would prefer not to delete all cached posts. That would only increase the load on the server.
Instead, I would prefer to fix whatever problem there is with the BBCode parser that is used when the post cache is rebuilt.

kh99
11-18-2014, 03:36 PM
Is it a mod that adds the YOUTUBE bbcode? Then you'd have to find out if they can help you. If it is a mod then I'd guess that it uses a hook that isn't called from the admincp.

If I understand things (based on a quick look at the code, so I may not understand), when you set the cache time to 0 the cached posts will get deleted as soon as the Cleanup #2 scheduled task runs, so they may have already have been deleted anyway. But like I said before, if the cache time is > 0 then the cache will get built as users view posts, so that seems like it could even be better than building it all at once from the admincp (unless you were doing it in the middle of the night or something).

Edit: reading your post again, I'm thinking maybe there's a misunderstanding about the problem. I'm thinking if the post cache has been built incorrectly, then you'd have to build it again even if the problem were fixed. It sounds like maybe you're thinking that you could fix the problem and avoid rebuilding the cache? I suppose that's a possibility, depending on how the mod works.

In any case, that's all I have to say, I'll let someone else help.

Lynne
11-18-2014, 08:29 PM
It is a mod that does the [ youtube ] tags. I seem to recall I had this same issue on my site with the mod and had to modify it. I would suggest you check the modification thread and see if it's been mentioned and if a fix was posted there.

squishi
11-19-2014, 08:51 AM
No, it's not a mod. I just used the "BB Code Manager" in the backend to define this custom BBCode. (Unless this BBCode Manager is a mod).
150988
I noticed that other custom codes in the BBCodeManager did not get replaced, either, when I rebuilt the post cache.

squishi
11-19-2014, 08:58 AM
I have disabled all plugins now and will rebuild the post cache. That will take a few hours.
I am very sure that the problem will persist. I will report back...

kh99
11-19-2014, 10:22 AM
No, it's not a mod. I just used the "BB Code Manager" in the backend to define this custom BBCode. (Unless this BBCode Manager is a mod).

OK, but are you certain of that? If you have a bbcode that takes an entire youtube url and embeds it, then I believe that it would have to be a mod. If it just takes the id then it could be a custom code in the manager.

Sorry to question what you said, but like Lynne said, if it's a mod then you should check in the mod thread. For example, in the AME 2.5 Media Embedding mod, there's this: https://vborg.vbsupport.ru/showthread.php?t=202476&page=35 and if you scroll down to post #517 you'll see they are talking about that exact problem.

squishi
11-19-2014, 11:16 AM
I just
Disabled all plugins.
Then deleted the parsed post for a certain post in the database.
Disabled caching.
Loaded the post -> the embedded video was showing.
Deleted the parsed post from the database.
Turned on post caching.
Rebuilt the post cache.
The embedded video was not showing.

I have made plenty of mods to the code over the years. The thing is I very rarely run the post cache maintenance.
There are only two mods in class_bbcode.php and they should have no effect on the parser.

in class_bbcode.php, I see this:
if ($this->registry->bbcodecache !== null) // get bbcodes from the datastore

Maybe the datastore is not up to date and the custom codes are never fetched from the db?
Where can I find the datastore? How do I flush it?

Lynne
11-19-2014, 04:47 PM
Do you have AME installed?

kh99
11-19-2014, 08:06 PM
Maybe the datastore is not up to date and the custom codes are never fetched from the db?
Where can I find the datastore? How do I flush it?

I checked in vb3.8.8 on my test forum and $vbulletin->bbcodecache was null, so any custom bbcodes should be loaded from the db in append_custom_tags(). You could add some debug output to admincp/misc.php under where it says "if ($_REQUEST['do'] == 'buildpostcache')", if you want to check it for sure. You could add output in class_bbcode as well (enclose it in "if (defined('IN_CONTROL_PANEL'))" if it's a live forum).

squishi
11-20-2014, 05:38 PM
I did var_dump($this) in the class_bbcode.php. The bbcode parser object contains the custom bbcode.

I just noticed that the bbcode parser is not even replacing the img tags in the post parser.
My forum is messed up! :(

kh99
11-20-2014, 05:50 PM
I did var_dump($this) in the class_bbcode.php. The bbcode parser object contains the custom bbcode.

I just noticed that the bbcode parser is not even replacing the img tags in the post parser.
My forum is messed up! :(

I believe it's normal for the img tags to be there. For some reason that I don't understand, those are parsed when the post is displayed, even if the post is cached.

But if you're showing that the YOUTUBE custom bbcode has been loaded when you're doing a "rebuild post cache", then I don't know why it's not being used. I think it's possible to define two codes with the same tag, one with and one without an option. Is it possible that the custom code you defined doesn't match what you see in the posts (option-wise, I mean)?

squishi
11-20-2014, 05:55 PM
Okay, I have deleted all parsed posts. When I visit posts with embedded bbcode, they are now showing up correctly. They are also staying like that when I reload.
So it's only the admin backend's post cache function that's broken.

--------------- Added 1416513401 at 1416513401 ---------------

Strange. Why would VB not cache the img tags? Makes no sense to me to leave them out.

kh99
11-20-2014, 06:06 PM
Strange. Why would VB not cache the img tags? Makes no sense to me to leave them out.

There must be a good reason for it. The postparsed table has a column to indicate whether or not the post has images, and the bbcode parse function has a parameter to say whether img tags should be parsed. Maybe it's that there's one or more user options for displaying them? Although I don't know what they are offhand.

Edit: oh, yeah, each user can turn off images, so I guess that had to be handled in some way.