Once a plugin is added to a site, it is possible to enable or disable it according to user’s needs by going to the Plugin page of the site menu. In order to add a plugin to a site select the following path from the site dashboard page --> and the page opens the lightbox below, where the user can select the desired plugin from the ones available from the General section.
Once the plugin is added into the site, the user can enable and disable it according to his will. The process to enable or disable the plugin works independently from site to site.
Therefore, adding plugins will save all information into table WEB_PLUGIN typical for every site managed in Z-CMS. Such table, shown in the picture below, allows the user to perform some operations on the plugins by using the buttons on the right.
Once plugins are added to the site, the user can enable them. Enabling a plugin means installing it into the Z-CMS individual site.
Enabling a plugin
At the enabling, the program will validate at first the name of all jar files in Z-CMS lib folder (WEB-INF/lib) and then in corresponding plugin folder. Then it will compare plugin jars with Z-CMS System jars and will identify new jars. It will also compare previous versions of plugin and Z-CMS jars to identify updated jars as it is shown in the picture below where the program tells what jars are new, updated or unchanged.
It keeps information regarding all new jars and updated jars in a property file named "install_jar.properties" located inside corresponding plugin folder.
If there is any new jar or updated jar, it will request for restarting the context in confirmation box. By confirming the restart in the box shown in picture below, the program will read information from "install_jar.properties" file inside plugin folder, will copy all new jars in plugin into the Z-CMS lib folder and will copy all updated jars into Z-CMS lib folder by deleting existing jars with lower version.
After completing operations on jars, the program will read "install.properties" file for selecting keys "menu.name" and "menu.url". Then, it will change the value of the field IS_ENABLE in the Plugin table from “0” to “1”. Plugin is finally enabled.
Note: if error occurs on deleting jars from WEB-INF/lib, it will not throw exception, but it will keep information about such jars path into a property file name "execute.properties" in folder ZPlugin located in Z-CMS context. This property file will read on next context restart and delete jars on that time.
Disabling a plugin
The user can decide to disable an active plugin. Disabling a plugin means uninstalling it from a particular website. It does not delete the plugin, but only disable it from use and, in case, it allows a quick enabling without the need of adding it again.
On disabling, the program reads property file named "install_jar.properties" inside the corresponding plugin folder. Then it checks inside the property file for any new jar copied to Z-CMS lib. If any of such jars is present, it will request for restart context in a confirmation box.
By confirming, the program will read information from "install_jar.properties" file inside the plugin folder and will delete all new jars that copied at the time of enabling this plugin. After completing jar operation, it will delete the corresponding plugin menu from the left side of particular website menu.
Finally, the program will update the WEB_PLUGIN table by changing value to IS_ENABLE field from “1” to “0”. The Plugin is then disabled.
The user can also decide to remove a plugin from the site. Removing the plugin means removing it from the site section. Such plugin remains inside Z-CMS in the general section.
In order to remove a plugin, it must be previously disabled. On removing, the program will delete all information about plugin from table WEB_PLUGIN. It will not delete any file related to the plugin.
If the user wants to remove the Plugin from Z-CMS should go to the General part.