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.

Issue fork flag-3446713

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:

Comments

demon326 created an issue. See original summary.

aaron.ferris made their first commit to this issue’s fork.

aaron.ferris’s picture

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.

Any BC concerns here?

nisha_j made their first commit to this issue’s fork.

prabuela’s picture

prabuela’s picture

Assigned: Unassigned » prabuela
prabuela’s picture

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.
|
+----------------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

prabuela’s picture

Assigned: prabuela » Unassigned
Status: Active » Needs work
aaron.ferris’s picture

Hello @PrabuEla

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

berdir’s picture

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

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

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

samitk’s picture

Status: Needs work » Needs review
solideogloria’s picture

Version: 8.x-4.0-beta4 » 8.x-4.x-dev
solideogloria’s picture

Category: Feature request » Task

berdir’s picture

Status: Needs review » Fixed

All tests are passing except #3461212: FlagFollowerUITest failing since new access policy was committed to core 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.

Status: Fixed » Closed (fixed)

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