Automated Drupal 10 compatibility fixes

Created on 18 July 2022, almost 2 years ago
Updated 21 February 2024, 4 months ago

Problem/Motivation

Hello project maintainers,

This is an automated issue to help make this module compatible with Drupal 10.

To read more about this effort by the Drupal Association, please read: The project update bot is being refreshed to support Drupal 10 readiness of contributed projects

Patches will periodically be added to this issue that remove Drupal 10 deprecated API uses. To stop further patches from being posted, change the status to anything other than Active, Needs review, Needs work or Reviewed and tested by the community. Alternatively, you can remove the "ProjectUpdateBotD10" tag from the issue to stop the bot from posting updates.

The patches will be posted by the Project Update Bot official user account. This account will not receive any issue credit contributions for itself or any company.

Proposed resolution

You have a few options for how to use this issue:

  1. Accept automated patches until this issue is closed

    If this issue is left open (status of Active, Needs review, Needs work or Reviewed and tested by the community) and the "ProjectUpdateBotD10" tag is left on this issue, new patches will be posted periodically if new deprecation fixes are needed.

    As the Drupal Rector project improves and is able to fix more deprecated API uses, the patches posted here will cover more of the deprecated API uses in the module.

    Patches and/or merge requests posted by others are ignored by the bot, and general human interactions in the issue do not stop the bot from posting updates, so feel free to use this issue to refine bot patches. The bot will still post new patches then if there is a change in the new generated patch compared to the patch that the bot posted last. Those changes are then up to humans to integrate.

  2. Leave open but stop new automated patches.

    If you want to use this issue as a starting point to remove deprecated API uses but then don't want new automated patches, remove the "ProjectUpdateBotD10" tag from the issue and use it like any other issue (the status does not matter then). If you want to receive automated patches again, add back the "ProjectUpdateBotD10" tag.

  3. Close it and don't use it

    If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review, Needs work and Reviewed and tested by the community) and no more automated patches will be posted here.

    If the issue is reopened, then new automated patches will be posted.

    If you are using another issue(s) to work on Drupal 10 compatibility it would be very useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the latest patch in the comments by Project Update Bot or human contributors that made it better.
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
  3. Provide feedback about how the testing went. If you can improve the patch, post an updated patch here.

Providing feedback

If there are problems with one of the patches posted by the Project Update Bot , such as it does not correctly replace a deprecation, you can file an issue in the Drupal Rector issue queue . For other issues with the bot, for instance if the issue summary created by the bot is unclear, use the Project analysis issue queue .

📌 Task
Status

Fixed

Version

1.0

Component

