Drupal 11 compatibility

Created on 12 May 2024, 8 months ago
Updated 27 July 2024, 5 months ago

I'm not a coder myself, but maybe somebody with some extra spare time can have a look at the following upgrade status output to make the module work with drupal 11.

Problem/Motivation

The module is not ready for drupal 11. I ran upgrade_status on the module with the following results:

================================================================================
Flag,  8.x-4.0-beta4
Scanned on zo 05/12/2024 - 14:22

FILE:
\flag\src\Controller\FlagListBuilder.php

STATUS         LINE                           MESSAGE
--------------------------------------------------------------------------------
Fix later      53   Call to deprecated function user_roles(). Deprecated in
                    drupal:10.2.0 and is removed from drupal:11.0.0. Use
                    Drupal\user\Entity\Role::loadMultiple() and, if necessary,
                    an inline implementation instead.
--------------------------------------------------------------------------------

FILE: \flag\src\Form\FlagFormBase.php

STATUS         LINE                           MESSAGE
--------------------------------------------------------------------------------
Fix later      350  Call to deprecated function user_roles(). Deprecated in
                    drupal:10.2.0 and is removed from drupal:11.0.0. Use
                    Drupal\user\Entity\Role::loadMultiple() and, if necessary,
                    an inline implementation instead.
--------------------------------------------------------------------------------

FILE:
\flag\src\Plugin\views\relationship\FlagViewsRelationship.php

STATUS         LINE                           MESSAGE
--------------------------------------------------------------------------------
Fix later      148  Call to deprecated function user_roles(). Deprecated in
                    drupal:10.2.0 and is removed from drupal:11.0.0. Use
                    Drupal\user\Entity\Role::loadMultiple() and, if necessary,
                    an inline implementation instead.
--------------------------------------------------------------------------------

FILE:
\flag\tests\src\Functional\AdminUITest.php

STATUS         LINE                           MESSAGE
--------------------------------------------------------------------------------
Check manually 188  Relying on entity queries to check access by default is
                    deprecated in drupal:9.2.0 and an error will be thrown from
                    drupal:10.0.0. Call
                    \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with
                    TRUE or FALSE to specify whether access should be checked.
--------------------------------------------------------------------------------
Check manually 204  Relying on entity queries to check access by default is
                    deprecated in drupal:9.2.0 and an error will be thrown from
                    drupal:10.0.0. Call
                    \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with
                    TRUE or FALSE to specify whether access should be checked.
--------------------------------------------------------------------------------

FILE: modules/contrib/flag/flag.info.yml

STATUS         LINE                           MESSAGE
--------------------------------------------------------------------------------
Check manually 3    Value of core_version_requirement: ^9.1 || ^10 is not
                    compatible with the next major version of Drupal core. See
                    https://drupal.org/node/3070687.
--------------------------------------------------------------------------------

FILE: modules/contrib/flag/modules/flag_bookmark/flag_bookmark.info.yml

STATUS         LINE                           MESSAGE
--------------------------------------------------------------------------------
Check manually 3    Value of core_version_requirement: ^9.1 || ^10 is not
                    compatible with the next major version of Drupal core. See
                    https://drupal.org/node/3070687.
--------------------------------------------------------------------------------

FILE: modules/contrib/flag/modules/flag_count/flag_count.info.yml

STATUS         LINE                           MESSAGE
--------------------------------------------------------------------------------
Check manually 3    Value of core_version_requirement: ^9.1 || ^10 is not
                    compatible with the next major version of Drupal core. See
                    https://drupal.org/node/3070687.
--------------------------------------------------------------------------------

FILE: modules/contrib/flag/modules/flag_follower/flag_follower.info.yml

STATUS         LINE                           MESSAGE
--------------------------------------------------------------------------------
Check manually 3    Value of core_version_requirement: ^9.1 || ^10 is not
                    compatible with the next major version of Drupal core. See
                    https://drupal.org/node/3070687.
--------------------------------------------------------------------------------

Proposed resolution

Fix these small problems so that the module can be used on drupal 11 installs.

๐Ÿ“Œ Task
Status

Fixed

Version

4.0

Component

Flag core

Created by

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

Merge Requests

Comments & Activities

  • Issue created by @demon326
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom aaron.ferris

    aaron.ferris โ†’ made their first commit to this issueโ€™s fork.

  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update 8 months ago
    Waiting for branch to pass
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom aaron.ferris

    Had an initial stab at this, where the user_roles function has been replaced it seems to be working the same way, needs more testing.

  • Pipeline finished with Failed
    8 months ago
    Total: 171s
    #171098
  • nisha_j โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia PrabuEla chennai
  • Assigned to PrabuEla
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia PrabuEla chennai
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia PrabuEla chennai

    Hi @aaron.ferris

    I have switched to your branch and executed upgrade status scan once again. I found some issue in the scan. Attaching below. Please correct me if I am wrong.

    CONTRIBUTED PROJECTS
    --------------------------------------------------------------------------------
    Flag
    Scanned on Tue, 05/14/2024 - 08:41.

    3 warnings found.

    web/modules/contrib/flag/src/Plugin/views/relationship/FlagViewsRelationship.php:
    +-----------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | status | line | message |
    +-----------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Fix
    later | 148 | Call to deprecated function user_roles(). Deprecated in
    drupal:10.2.0 and is removed from drupal:11.0.0. Use
    Drupal\user\Entity\Role::loadMultiple() and, if necessary,
    an inline implementation instead.
    |
    +-----------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    web/modules/contrib/flag/tests/src/Functional/AdminUITest.php:
    +----------------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | status | line | message |
    +----------------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Check
    manually | 188 | Relying on entity queries to check access by default is
    deprecated in drupal:9.2.0 and an error will be thrown from
    drupal:10.0.0. Call
    \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with
    TRUE or FALSE to specify whether access should be checked.
    |
    | Check
    manually | 204 | Relying on entity queries to check access by default is
    deprecated in drupal:9.2.0 and an error will be thrown from
    drupal:10.0.0. Call
    \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with
    TRUE or FALSE to specify whether access should be checked.
    |
    +----------------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

  • Issue was unassigned.
  • Status changed to Needs work 8 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia PrabuEla chennai
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom aaron.ferris

    Hello @PrabuEla

    Thanks, yes indeed, I missed FlagViewsRelationship.php. Ill check the other complaints.

  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update 8 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    8 months ago
    Total: 207s
    #172426
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update 8 months ago
    Waiting for branch to pass
  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland berdir Switzerland

    Left some comments. This should opt in to NEXT_MAJOR testing so we can verify the tests actually work on D11.

  • Pipeline finished with Failed
    8 months ago
    Total: 159s
    #172439
  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update 8 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    8 months ago
    #172442
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

    samit.310@gmail.com โ†’ made their first commit to this issueโ€™s fork.

  • Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update 7 months ago
    Waiting for branch to pass
  • Pipeline finished with Success
    7 months ago
    Total: 247s
    #192386
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

    samit.310@gmail.com โ†’ changed the visibility of the branch 3446713-drupal-11-compatibility to hidden.

  • Status changed to Needs review 7 months ago
  • Pipeline finished with Skipped
    6 months ago
    #223527
  • Status changed to Fixed 6 months ago
  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland berdir Switzerland

    All tests are passing except ๐Ÿ“Œ FlagFollowerUITest failing since new access policy was committed to core Active and that's failing already on HEAD and fails on all branches.

    Not sure how this ended up with so many different branches and merge requests, but *shrug*.

    Merged.

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

Production build 0.71.5 2024