2015-06-03, 08:03 PM
With MyBB 1.8, I've noticed some strange behaviour of the find_replace_templatesets function. Using the following code:
Causes all global templates to be updated. This is due to the following query being ran by the function:
This query results in the following (where I have one global template, with the content "this is a test global template...":
The expected result would be for only the "header include" template to be returned, not all global templates.
I believe the actual query that should be ran is as follows:
This query returns only the "headerinclude" template.
This code was changed in this July 2014 commit, so I'm surprised it's taken this long to cause problems...
find_replace_templatesets('headerinclude', '/$/', '{$myalerts_js}');
Causes all global templates to be updated. This is due to the following query being ran by the function:
SELECT tid, sid, template FROM mybb_templates WHERE title = 'headerinclude' AND sid>0 OR sid=-1;
This query results in the following (where I have one global template, with the content "this is a test global template...":
The expected result would be for only the "header include" template to be returned, not all global templates.
I believe the actual query that should be ran is as follows:
SELECT tid, sid, template FROM mybb_templates WHERE title = 'headerinclude' AND (sid>0 OR sid=-1);
This query returns only the "headerinclude" template.
This code was changed in this July 2014 commit, so I'm surprised it's taken this long to cause problems...