Upgrading Add-on unconditionally updates JavaScript Timestamp


Well-known member
When upgrading an Add-on, jsLastUpdate which is used to calculated the JavaScript cache buster is unconditionally updated after importing Add-on Data in XF\AddOn\AddOn:postDataImport().

public function postDataImport()
    // all data will be imported, re-enable this so postX methods will have access to their methods
    $installed = $this->installedAddOn;
    if (!$installed)
        throw new \LogicException("Add-on is not installed");

    $installed->is_processing = false;

    \XF::repository('XF:Option')->updateOption('jsLastUpdate', \XF::$time);

This seems kinda inefficient as many Add-Ons (including official XFI) don't have any JS, it therefore would be better to only update the timestamp if an Add-on actually has JavaScript files.
Upvote 0

Chris D

XenForo developer
Staff member
We're not currently planning on progressing this as a bug fix though it might be something we can consider in the future.

Ultimately it's somewhat of a micro-optimisation that may require significant effort to get right to ensure the caches are invalidated in the cases where they're supposed to.


Well-known member
Ultimately it's somewhat of a micro-optimisation
IMHO that somewhat depends on on usage patterns.

Usually we've got a couple Add-on updates per week (sometimes several per day), as every update (often unnecessarily) invalidates all JS cached by clients this does sum up quite a bit.