Load config and language files on demand
Posted: Sun Jan 11, 2015 3:26 pm
Hello Community,
I suggest to avoid loading of unnecessary config and language files of plugins. Currently for each plugin 4 such files are loaded (defaultconfig.php, config.php, default.php and $sl.php) on each request, even if the plugin might not be involved at all. Consider, for instance, Pagemanager which is never used by front-end requests, but nonetheless its 4 config/language files are always loaded; several other plugins are only used on some pages (e.g. galleries, sliders, guestbooks).
Unfortunately, there is no way for the core (pluginloader) to know in advance which plugins will be used. However, a simple solution would be to use functions or methods (instead of variables) to access the config options and language strings, so the method could load the respective files on demand. Until all (relevant) plugins would be converted to use this new API throughout, all config and language files would still need to be loaded, so I suggest to introduce the API as soon as possible, i.e. for XH 1.7. The new API could already be delivered by a utility plugin/addon, what would provide backward compatibility with older CMSimple(_XH) versions, but even then it would make sense to agree on a reasonable API first.
Any suggestions?
Christoph
I suggest to avoid loading of unnecessary config and language files of plugins. Currently for each plugin 4 such files are loaded (defaultconfig.php, config.php, default.php and $sl.php) on each request, even if the plugin might not be involved at all. Consider, for instance, Pagemanager which is never used by front-end requests, but nonetheless its 4 config/language files are always loaded; several other plugins are only used on some pages (e.g. galleries, sliders, guestbooks).
Unfortunately, there is no way for the core (pluginloader) to know in advance which plugins will be used. However, a simple solution would be to use functions or methods (instead of variables) to access the config options and language strings, so the method could load the respective files on demand. Until all (relevant) plugins would be converted to use this new API throughout, all config and language files would still need to be loaded, so I suggest to introduce the API as soon as possible, i.e. for XH 1.7. The new API could already be delivered by a utility plugin/addon, what would provide backward compatibility with older CMSimple(_XH) versions, but even then it would make sense to agree on a reasonable API first.
Any suggestions?
Christoph