Jon W
Well-known member
- Affected version
- 2.0.9
The outdated template check compares the date of parent templates with the date of any modified child templates. Currently, if the child template was created at or earlier than the last modified time of the parent template it is considered outdated.
In the situation that a parent template and child template are created automagically at exactly the same time, this means it is automatically marked as outdated, which seems wrong.
It would be better if the check was only for "earlier than" and not "at or earlier than", i.e. the query in the getBaseOutdatedTemplateData() method should change from:
to:
In the situation that a parent template and child template are created automagically at exactly the same time, this means it is automatically marked as outdated, which seems wrong.
It would be better if the check was only for "earlier than" and not "at or earlier than", i.e. the query in the getBaseOutdatedTemplateData() method should change from:
PHP:
return $db->fetchAllKeyed('
SELECT template.template_id,
parent.version_string AS parent_version_string,
parent.last_edit_date AS parent_last_edit_date,
IF(parent.version_id > template.version_id, 1, 0) AS outdated_by_version,
IF(parent.last_edit_date > 0 AND parent.last_edit_date >= template.last_edit_date, 1, 0) AS outdated_by_date
FROM xf_template AS template
INNER JOIN xf_style AS style ON (style.style_id = template.style_id)
INNER JOIN xf_template_map AS map ON (
map.style_id = style.parent_id
AND map.type = template.type
AND map.title = template.title
)
INNER JOIN xf_template AS parent ON (map.template_id = parent.template_id
AND (
(parent.last_edit_date > 0 AND parent.last_edit_date >= template.last_edit_date)
OR parent.version_id > template.version_id
)
)
WHERE template.style_id > 0
ORDER BY template.title
', 'template_id');
to:
PHP:
return $db->fetchAllKeyed('
SELECT template.template_id,
parent.version_string AS parent_version_string,
parent.last_edit_date AS parent_last_edit_date,
IF(parent.version_id > template.version_id, 1, 0) AS outdated_by_version,
IF(parent.last_edit_date > 0 AND parent.last_edit_date > template.last_edit_date, 1, 0) AS outdated_by_date
FROM xf_template AS template
INNER JOIN xf_style AS style ON (style.style_id = template.style_id)
INNER JOIN xf_template_map AS map ON (
map.style_id = style.parent_id
AND map.type = template.type
AND map.title = template.title
)
INNER JOIN xf_template AS parent ON (map.template_id = parent.template_id
AND (
(parent.last_edit_date > 0 AND parent.last_edit_date > template.last_edit_date)
OR parent.version_id > template.version_id
)
)
WHERE template.style_id > 0
ORDER BY template.title
', 'template_id');