Rigel Kentaurus
Well-known member
This has been happening to me more recently.
Because of the new Zend Optimizer, and APC, the server does not check PHP files every time. This means that even if the person uploaded a new PHP file, it might be cached by the opcode cache, and it will not be refreshed until a minute later.
This is ESPECIALLY relevant on add-on upgrades, because people might upload the PHP files, immediately go and upload the xml, and, oops, the Install.php file never ran because it took the one cached by the opcode cache, instead of the new one. And there is no way to recover since the version number got updated in the database already and re-uploading the xml is no good.
... and many other weird scenarios as you may imagine.
I am trying to look for a workaround. My current idea is to change the name of the file for Install.php on every upgrade, with a timestamp (hence, forcing the opcode to load the file since it is "new" to it). I am also considering watermarking the files, in such a way that the installer does not proceed if the xml does not match the files in the filesystem (i.e. addon version 5 but files version 4)
Or, I could be evil and just call accelerator_reset(); and apc_clear_cache(); and clear all the caches for the server (actually, I think it would be nice if XF did this by default on an add-on install or upgrade)
Because of the new Zend Optimizer, and APC, the server does not check PHP files every time. This means that even if the person uploaded a new PHP file, it might be cached by the opcode cache, and it will not be refreshed until a minute later.
This is ESPECIALLY relevant on add-on upgrades, because people might upload the PHP files, immediately go and upload the xml, and, oops, the Install.php file never ran because it took the one cached by the opcode cache, instead of the new one. And there is no way to recover since the version number got updated in the database already and re-uploading the xml is no good.
... and many other weird scenarios as you may imagine.
I am trying to look for a workaround. My current idea is to change the name of the file for Install.php on every upgrade, with a timestamp (hence, forcing the opcode to load the file since it is "new" to it). I am also considering watermarking the files, in such a way that the installer does not proceed if the xml does not match the files in the filesystem (i.e. addon version 5 but files version 4)
Or, I could be evil and just call accelerator_reset(); and apc_clear_cache(); and clear all the caches for the server (actually, I think it would be nice if XF did this by default on an add-on install or upgrade)