Upgrade_status complains about entityQuery

Created on 28 July 2023, 11 months ago
Updated 23 August 2023, 10 months ago

Problem/Motivation

Upgrading to Drupal 10.
Upgrade Status module gives following complaint:

web/modules/contrib/social_auth/social_auth.post_update.php
Line 15
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.

web/modules/contrib/social_auth/social_auth.post_update.php
Line 19
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.

I'd like the report to be clean. I'm not 100% sure if this an actual problem, of false positive.

Steps to reproduce

Install Status Update module, and Social Auth module v4.0.1.
Then scan the code at /admin/reports/upgrade-status
See that there are two issues reported.

Proposed resolution

Before:

/* L15 */ $sandbox['total'] = $storage->getQuery()->count()->execute();
/* L19 */ $ids = $storage->getQuery()->range($sandbox['progress'], 50)->execute();

After:

/* L15 */ $sandbox['total'] = $storage->getQuery()->accessCheck(FALSE)->count()->execute();
/* L19 */ $ids = $storage->getQuery()->checkAccess(FALSE)->range($sandbox['progress'], 50)->execute();

Remaining tasks

If the fix is valid, then commit.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

🇪🇪Estonia ragnarkurm

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

Comments & Activities

Production build 0.69.0 2024