GordonLesti / Lesti_Fpc

Simple Magento Fullpagecache
https://gordonlesti.com/lesti-fpc-documentationversion-1-4-5/
Other
358 stars 158 forks source link

Improve modularity, allow other modules to inject config #173

Open AndreKlang opened 8 years ago

AndreKlang commented 8 years ago

Hello, First of all Thanks for a great module.

I have a thought, currently all config for the cache management (uri_params, refresh_actions,,) is stored as basic text. Meaning that it basically has to be managed manually from admin. But this makes it impossible for module-creators (like myself) to add correct config to a module to make it compatible.

The current config is well established and fills a purpose, so I'm not suggesting that should be removed, but it would be good if there is another way as well to add the config. The prettiest way i can think of is something like this:

<config>
    <default>
        <lesti_fpc>
            <cache_actions>
                <cms_index_index />
                <right.reports.product.viewed />
            </cache_actions>
            <miss_uri_params>
                <limit><![CDATA[limit=/^([0-9]+)|(all)$/"]]></limit>
            </miss_uri_params>
        </lesti_fpc>
    </default>
</config>

I'd love to hear your thoughts on this, and again, thanks for your contribution to Magento performance.

Happy holidays!

GordonLesti commented 8 years ago

Hello @AndreKlang thank you for the PR and your idea, but why didn't you use update scripts?

AndreKlang commented 8 years ago

Hello @GordonLesti I have for quite some time actually, but there are some issues with that.

First issue is, if a module is installed (that adds config to core_config_data) before Lesti Fpc is installed, that will screw up the config, because it wont read the defaults from config.xml.

Second issue, that actually got me, is that if two (or more) modules are installed at the same time, there can be some unexpected behavior due to caching. Basically both install/upgrade-scripts get the current config (that is cached since it is literally the same request that runs both), both scripts add lines to the end (in my case), then saves. But since the second one gets the same starting-point as the first one, the first ones changes is overwritten by the second one. (By the way, this is also an issue if one module change the same thing in different versions scripts)

Third issue is versioning. What if a new version need changed config? it is impossible to know what has been done manually in admin since last install/update. It just feels unstable to practically guess what needs to change in a string of config. That can potentially break the frontend.

Forth "Issue", (not really an issue though), it feels hacky and kind of wrong.. Using upgrade scripts to change config, when magento has an exelent way of passing config between modules. So why not make a standardized way to do this?

Hope this is answer enough :) Have a nice evening!