Steffen
Well-known member
- Affected version
- 2.0.5
The order of "template" entries in the templates.xml file shipped with XenForo doesn't seem to be deterministic. For example, the unified diff between the XenForo 2.0.4 templates.xml and the XenForo 2.0.5 templates.xml consists of 27886 lines although far fewer template lines have actually changed. It's just that the order of template entries is different from release to release.
This does not cause any problems with Xenforo but if you keep XenForo in a Git repository (like I do) then this can be a little annoying.
And maybe the following simple patch is all that's needed (assuming that you use the export-templates command when building the XenForo ZIP file):
I've written a custom command to sort templates.xml files after the fact but I'd greatly appreciate if this could be "fixed" upstream.
Bash:
$ diff -ur xenforo_2.0.4_full/upload/src/addons/XF/_data/templates.xml xenforo_2.0.5_full/upload/src/addons/XF/_data/templates.xml|wc -l
27886
This does not cause any problems with Xenforo but if you keep XenForo in a Git repository (like I do) then this can be a little annoying.
And maybe the following simple patch is all that's needed (assuming that you use the export-templates command when building the XenForo ZIP file):
Diff:
diff --git a/src/XF/Cli/Command/Development/ExportTemplates.php b/src/XF/Cli/Command/Development/ExportTemplates.php
index a4edcb030..1572c5004 100644
--- a/src/XF/Cli/Command/Development/ExportTemplates.php
+++ b/src/XF/Cli/Command/Development/ExportTemplates.php
@@ -18,5 +18,6 @@ class ExportTemplates extends AbstractExportCommand
protected function extraFinderConditions(Finder $finder)
{
$finder->where('style_id', 0);
+ $finder->order('type', 'title');
}
}
\ No newline at end of file
I've written a custom command to sort templates.xml files after the fact but I'd greatly appreciate if this could be "fixed" upstream.
Last edited: