Commandline upgrade of plugins?

Hi @stuart.yeates,

Thanks for your post. There is kind of a way to install plugins via CLI, it does involve interacting with the database though. One of my colleague outlines it in this post.:

Hi everyone,

There already is a way to install a plugin via the command line, with the installPluginVersion.php CLI tool that comes with OJS. It can be used like:

php lib/pkp/tools/installPluginVersion.php path/to/plugin/version.xml

To actually continue with enabling the plugin, you’d need to set the enabled plugin setting in the plugin_settings table to 1 for the journal_id in question. Some plugin categories have a setEnabled method that you can use for this, but most notably the Generic plugin does not. You may need to wrap the plugin installer with a bit of code that fetches your journal ids in the installation and then updates this value. You could probably do this with a series of MySQL REPLACE statements, which would create the record if it did not already exist or update it if it did.

Best
Jason

Even still, there is an inherent risk to updating all plugins at once.

With respect to your point about:

From a testing point of view, it would be very useful if the OJS upgrade script had a mode that upgraded all the plugins to their latest versions.

As it stands, this would be fairly tricky because many plugins (a number of which are third-party developed and not developed by PKP) are not always deemed compatible with a given release of OJS. For example, in the coming weeks we will likely be releasing version 3.4. We will have tested a number of plugins against 3.4 as part of this, but there will be a number that will not yet be compatible (it would be up for those responsible for their development to test them and ensure their compatibility). So to upgrade all plugins at once would mean a lot of plugins that wouldn’t be compatible with a given release and this could spell problems for running one’s OJS install. One of the advantages, while slow, that upgrading via the GUI provides (and which is why we strongly encourage installing and upgrading via this method) is that it ensures the checking of compatibility of the plugins prior to installing/upgrading. This is explored in our Plugin Inventory guide: https://docs.pkp.sfu.ca/plugin-inventory/en/ (and the compatibility checker included in here can be useful as well)

Your suggestion around a CLI utility is a good point and maybe things like incompatibility checks could be taken into account for something like this. What you might want to do is start a new “Feature Request” in that category here on the forum and our developers would discuss that with you there.

-Roger
PKP Team

2 Likes