Skip to content

Updating Matomo core to a newer version within Matomo for WordPress

mattmary edited this page Jan 19, 2023 · 23 revisions

When there is a new release of Matomo core then we need to update the core version within Matomo for WordPress. Matomo core is embedded in the app directory of the plugin. By executing below command and following its instructions we expect files in the app directory to change as well as an assets JS file.

In below script replace:

  • $VERSION with eg 4_3_1 where the numbers represent the core version you want to update to so the branch reads eg matomo_core_4_3_1.
  • $matomoVersion with the actual Matomo version number you want to update to. This can also be for example an RC or beta release.

Follow these steps:

  • Checkout the develop branch and make sure you have the latest changes: git checkout develop && git pull
  • git checkout -b matomo_core_$VERSION develop
  • cd scripts
  • ./update-core.sh $matomoVersion
  • Ensure that the developer mode is disabled in the config.ini.php file
  • Follow the steps described in output: There are a few more commands to execute which are printed in the output of the update-core command
  • Increase the version number in matomo.php, readme.txt and update CHANGELOG.md according to the step in https://github.com/matomo-org/matomo-for-wordpress/wiki/Create-new-release#creating-a-new-release-of-our-plugin-on-the-wp-marketplace-with-code-changes
  • Also include the polyfill patching described in this section: https://github.com/matomo-org/matomo-for-wordpress/wiki/Create-new-release#patching-the-polyfills
  • Patch the Matomo release like in this PR https://github.com/matomo-org/matomo/pull/20133 if the PR has not been merged
  • Do some manual testing (check reporting UI, works etc)
    • click through all Matomo Analytics menu items in the WP Admin Dashboard and checking the UI still looks good and everything still works.
    • click through every tab if a page has multiple tabs.
    • Open the Matomo reporting UI and check this still looks ok (be good to click through few pages)
    • Open the Matomo admin UI and check this still looks ok (be good to click through few pages)
    • Open the Matomo admin UI, and check the User Opt Out page contains the [matomo_opt_out] short code
    • Most other things should be covered by automated tests.
  • Edit the file classes/WpMatomo/Db/Settings.php to add the new created tables in the app/core/Updates files.
  • Run the unit tests cases by running the command cd .. && ./vendor/bin/phpunit
  • Push the changes
    • git add app assets readme.txt matomo.php CHANGELOG.md classes/WpMatomo/Db/Settings.php
    • git commit -m 'Update Matomo core to $matomoVersion'
    • git push origin matomo_core_$VERSION
  • Create a PR
  • Add a reviewer and have the changes reviewed
  • Check the tests are green
  • Merge the PR
  • Create a release PR to merge develop into live. As name we use eg Update live for upcoming $VERSION_NUMBER release.
  • Then notify the release manager that there is a new release to merge.