@tsteur opened this Issue on February 10th 2014 Owner

In case we are in production mode (merged assets is enabled) and there is a plugin upgrade/downgrade/uninstall we should regenerate the merged Noncore JS / CSS if needed.

@julienmoumne commented on February 10th 2014 Member

This should already work, see first line of [https://github.com/piwik/piwik/blob/master/core/Filesystem.php#L24] :

/**
* Called on Core install, update, plugin enable/disable
* Will clear all cache that could be affected by the change in configuration being made
*/
    public static function deleteAllCacheOnUpdate($pluginName = false)
    {
        AssetManager::getInstance()->removeMergedAssets($pluginName);
        View::clearCompiledTemplates();
        Cache::deleteTrackerCache();
    }
@tsteur commented on February 10th 2014 Owner

During update/downgrade/... it is not called I think. At least this is what I've experienced. I will try to reproduce it later. We should definitely remove the first line of that comment as a function does not know when it is called :)

@tsteur commented on February 12th 2014 Owner

To reproduce I installed the CustomAlerts plugin. Afterwards I increased the version number form 0.1.12 to 0.1.13 in plugin.json and added the following CSS to the alerts.less file

body, html {
  background-color: red;
}

In database Piwik recognized the update but did not recompile the CSS. Same for downgrading.

@julienmoumne commented on February 12th 2014 Member

If you are manually editing files, you are then in "development mode" right?

_disable_mergedassets should then be set to true

@tsteur commented on February 12th 2014 Owner

That's what I would normally do. But to reproduce this behavior on production I disabled merged assets (=false).

@julienmoumne commented on February 12th 2014 Member

Why would you edit files in a production environment?

@tsteur commented on February 12th 2014 Owner

This is basically what happens when you update a 3rd party plugin in production environment

@julienmoumne commented on February 12th 2014 Member

Is there no button for the user to press in order to trigger the update?

@julienmoumne commented on February 12th 2014 Member

By 3rd party you mean a plugin not published in the marketplace right?

In that case, maybe the simple solution is to document the fact the tmp directory must be manually emptied when a plugin is manually updated.

@tsteur commented on February 12th 2014 Owner

We experienced this issue also when updating plugins via Marketplace or when uploading a plugin ZIP in the UI. When you are running multiple PHP nodes you usually want to update manually though. Documenting could be a solution but can be problematic since you maybe do not directly notice that you forgot to clean the tmp directory (which also causes a rebuild of all JS files). In our case we didn't notice it in the beginning since everything still kinda worked but didn't. Maybe we can delete the assets in case any plugin changes? We do already have the installed version in the option table and can compare it with the current plugin version in the plugin.json file before it is actually updated.

@tsteur commented on February 17th 2014 Owner

In 237d8efcc6e1ac8bf76ecdb7f2f0473b806b2551: fixes #4655 assets are not invalidated after a plugin change. To fix this issue (at least for now) we always compare the cache buster. For JavaScript in production this is always fast as the hash is based only on plugin names + version. For css we have to concat the content of all raw css/less files which should be still fast, especially since the css is cached in the browser afterwards. @Julien let me know what you think about this and we can change it otherwise

@tsteur commented on February 17th 2014 Owner

In 3da7d94126c97b9e552c9bc8de658c4d8cf5691a: refs #4655 updated description of merged assets setting

@BeezyT commented on February 17th 2014 Member

The setting disable_merged_assets is mentioned multiple times in the code as well. I'd suggest updating all descriptions. Just do a quick search for disable_merged_assets to see what I mean: at a first glance, StylesheetUIAssetFetcher and AssetManager need updates as well.

Or maybe it would be better to remove the duplicate documentation and refer to the comment in global.ini from the other places.

@tsteur commented on February 17th 2014 Owner

In 2a00eb6b5980cab2a7a9a8c58a1081478f319106: refs #4655 updated documentation as the merged_assets flag is not really relevant for CSS at the moment

@tsteur commented on February 17th 2014 Owner

In b150893ba245a5b43ef8033c199e3ec3a5dfeada: refs #4655 updated description of merged assets option

@tsteur commented on February 17th 2014 Owner

In 5c12352ae91a9a3e5c1dfa224d80d05b66f98b45: refs #4655 actually here we can refer to the comment in the config

@tsteur commented on February 17th 2014 Owner

Thx Timo! I removed it in one place and updated another. Probably we still need the documentation in two places. The inline doc for developers (developer.piwik.org) and the other one for people who want to configure Piwik and just browse through the config.

This Issue was closed on February 18th 2014
Powered by GitHub Issue Mirror