How to upgrade an OJS 2 plugin to OJS 3

From PKP Wiki
Jump to: navigation, search

Upgrading a OJS 2 plugin for OJS 3 can be easy or complex, depending on the functions of the plugin. This guide describes the changes in OJS 3 in comparision to OJS 2. It gives a step by step instruction how to upgrade a plugin to OJS 3 and concludes with a checklist.

Changes in OJS 3

Upgrading OJS 2 to OJS 3 most elements remained (PHP, Smarty, JavaScript, etc.). Some basic elements were changed and need to be considered during the upgrade of a OJS 2 plugin. An incomplete overview:

  • separation of frontend and backend
  • new design elements: grids, etc.
  • new role model
  • ...

See also

How to proceed

To start upgrading a OJS 2 plugin to OJS 3 one could start with a working OJS 3 plugin - it should have similar features (settings, block plugin, etc.) to the OJS 2 plugin - and change it accordingly.

Some files can be copied from the old OJS 2 plugin into the new OJS 3 plugin without changing them:

  • index.php
  • settings.xml
  • locale

Other files need to be changed:

  • version.xml (change the version number and the date)
  • settingsForm.tpl (syntax changed here a lot, best to have a look at an existing plugin and copy stuff you need)
  • [PluginName]
  • [PluginName]

What needs to be changed at code level?

  • rename constructing functions in classes to __contruct
  • $journalId --> $contextId
  • display() --> fetch()
  • ...

Checklist for needed adaptions

  • check if third party code needs updates
  • check if the functions you are using still have the same number of parameters or less or more or different ones
  • check if sidewide is set correctly
  • ...