====== plugins_state.json - Monitor plugin installations, updates, uninstalls ====== == LoxBerry Compatibility == This feature is available starting with LoxBerry 2.0. Set your MINLB version in your plugin.cfg. If you need to monitor if any plugin is installed, updated or uninstalled from within your plugin, you should not permanently read the plugindatabase.json file from sd card. Instead, read the following file from ram disk, that LoxBerry automatically updates on install, update and uninstall of a plugin: ==== Location of plugins_state.json ==== |Default installation |''%%/opt/loxberry/log/system_tmpfs/plugins_state.json%%'' | |Using LoxBerry::System |$lbstmpfslogdir/''%%plugins_state.json%%'' ($lbstmpfslogdir is a global variable) | |Using loxberry_system.php|''%%LBSTMPFSLOGDIR/plugins_state.json%%'' (LBSTMPFSLOGDIR is a global constant) | |Using other languages |Read the OS environment variable ''%%$LBSTMPFSLOG%%''\\ ''%%$LBSTMPFSLOG/%%''''%%plugins_state.json%%''| ==== Content ==== As the file is very small and stored on the ramdisk, it has little impact to check the file and content. Only installation, update and uninstall is tracked. Changes of e.g. the loglevel is not tracked. * As the file is stored on ramdisk, after a reboot the file might not exist → Handle this in your code * Any key might not exist if that event never happened → Handle this in your code * All attributes store an Unix epoch timestamp. ^Attribute ^Description ^ |db_updated |Epoch of the last happened event. It updates on any install, update, uninstall | |last_plugin_install |Epoch when a plugin was newly installed. The timestamp is not updated on an update. | |last_plugin_update |Epoch when a plugin was last updated. The timestamp is not updated on a new installation.| |last_plugin_uninstall|Epoch when a plugin was uninstalled. | Keep in mind, that the file itself, or any of the attributes, may not exist. **plugins_state.json** { "db_updated" : 1568578574, "last_plugin_install" : 1568577574, "last_plugin_uninstall" : 1568578574, "last_plugin_update" : 1568578484 }