Code

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.

  • Applied patch #7 and tested in Drupal 9.5.7 and D 10 . The functionality is working as expected , attached screenshot for reference. Got some deprecated errors related to Call to Undefined method etc. Resolved that issue in my patch and tested.
    Rest of the issue are ignorable for which attached in screenshot.

  • 🇮🇳India shashank5563 New Delhi

    I checked the automated patch #2 works well with drupal 9. But, This patch does not update the info.yml file for Drupal 10 compatibility.
    I have updated the info.yml after that i install this module and found it is working fine with Drupal 10.

    Testing Steps:

    PHP Version: 8.1.16
    Database: 10.4.28-MariaDB-1:10.4.28+maria~ubu2004-log
    Drupal Version: 10.0.7
    Module Branch: 8.x-1.x

    1. Install Drupal 10
    2. Install the Node view count module module (8.x-1.x) on Drupal 10
    3. Apply patch in the Node view count module
    4. Enable the module and reload the page
    5. Now this module is enabled and also install successfully

    The module has been successfully installed on Drupal 10, I am moving it to RTBC.

    Thanks!

  • Status changed to RTBC about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇷🇺Russia adci_contributor

    Hello shashank5563. I checked your patch for compatibility with Drupal 10. The module turned on at first glance without problems, but I tried to run the tests, and they all failed. I guess before creating a new release we should fix the tests first and after that check module codebase manually.

  • 🇮🇳India shashank5563 New Delhi

    @adci_contributor, Some phpunit test is not working on my local. So, I need to first fix the my phpunit test on local after that i will look these issue.

    Thanks

  • First commit to issue fork.
  • @shivam_tiwari opened merge request.
  • Status changed to Needs review about 1 year ago
  • First commit to issue fork.
  • First commit to issue fork.
  • 🇺🇦Ukraine Taran2L Lviv

    The MR has all the changes required to make it 9.5 and 10 compatible + tests are passing now (please enable testing on drupal.org, so we can run them)

  • @Taran2L https://git.drupalcode.org/project/nodeviewcount/-/merge_requests/2/diff... removes the composer.json file which is needed to directly include the issue fork in a project's root composer.json.

    Was there a reason for dropping the composer.json? If not, please bring it back. Thanks.

  • 🇺🇦Ukraine Taran2L Lviv

    @lelkneralfaro, composer.json is not needed unless module has dependencies, which is not the case for this module, in case you want to use it in D10 project, go with the composer lenient plugin, see https://www.drupal.org/docs/develop/using-composer/using-drupals-lenient...

    Also MR is open to anyone to change, like me. So, I (probably) broke your setup :) Lenient plugin + static patch (I mean actual file, not a dynamic MR diff) is the way to go

    @AardWolf, let me check

  • Status changed to RTBC 8 months ago
  • 🇮🇳India Bushra Shaikh

    I applied MR !2 this works for Drupal 9.5.10 and Drupal 10.0. and 10.0.1
    Screenshots of the compatibility on 9.5 have been attached for reference:

    Can be move to RTBC+1

  • 🇺🇦Ukraine ankondrat4

    Hello.

    After changes in MR from 14.11.2023 by Roman Pask, MR !2 doesn't apply as expected. Only applied from commit https://git.drupalcode.org/project/nodeviewcount/-/merge_requests/2/diff...

  • Status changed to Needs review 8 months ago
  • 🇺🇦Ukraine Taran2L Lviv

    patch might not apply for the alpha version, have you tried dev version?

    also, the last patch has renames, patches with renames do not work on Mac usually, see https://github.com/cweagans/composer-patches/issues/172#issuecomment-470...

  • 🇺🇦Ukraine ankondrat4

    Patch was failed with DEV version too. I have tested on Ubuntu, not on Mac.

  • 🇺🇦Ukraine Taran2L Lviv

    Somehow, it works for me (and it applies as MR shows)

    Gathering patches for root package.
    Gathering patches for dependencies. This might take a minute.
      - Installing drupal/nodeviewcount (dev-1.x 2583489): Cloning 2583489107 from cache
      - Applying patches for drupal/nodeviewcount
        https://git.drupalcode.org/project/nodeviewcount/-/merge_requests/2.diff (D10 - MR)
    
    

    Maybe you are running old(er) patch utility?

  • First commit to issue fork.
  • 🇮🇳India ash2303

    Please DO NOT remove files without testing.
    composer.json is required until we are using fork as project repo.

  • Status changed to RTBC 7 months ago
  • 🇺🇦Ukraine ankondrat4

    Hello.
    I could apply MR2 as patch only to DEV version of module.
    +1RTBC

    Gathering patches for dependencies. This might take a minute.
      - Installing drupal/nodeviewcount (dev-1.x 2583489): Cloning 2583489107 from cache
      - Applying patches for drupal/nodeviewcount
        https://git.drupalcode.org/project/nodeviewcount/-/merge_requests/2.diff (Automated Drupal 10 compatibility fixes)
    
    Generating optimized autoload files
    
    
  • 🇺🇸United States kerasai

    This patch business is a bit baffling.

    I'm running a Lando "drupal9" recipe on Ubuntu. The patch generated from the MR wouldn't apply to either the alpha2 or dev releases. No particular error or indication of what caused the issue, just "could not apply patch".

    Assuming the composer patches use the underlying OS patch functionality, I am running the latest version of GNU patch 2.7.6. I've never had an issue such as this before.

    Also note, the alpha2 and dev releases reference the same commit so I'd expect them to behave the same. If they do behave differently (for me they both failed) perhaps this is indicative of something going on with the Drupal.org packaging. Perhaps if adds a composer.json etc. to tagged releases and not for dev releases? I don't know that to be the case, just spitballing.

    Solution

    Not sure if there is a way to do this using the MR or some other functionality within the GitLab, but I ended up pulling the repo locally and made a patch from one of the previous commits.

    git diff origin/8.x-1.x...42ca8c7e033607336b2cfcb1262815bfb1c06f99 > nodeviewcount-d10_compatibility.patch

  • Status changed to Fixed 5 months ago
  • 🇷🇺Russia adci_contributor

    Thanks everyone for your help!

    The latest update is based on a patch from the Project Update Bot + some fixes have been added for tests, etc. Hope this will be a good place to start.
    The Dev version should now support Drupal 10. Tests will work correctly starting from Drupal 9.3+

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

Production build 0.69.0 2024