Problem/Motivation

It makes sense to show this on the status page:
Screenshot of the status page

But do we need to warn every time on drush updb if that status is available?
Screenshot of output when running drush updb

This seems to have started in 11.2 in ddev with MariaDB 10.6 (which supports JSON) - ie, Database::getConnection()->hasJson() returns TRUE.

Steps to reproduce

Drupal 11.2, DDEV MariaDB 10.6, run drush updb.

Proposed resolution

Show the warning only if JSON is unavailable when running updates.

Remaining tasks

Merge request

User interface changes

No JSON warning shown when running updates when JSON is supported

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Issue fork drupal-3532243

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

scott_euser created an issue. See original summary.

scott_euser’s picture

Issue summary: View changes
StatusFileSize
new15.72 KB
scott_euser’s picture

Assigned: scott_euser » Unassigned
Status: Active » Needs review

cilefen’s picture

Version: 11.2.x-dev » 11.x-dev
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

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

mstrelan’s picture

Rebased against 11.x but now the MR needs to be updated to point to that branch, which I can't do.

The logic is a bit confusing though with the multiple conditions and overrides, I'm sure it could be refactored to be easier to read.

tjtj’s picture

I see this too and am confused about what to do.

scott_euser’s picture

Re #8 whoops sorry retargeted branch to 11x

Re #9 do you mean what to do if your database doesn't support json? You need to make sure your database is one the supported ones at https://www.drupal.org/docs/getting-started/system-requirements/database...

Leaving as needs work per refactor note in #8

tjtj’s picture

It is 10.6.20-MariaDB, for Linux. I think it supports JSON. Everything works. So is this message erroneous?

pwarn’s picture

I am also getting this warning with Drupal 11.2.4 / MariaDB 12.0.2

scott_euser’s picture

Status: Needs work » Needs review

Refactored it, this I think is the most easy to read, but has the downside of repeating the title & description. Could move those into variables I suppose, but maybe this is keeping it simpler?

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Could we get a simple test case for it?

oily’s picture

Re: #13 looked at structuring the code differently using switch of something new like match but not sure there is any better, more readable way to structure it.

Been grepping existing test code for the variable $phase, and the strings 'update' and 'runtime' but unsuccessful. Seems difficult to work out where to put the test case.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

eduardo morales alberti made their first commit to this issue’s fork.

eduardo morales alberti’s picture

Merge main into the branch and move the check to core/modules/system/src/Hook/SystemRequirementsHooks.php as the System requirements changed on issue https://www.drupal.org/project/drupal/issues/3554134

berdir’s picture

While a sensible cleanup that's in consistent with other requirements, I think this is actually a bug in drush. The requirement here is an OK, not a warning. Drush isn't meant to show "OK" requirements. However, that logic wasn't updated to support the new enums, see \Drush\Commands\core\UpdateDBCommands::updateCheckRequirements.

It treats anything that isn't an old OK or ERROR severity as a warning.

I opened https://github.com/drush-ops/drush/issues/6528.

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