- Compatible XF 2.x versions
- 2.2
- Additional requirements
- php 8.0+
Standard Library by Xon v1.18.0+
SV/InstallerAppHelper
If installed, Svg Template v2.4.9+
- Updates duration
- 12 Months ($45.00 Yearly Renewal + GST for Australian Residents)
This add-on is currently not recommended for XenForo Cloud
It is required that Installer App Helper add-on is installed, as XenForo upgrades may break the site with this add-on installed.
XenForo writes phrases into templates, this causes language x template files x styles to be written.
As there is always 2 styles and 2 languages, this causes many more template files to be written than expected.
XenForo 2.x introduced "group phrases" which are written to a per-language php file, but did not fully decouple phrases from templates.
This add-on extracts all non-grouped phrases to their own per-language php file, allowing breaking the link between phrases and templates.
This completely removes the need to generate a query for non-grouped phrase, and makes "global phrases" redundant.
Once the add-on is installed this can be disabled via the config.php option:
Once this is done, the old phrase/template files can be removed via:
If template/phrase rebuilding needs to be done this can be done via the CLI commands:
Recovery steps:
Purpose: Used when querying for non-grouped phrases.
Addon changes: Disabled and emptied by this add-on.
Purpose: Tracks phrase usage in templates, and triggers template recompiles if those phrases are changed
Addon changes: Populated, but no longer triggers template recompiles
Purpose: Tracks phrase usage in templates, and triggers template recompiles if those phrases are changed
Addon changes: Disabled and emptied by this add-on.
Purpose: Phrases marked as "global" are copied into this value, and are loaded on every request
Addon changes: Disabled and emptied by this add-on.
Rework caching logic as there is no need to store copies of the phrase text, as php opcache can intern the entire phrase data
In development or design mode, XF has "template watchers" which reload the templates from disk every pageload and compute its has to detect changes.
This only handles templates, and nothing else that would be stored in
To re-enable add to
It is required that Installer App Helper add-on is installed, as XenForo upgrades may break the site with this add-on installed.
XenForo writes phrases into templates, this causes language x template files x styles to be written.
As there is always 2 styles and 2 languages, this causes many more template files to be written than expected.
XenForo 2.x introduced "group phrases" which are written to a per-language php file, but did not fully decouple phrases from templates.
This add-on extracts all non-grouped phrases to their own per-language php file, allowing breaking the link between phrases and templates.
This completely removes the need to generate a query for non-grouped phrase, and makes "global phrases" redundant.
Installing has post-install steps
To avoid breaking the site while installed, the add-on probes file paths to find a valid template.Once the add-on is installed this can be disabled via the config.php option:
PHP:
// If this value is not set, or is true, file probes are done which allow loading templates from the stock paths
$config['svProbeTemplateStore'] = false;
Once this is done, the old phrase/template files can be removed via:
Code:
rm -rf internal_data/code_cache/phrase_groups/l*
rm -rf internal_data/code_cache/templates/l*
If template/phrase rebuilding needs to be done this can be done via the CLI commands:
Code:
php cmd.php xf-rebuild:sv-phrases
php cmd.php xf-rebuild:sv-templates
Uninstalling is disruptive
On uninstalling, the path to template changes and XF renders a white page until the installer completes orphp cmd.php xf:rebuild-master-data
is manually run after uninstalling.Recovery steps:
Code:
rm -rf internal_data/code_cache/phrase_groups
rm -rf internal_data/code_cache/templates
php cmd.php xf:rebuild-master-data
Design notes
- Using
SV/InstallerAppHelper
:- The addon runs during XF installer code
- Setting the
xf_addon.is_processing
flag for this add-on is suppressed. As it will send the add-on into a zombie state which will break the site.
- Using web installer is not supported
xf_phrase_compiled
table
Purpose: Used when querying for non-grouped phrases.Addon changes: Disabled and emptied by this add-on.
xf_template_phrase
table
Purpose: Tracks phrase usage in templates, and triggers template recompiles if those phrases are changedAddon changes: Populated, but no longer triggers template recompiles
xf_language.phrase_cache
column
Purpose: Tracks phrase usage in templates, and triggers template recompiles if those phrases are changedAddon changes: Disabled and emptied by this add-on.
xf_language.global_cache
column
Purpose: Phrases marked as "global" are copied into this value, and are loaded on every requestAddon changes: Disabled and emptied by this add-on.
\XF\Language
class
Rework caching logic as there is no need to store copies of the phrase text, as php opcache can intern the entire phrase dataTemplate watcher
By default, "template watchers" are disabled when this add-on is active.In development or design mode, XF has "template watchers" which reload the templates from disk every pageload and compute its has to detect changes.
This only handles templates, and nothing else that would be stored in
_output
, resulting in additional latency for a feature not terribly useful for a 3rd party developer.To re-enable add to
config.php
:
PHP:
$config['svDisableTemplateWatcher'] = false;
- Related resources
- Standard Library by Xon (free)