Following is the deprecation errors other than covered by rector.

D:\Xampp\htdocs\drupal-8.8.5\modules\contrib\h5p\h5p.install 259 Call to deprecated function file_delete(). Deprecated in drupal:8.7.0 and is removed from drupal:9.0.0.

D:\Xampp\htdocs\drupal-8.8.5\modules\contrib\h5p\h5p.install 844 Call to deprecated function db_field_exists(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.

D:\Xampp\htdocs\drupal-8.8.5\modules\contrib\h5p\h5p.install 845 Call to deprecated function db_add_field(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.

D:\Xampp\htdocs\drupal-8.8.5\modules\contrib\h5p\h5p.install 850 Call to deprecated function db_field_exists(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.

D:\Xampp\htdocs\drupal-8.8.5\modules\contrib\h5p\h5p.install 851 Call to deprecated function db_add_field(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.

D:\Xampp\htdocs\drupal-8.8.5\modules\contrib\h5p\src\H5PDrupal\H5PDrupal.php 371 Call to deprecated function drupal_get_messages(). Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0.

D:\Xampp\htdocs\drupal-8.8.5\modules\contrib\h5p\src\H5PDrupal\H5PDrupal.php 759 Call to deprecated function db_driver(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.

D:\Xampp\htdocs\drupal-8.8.5\modules\contrib\h5p\src\H5PDrupal\H5PDrupal.php 769 Call to deprecated function db_driver(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.

modules/contrib/h5p/h5p.info.yml 0 Add core_version_requirement: ^8 || ^9 to modules/contrib/h5p/h5p.info.yml to designate that the module is compatible with Drupal 9. See https://drupal.org/node/3070687.

modules/contrib/h5p/modules/h5peditor/h5peditor.info.yml 0 Add core_version_requirement: ^8 || ^9 to modules/contrib/h5p/modules/h5peditor/h5peditor.info.yml to designate that the module is compatible with Drupal 9. See https://drupal.org/node/3070687.

D:\Xampp\htdocs\drupal-8.8.5\modules\contrib\h5p\src\H5PDrupal\H5PDrupal.php 266 Call to deprecated function system_get_info(). Deprecated in drupal:8.8.0 and is removed from drupal:9.0.0.

Issue fork h5p-3150110

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

meet_bhanvadia created an issue. See original summary.

meet_bhanvadia’s picture

Issue summary: View changes
meet_bhanvadia’s picture

Hi All,

This patch will solve all the deprecated issue related to drupal 9 compatibility for module.

Please review

meet_bhanvadia’s picture

Status: Active » Needs review
kolesnikoff’s picture

Fixed the fatal error introduced into #3. Tested and cleaned up Drupal Rector notices.

Please review and test.

kolesnikoff’s picture

Fixed typo in 'extension.list.module' service name.

kolesnikoff’s picture

Re-rolled patch to apply properly.

heddn’s picture

A pure code review, the changes included make sense in #7. Still need to get a D9 site running with this and do some manual regression testing. But a big +1 vote of confidence.

rudraksh_98’s picture

Status: Needs review » Reviewed & tested by the community

Patch #7 working fine for me
tested it on D8 & D9.

ravimalviya2000’s picture

I have review and tested for patch #7.Working fine for me.

bob.hinrichs’s picture

Great to see this is happening. What is the timeline to merging to get a D9 compatibility for the composer package? This module is holding us back.

pjotr.savitski’s picture

Drupal-check gave one more deprecation when using version 9.1.4

 ------ ------------------------------------------------------------------ 
  Line   src/Event/FinishedEvent.php                                       
 ------ ------------------------------------------------------------------ 
  10     Class Drupal\h5p\Event\FinishedEvent extends deprecated class     
         Symfony\Component\EventDispatcher\Event:                          
         since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event"  
         instead                                                           
 ------ ------------------------------------------------------------------ 

Daniel Kulbe made their first commit to this issue’s fork.

geufroi’s picture

hello there,
I would like to install H5P on a 9.14 drupal version
I hace seen the different patches but I don't know how to apply them, if in first place composer doesn't allow to install the module.
here is the message i get from composer

Problem 1
- drupal/h5p[1.0.0-rc1, ..., 1.0.0-rc17] require drupal/core ^8 -> found drupal/core[8.0.0, ..., 8.9.13] but the package is fixed to 9.1.5 (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.
- Root composer.json requires drupal/h5p ^1.0@RC -> satisfiable by drupal/h5p[1.0.0-rc1, ..., 1.0.0-rc17].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

can please suggest what to do ? thanks very much for your support ;-)

pjotr.savitski’s picture

@geufroi This is not all that complicated, but is a bit messy.

I've found two different ways to accomplish that when I was checking out patch number seven:

  1. You install the h5p module manually, no composer involved. Then you move into the directory of that module and run the git init; git add --all; git commit -m "Added all h5p package content" command. Once that is done, you can then apply the patch you want by runing git apply THE_PATH_YOU_WANT
  2. Define a new repository for H5P module and install the patched version. This one is a bit more complicated and will require crating a newly patched source of code for each new release of original H5P module. It allow you to use composer, apply any additional patched that are not directly related to Drupal 9 compatibility.

Both solutions have their own issues. The second one requires more effort and could be considered messier.

This is how I have managed to get the solution number two working.

Change repositories part of composer.json file to include a special repository that will override H5P.

"repositories": [
        {
            "type" : "package",
            "package": {
                "name" : "drupal/h5p",
                "version": "1.0",
                "type": "drupal-module",
                "source": {
                    "url" : "/some/path/to/git/repository",
                    "type": "git",
                    "reference" : "master"
                }
            }
        },
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],

Please note that I have defined a version 1.0 instead of RC17 to make sure that my override is used. You might probably be able to get it running with defining it as development release with something like RC17-D9 as a version. I have not tried, but that would be a more reasonable approach.

I have used the Git repository described in approach number one with just loading the current release package, initialising new repository, committing all the files and applying the patch. You could fork the repository on GitLab or anywhere else and use one the branch you want.

Last step was to require the H5P override version.

"drupal/h5p": "^1.0",

Not sure if I used the composer require for that or just added it directly into the corresponding file.

The end result should be a working Drupal 9 instance with patched H5P module.

Please note that botch approaches require you to manually apply the patch and make the module compatible with Drupal 9 before doing anything. Each new release would require manual labor to repeat the process. NB! Do not define any meaningful versions that could be later on released by the module authors. Drupal does not care too much about that, but that will surely create confusion on composer side and require a lot of messing around and fixing things.

As for the best solution, then it would be for the module authors to accept the patched code and release a new version. We've made an effort to contact them, but there have not been any response so far. I've checked all the code from the patch number 7 and did not see anything unusual or problematic. Some testing with local instance and already existing materials did not produce any issues apart from a few deprecation warnings that are located in the code of dependencies and are easily fixable by applying a patch.

Hope that solves your issue and have fun.

geufroi’s picture

whaoo ! This is a very long post you did and I am very grateful for your time and energy. I will give a try for sure.
cheers !

Daniel Kulbe’s picture

Your composer.json should look like this, if you want to use this issue branch:

{
    ...
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8",
            "exclude": [
                "drupal/h5p",
            ]
        },
        {
            "type": "git",
            "url": "https://git.drupalcode.org/issue/h5p-3150110.git"
        },
        ...
    ],
    "require": {
        ...
        "drupal/h5p": "dev-3150110-drupal-9-readyness",
        ...
    }
    ...
}
MrPaulDriver’s picture

Will this recipe also work for 8.9?

jukka792’s picture

I modified the composer.json according to #18
The module was installed and works fine, but when running "drush cr", it shows this error:
PHP Fatal error: Cannot use Drupal\Core\File\FileSystemInterface as FileSystemInterface because the name is already in use in /var/www/html/sitename/web/modules/contrib/h5p/src/Form/H5PAdminSettingsForm.php on line 11

D 9.1.6

pjotr.savitski’s picture

@jukka792 I was unable to reproduce that, though I've used a branch from this issue instead https://www.drupal.org/project/h5p/issues/3210822

That one is based on h5p-rc18 that will work with php version 7.4. The difference in code should not be very substantial.

@MrPaulDriver I'm not an expert in things, though 8.9 should be quite close to 9.x, at least with all the used APIs being available. If you were asking if the patched code would work with version 8.9.x, then the answer should be - yes, it will. The API calls that needed to be replaced were deprecated a long time ago with a few minor versions being released in the meantime.

pjotr.savitski’s picture

FileSize
43.81 KB

The patch did not apply for some reason due to an issue with h5peditor.info.yml file.

error: patch failed: modules/h5peditor/h5peditor.info.yml:3
error: modules/h5peditor/h5peditor.info.yml: patch does not apply

It seems that applying the same change would have line 326 as @@ -3,5 +3,6 @@ instead of @@ -3,6 +3,7 @@.
At least that was the output of making that change manually and making a patch.

Fixed that small issue and re-uploaded the patch file. All of the changes are still the same as with patch #7.

Anaconda777’s picture

Hi,

Trying to upgrade D8.9.15 to D9.1.8
Composer update shows this:

- Can only install one of: drupal/core[9.1.x-dev, 8.9.15].
- drupal/core-recommended 9.1.x-dev requires drupal/core 9.1.x-dev -> satisfiable by drupal/core[9.1.x-dev].
- Installation request for drupal/core-recommended ^9.1.8 -> satisfiable by drupal/core-recommended[9.1.8, 9.1.x-dev, 9.2.0-alpha1, 9.2.x-dev, 9.3.x-dev].
- Installation request for drupal/h5p ^1.0@RC -> satisfiable by drupal/h5p[1.0.0-rc1, 1.0.0-rc2, 1.0.0-rc3, 1.0.0-rc4, 1.0.0-rc5, 1.0.0-rc6, 1.0.0-rc7, 1.0.0-rc8, 1.0.0-rc9, 1.0.0-rc10, 1.0.0-rc11, 1.0.0-rc12, 1.0.0-rc13, 1.0.0-rc14, 1.0.0-rc15, 1.0.0-rc16, 1.0.0-rc17, 1.0.0-rc18].

What could be the problem ? In my composer I have:
"drupal/core-recommended": "^9.1.8",
"drupal/h5p": "^1.0@RC"

pjotr.savitski’s picture

@Anaconda777 Current H5P release will not work with Drupal version 9. Please see comment #18 for instructions on how to achieve what you might want. The only way I've found is to just have a repository with patch applied and use that as a source for drupal/h5p module. This was it is sure that there are no surprises in future and repository could be updated at any time.

If you want to try it locally, then this issue has a pull request branch that could be used in conjunction with configuration from commit #18 to get the 8.x-1.0-rc18 with the patch from comment #7 applied.

I went the own repository way due to it being used in production, when it is not a good idea to use some merge request branch as a basis.

init90’s picture

One more way to install Drupal 9 compatibility patches - https://www.computerminds.co.uk/articles/apply-drupal-9-compatibility-pa...

But would be really great to see the patch commited.

8bitplateau’s picture

My composer is slightly different, this is what I have:

   "repositories": {
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8",
            "exclude": [
                "drupal/h5p"
            ]
        },
        "assets": {
            "type": "composer",
            "url": "https://asset-packagist.org"
        },
        "drupal/h5p": {
            "type": "git",
            "url": "https://git.drupalcode.org/issue/h5p-3210822.git"
        }
    },

and installed via $ composer require "drupal/h5p:dev-3210822-drupal-9-readiness"

kuhikar’s picture

I tried to apply patch: fixed.patch of #22

Executed below commands:

It is still providing the same error, please do check.

50/50 [============================] 100%

------ --------------------------------------------------------------------------------------------------------
Line src\Event\FinishedEvent.php
------ --------------------------------------------------------------------------------------------------------
10 Class Drupal\h5p\Event\FinishedEvent extends deprecated class Symfony\Component\EventDispatcher\Event:
since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead
------ --------------------------------------------------------------------------------------------------------

[ERROR] Found 1 error

I am adding patch to existing fixed.patch file. Please do check : 3150110-drupal9_deprecated_report-27.patch

Currently, we are working on D9 Website and we need to integrate h5p module of D9 Version.

baikho’s picture

kuhikar’s picture

Hello team,

Please, Is there any maintainer available to merge this PR and release D9 compatible module?

Can I get Core Committers - Release Managers role for this module?

Currently, we are working on D9 compatible website and this module needs to be updated in D9.

Please suggest.

larowlan’s picture

Can I get Core Committers - Release Managers role for this module?

I'm not a maintainer of this module, but my suggestion would be toe open a separate issue offering to be a co-maintainer and then follow the abandoned modules process

kuhikar’s picture

Hello Team,

Currently, we are migrating D8 to D9 and please help to merge patch so we will have 3.x version.

Please do check: Drupal 8 end-of-life on November 2, 2021 : https://www.drupal.org/psa-2021-2021-06-29

Kindly help us to release 3.x version.

@larowlan, thanks for the guidance.

dineshw’s picture

Hello @paalj Any luck you able to cut. new release for h5p?

bharat.kelotra’s picture

Please do check: Drupal 8 end-of-life on November 2, 2021 : https://www.drupal.org/psa-2021-2021-06-29

I need the D9 compatible version of this module and as it is not available my whole site's d9 migration is kind of blocked due to this modules update. Can we please upgrade this module so that we can have a d9 compatible version?

bob.hinrichs’s picture

Is anybody out there? I don't understand the holdup for D9? There are people in this thread begging to contribute this change for us. We need this a year ago.

andeersg’s picture

Anyone have a timeframe for when a D9-compatible release will be ready? I tested the patch from #27 and it worked for me. Even a dev-release would be nice @kuhikar.

bezlash@gmail.com’s picture

A dev release would be fantastic and much needed. Any ETA around this?

worktapper’s picture

Opigno (https://www.drupal.org/project/opigno_lms) uses H5P and is releasing on D9 this week. They've not yet responded how they are handling H5P and D9, but they had to have addressed this months ago.

pjotr.savitski’s picture

It seems that Opingo resolved that by just using the branch from an issue. More or less like this: https://git.drupalcode.org/project/opigno_lms/-/blob/3.x/composer.json#L30

NicholasS’s picture

@pjotrsavitski I see how that project is using the dev branch, but how are you guys actually using composer to install the D9 module? I have been over this article as well no luck so far. https://www.mediacurrent.com/blog/how-fix-catch-22-problem-drupal-9-fixe...

Problem 3
    - Root composer.json requires drupal/h5p dev-3150110-drupal-9-readyness, found drupal/h5p[1.0.0-alpha1, ..., 1.0.0-rc19] but it does not match the constraint.
pjotr.savitski’s picture

@NicholasS My approach is a rather strange one and does not seem like something that is meaningful. There are a few examples of using the branch created for this issue in previous comment.

My approach was to just create a standalone repository that got the 8.x-1.x branch code for the 1.0-rc19 release. Then I applied the patch 7 (with a small change to resolve one issue, please see comment #22 for details). Then I've excluded drupal/h5p from Drupal composer repository, added my own repository as a source for the module. Here is how my repositories part looks like.

"repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8",
            "exclude": [
                "drupal/h5p"
            ]
        },
        {
            "type": "git",
            "url": "https://github.com/centre-for-educational-technology/drupal-h5p.git"
        }
    ],

As I've also needed another module that depends on drupal/h5p@RC, the dev-SOMETHING version did no longer work. I've asked around on Drupal Slack and got a couple of suggestions. I've chosen the approach of tagging 1.0-rc19 release on my custom repository, which is in reality the original rc19 code + D9 patch.

This is how I required it:
"drupal/h5p": "1.0-rc19",

It seems that it would also be possible to write something like:
"drupal/h5p": "dev-3150110-drupal-9-readyness as 1.0-rc19",

I haven't tried the last one yet, but it will probably work.

What you are probably missing is the exclude part for the main drupal/h5p module so that official module repository would not be considered. I remember having a similar error before someone suggested exclusion.

I really hope that someone from Jouble will be able to patch in the D9 compatibility.

NicholasS’s picture

@pjotrsavitski thanks you are correct #18 is how it needs to be done, I was missing the repositories info. https://www.drupal.org/project/h5p/issues/3150110#comment-14025504

I could not get the alias working "drupal/h5p": "dev-3150110-drupal-9-readyness as 1.0-rc19" gave a similar error

Problem 3
    - Root composer.json requires drupal/h5p dev-3150110-drupal-9-readyness as 1.0.0-rc19, found drupal/h5p[1.0.0-alpha1, ..., 1.0.0-rc19] but it does not match the constraint.

Searching over github I have seen a few other people do what you did an fork the entire repo

kenianbei’s picture

It boggles my mind that H5P devs haven't even commented on this issue, since D8 will be unsupported in about a month. Perhaps it's time for someone to go through the abandoned module process?

Like others I just duplicated the issue fork in github and I'm using that.

catch’s picture

thomasmurphy’s picture

robcarr’s picture

Thanks Pjotr for your solution (#40) - seems to have worked fine.

Let's hope a more permanent solution is made available soon: Drupal 8 is EOL in under a week.

pjotr.savitski’s picture

There seems to be one more way for dealing with that issue without creating your own fork or using the issue specific branch, which makes sure that the patch that you have checked and reviewed will be applied.

The solution is based on the newly added lenient composer endpoint. I've followed the instructions from that page with one difference - the lenient repository is not the first one, which would make sure that it will only try to install the modules that I will explicitly add to excluded list. This will make sure that correct versions are preferred for all the packages except drupal/h5p.

NB! Please note that I've used the latest patch available to date and I'm not sure that it's the one that I've reviewed and used for my custom forked repository! Check the code before you apply any patches! Use the content of composer.json file as an example.

{
    "name": "drupal/recommended-project",
    "description": "Project template for Drupal 9 projects with a relocated document root",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "homepage": "https://www.drupal.org/project/drupal",
    "support": {
        "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
        "chat": "https://www.drupal.org/node/314178"
    },
    "repositories": {
        "0": {
            "type": "composer",
            "url": "https://packages.drupal.org/8",
            "exclude": [
                "drupal/h5p"
            ]
        },
        "lenient": {
            "type": "composer",
            "url": "https://packages.drupal.org/lenient"
        }
    },
    "require": {
        "composer/installers": "^1.9",
        "cweagans/composer-patches": "^1.7",
        "drupal/core-composer-scaffold": "^9.2",
        "drupal/core-project-message": "^9.2",
        "drupal/core-recommended": "^9.2",
        "drupal/h5p": "@RC"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "stable",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "extra": {
        "patches" : {
            "drupal/h5p": {
                "Drupal 9 Deprecated report": "https://www.drupal.org/files/issues/2021-05-28/3150110-drupal9_deprecated_report-27.patch"
            }
        },
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "installer-paths": {
            "web/core": [
                "type:drupal-core"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library"
            ],
            "web/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "web/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "web/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ],
            "web/modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "web/profiles/custom/{$name}": [
                "type:drupal-custom-profile"
            ],
            "web/themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ]
        },
        "drupal-core-project-message": {
            "include-keys": [
                "homepage",
                "support"
            ],
            "post-create-project-cmd-message": [
                "<bg=blue;fg=white>                                                         </>",
                "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",
                "  * Install the site: https://www.drupal.org/docs/8/install",
                "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                "  * Get support: https://www.drupal.org/support",
                "  * Get involved with the Drupal community:",
                "      https://www.drupal.org/getting-involved",
                "  * Remove the plugin that prints this message:",
                "      composer remove drupal/core-project-message"
            ]
        }
    }
}

The end result is that latest version of H5P Release Candidate is installed, patch will be applied and all will work as expected. The composer command will issue a warning text, but that is not should not be such a big deal.

One possible issue I see is that a new version of H5P module is released that would no longer allow the patch to be applied. That will probably throw an error on running composer install and/or composer update commands. Maybe that is not a big deal as it will still be required to check if there is a D9 compatible version of the module available and this hack is no longer needed.

robcarr’s picture

Solution at #46 works well for me. Thanks again Pjotr - really appreciated.

Apparently code sprint planned for D9 module by H5P project. Not sure of timescales though.

vegardjo’s picture

Status: Reviewed & tested by the community » Fixed

These changes, bar one, seems to be fixed in the 2.* version of the module. There is a new patch that is needed for this, which can be found in #3266331: Use of deprecated function

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.