Add Drupal 10 compatibility to Matomo reporting API

Created on 11 January 2022, almost 3 years ago
Updated 26 January 2024, 11 months ago

Problem/Motivation

Currently, you can't install Matomo reporting API in a Drupal 10 installation.

Steps to reproduce

Try to install the module in Drupal 10 with Composer, and see that it fails:

$ composer require -n drupal/matomo_reporting_api
[...]
  Problem 1
    - Root composer.json requires drupal/matomo_reporting_api ^2.4 -> satisfiable by drupal/matomo_reporting_api[2.4.0, 2.x-dev].
    - drupal/matomo_reporting_api[2.4.0, ..., 2.x-dev] require drupal/core ^8 || ^9 -> found drupal/core[8.0.0-beta6, ..., 8.9.x-dev, 9.0.0-alpha1, ..., 9.4.x-dev] but the package is fixed to 10.0.x-dev (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Proposed resolution

Add Drupal 10 under core_version_requirement in the matomo_reporting_api.info.yml file.

Remaining tasks

  • Fix PHPUnit test errors and self deprecation notices:
    $ lando phpunit --list-groups
    PHP Fatal error:  Declaration of Drupal\Tests\matomo_reporting_api\Kernel\AccessDeniedTest::setUp() must be compatible with Drupal\KernelTests\KernelTestBase::setUp(): void in /app/web/modules/contrib/matomo_reporting_api/tests/src/Kernel/AccessDeniedTest.php on line 29
    
Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

🇩🇰Denmark ressa Copenhagen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • @shivam_tiwari opened merge request.
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • 🇧🇬Bulgaria pfrenssen Sofia

    Thanks for working on this! I am not using this module any more but I had a quick look. If anyone wants to volunteer as a maintainer then please file an application :)

    This still needs work:

    1. Can we please keep the work limited to one merge request so that in the very little spare time I can spend on this module I don't need to waste it looking in two different places?
    2. The requirements from the issue summary are not met: "Fix PHPUnit test errors and self deprecation notices"
    3. The tests are failing due to composer related problems.
  • 🇩🇰Denmark ressa Copenhagen

    Thanks @pfrenssen!

    @shivam_tiwari: You should be able to carry on working on other people's MR's such as MR4, as far as I understand it ... Anyway, I have closed MR4 now, so we only have one branch and MR to keep track of.

  • 🇪🇸Spain idiaz.roncero Madrid

    I'm sad to say that this module might have some problems porting to D10.

    As far as I can tell, the module depends on pfrenssen/matomo-reporting-api, which seems to be rather stale (last commit is 5 years old).

    This library depends on "guzzlehttp/guzzle": "~6.0", which worked under Drupal 9 but won't work on D10 as the core requirements for guzzle is above 7.x.

    Composer won't allow to install an outdated dependency and it seems we can't count on pfrenssen/matomo-reporting-api being updated to support guzzle^7.x

  • 🇳🇱Netherlands roaldnel

    I just encountered the same problem as idiaz.roncero above regarding guzzle. Is there a possibility that this could be fixed?

  • 🇧🇬Bulgaria pfrenssen Sofia

    Composer won't allow to install an outdated dependency and it seems we can't count on pfrenssen/matomo-reporting-api being updated to support guzzle^7.x

    There is a PR already started, but the remarks have not been addressed. Feel free to continue the work: https://github.com/pfrenssen/matomo-reporting-api/pull/9

  • 🇪🇸Spain idiaz.roncero Madrid

    Oh sorry, didn't realize the PR and I thought it was unmaintained.

  • 🇧🇬Bulgaria pfrenssen Sofia

    No worries! It is still maintained but the projects I am involved with at the moment are not using Matomo so my focus is elsewhere. I can review MRs.

    If anyone wants to help out to co-maintain the project here and/or on Github that would be very welcome!

  • miiimooo Europe

    @pfrensen if you can add me as a co-maintainer I can dedicate some time to this since we are using this module

  • 🇳🇱Netherlands Johan den Hollander

    We are using the MR from here in a custom module for now.
    https://github.com/pfrenssen/matomo-reporting-api/pull/12

    If any of those MR's is accepted we can move forward here too!

  • 🇧🇬Bulgaria pfrenssen Sofia

    @miiimooo thanks for volunteering! I have added you as a co-maintainer and sent an invite to get push access on the Github library.

    @johan-den-hollander if you want I can invite you to the Github repo so you can accept MRs there. Can you let me know your username on Github?

  • Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
  • @miiimooo opened merge request.
  • Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
  • Status changed to Needs review about 1 year ago
  • miiimooo Europe

    The MR fixes the D10 `core_version_requirement` and `phpunit --list-groups` but not the tests. The deprecation of the at() (https://github.com/sebastianbergmann/phpunit/issues/4297) looks tricky to fix. But maybe this is good enough as it is to go into 2.x-dev and solve the tests separately (see also #3217717: Replace usages of the at() matcher, which is deprecated ), automated tests are broken as it stands with the old code base, not sure what the problem is there https://www.drupal.org/pift-ci-job/2776370

    I'll wait a little while for objections to merging MR6 and splitting fixing the unit tests in case it'll break in D10 sites.

    In a more daring proposal, I am thinking of moving the code from the separately pfrenssen/matomo-reporting-api into the Drupal module, mainly to reduce maintenance and complexity. I can't see that the lib is used in any other project.

  • 🇳🇱Netherlands Johan den Hollander

    In a more daring proposal, I am thinking of moving the code from the separate dependency pfrenssen/matomo-reporting-api into the Drupal module, mainly to reduce maintenance and complexity. I can't see that the lib is used in any other project.

    I have no objection to this at all! And if anyone depends on the github repo they are free to fork it as well.

  • Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
  • Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
  • miiimooo Europe

    ^^^ this commit 3b9109d7 shows what this would look like. I have taken it out from the MR6 though to sort one issue at the time

  • 🇳🇱Netherlands roaldnel

    Yes! miimooo, this is exactly the route I went to get this to work as a custom module for one of our projects, I think this is a great solution!

  • Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    Waiting for branch to pass
    • a2791cf5 committed on 3.0.x
      3258075-add-drupal-10: Issue #3258075 by miiimooo: Upgrade dependency on...
    • c0dc838b committed on 3.0.x
      Issue #3258075 by miiimooo: Change info files for Drupal 10...
  • miiimooo Europe

    Thanks for all the feedback.

    For now I've kept the dependency on the library. Instead I have made a new release in github release 3.0.0 and changed the dependency accordingly.

    I have rolled a new release of this module for Drupal 10 compatibility and this is ready for testing. To install use

    composer require drupal/matomo_reporting_api:3.0.x-dev
    

    This depends on Guzzle 7

    If you need to the flexibility to depend on Guzzle 6 or 7 use

    composer require drupal/matomo_reporting_api:"^2.4||3.0.x-dev"
    
  • 🇧🇬Bulgaria pfrenssen Sofia

    In a more daring proposal, I am thinking of moving the code from the separate dependency pfrenssen/matomo-reporting-api into the Drupal module, mainly to reduce maintenance and complexity. I can't see that the lib is used in any other project.

    This is fine for me, the separate library was made with the intention to make the code reusable in other non-Drupal PHP applications hosted by my previous employer, but it looks like it didn't get much traction there.

    I will add a compatible GPL licence to the original repository so that there are no legal complications.

  • 🇳🇱Netherlands batigolix Utrecht
Production build 0.71.5 2024