- 🇬🇧United Kingdom robcarr Perthshire, Scotland
The patch applies although when running the database update 8201, it generates the following errors:
Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck().
- 🇬🇧United Kingdom robcarr Perthshire, Scotland
If
accessCheck(TRUE)
is inserted into the relevant query in the file_entity.install file, then the update runs fine:/** * Update pathauto to enable path field for file entity type if there are * file aliases or patterns. */ function file_entity_update_8201() { if (\Drupal::moduleHandler()->moduleExists('pathauto')) { $file_patterns = \Drupal::entityTypeManager()->getStorage('pathauto_pattern')->loadByProperties(['type' => 'canonical_entities:file']); $file_aliases = \Drupal::entityTypeManager()->getStorage('path_alias')->getQuery()->condition('path', '/file/%', 'LIKE')->accessCheck(TRUE)->count()->execute(); if (!empty($file_patterns) || $file_aliases > 0) { $config_factory = \Drupal::configFactory(); $config = $config_factory->getEditable('pathauto.settings'); $enabled_entity_types = $config->get('enabled_entity_types'); $config->set('enabled_entity_types', array_unique(array_merge($enabled_entity_types, ['file']))); $config->save(); } else { \Drupal::messenger()->addMessage(t("Files no longer have an alias field by default, enable it in the pathauto settings if you wish to use that.")); } } }
- Status changed to Needs review
over 1 year ago 11:24am 13 June 2023 - last update
over 1 year ago 32 pass - Status changed to Needs work
over 1 year ago 7:47am 24 June 2023 - 🇬🇧United Kingdom steven jones
+++ b/file_entity.install @@ -197,3 +197,24 @@ function file_entity_update_8005() { + $file_patterns = \Drupal::entityTypeManager()->getStorage('pathauto_pattern')->loadByProperties(['type' => 'canonical_entities:file']); + $file_aliases = \Drupal::entityTypeManager()->getStorage('path_alias')->getQuery()->condition('path', '/file/%', 'LIKE')->accessCheck(TRUE)->count()->execute();
You'd actually want
->accessCheck(FALSE)
Because you don't want the access checking enabled for this query.
- First commit to issue fork.
- 🇮🇳India bharath-kondeti Hyderabad
Updated the patch addressing #23. Please review
- last update
over 1 year ago 32 pass - last update
over 1 year ago 32 pass - @bharath-kondeti opened merge request.
- Status changed to Needs review
over 1 year ago 8:45am 24 June 2023 - 🇨🇦Canada joseph.olstad
Review so far:
I grepped all Drupal 8 projects using grep . xnddx . ru , currently only the file_entity is using this api function name .It's likely a save change to make above, thanks for your work.
- Assigned to berdir
- Status changed to RTBC
over 1 year ago 1:08pm 3 September 2023 - 🇬🇧United Kingdom c_archer Cumbria
Tested patch on #25 and it worked as hoped.
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 8.1 & MySQL 8last update
over 1 year ago Waiting for branch to pass -
joseph.olstad →
committed 53548371 on 8.x-2.x authored by
bharath-kondeti →
git commit -m 'Issue #2655844 by rutiolma, bharath-kondeti, Berdir,...
-
joseph.olstad →
committed 53548371 on 8.x-2.x authored by
bharath-kondeti →
- 🇨🇦Canada joseph.olstad
Gitlab didn't use the commit message I specified, grumble.
Should have been this:
git commit -m 'Issue #2655844 by rutiolma, bharath-kondeti, Berdir, robcarr, joseph.olstad, Steven Jones, c_archer: Remove file_entity_entity_base_field_info()' --author="Sascha Grossenbacher <5019-berdir@users.noreply.drupalcode.org>"
- Status changed to Fixed
about 1 year ago 3:55pm 14 November 2023 - Status changed to Needs work
about 1 year ago 8:14am 15 November 2023 - 🇺🇸United States webdrips
I'm not sure if it's best to start a new issue or use this one, but after upgrading to RC2 and running the database updates, I'm noticing the following:
ENTITY/FIELD DEFINITIONS Mismatched entity and/or field definitions The following changes were detected in the entity type and field definitions. File The URL alias field needs to be uninstalled.
This was the only update I applied, so I don't see how this error could've come from anywhere else.
I tried uninstalling this module and reinstalling it (after running Cron), and the same for pathauto, but I can't seem to get rid of this message.
- 🇨🇦Canada paintingguy
I have the same issue as @webdrips after updating to rc2
- Issue was unassigned.
- Status changed to Active
about 1 year ago 4:26pm 16 November 2023 -
joseph.olstad →
committed 9835072e on 8.x-2.x
Revert "git commit -m 'Issue #2655844 by rutiolma, bharath-kondeti,...
-
joseph.olstad →
committed 9835072e on 8.x-2.x
-
joseph.olstad →
committed 6a7a41f1 on 8.x-2.x
Issue #2655844 by joseph.olstad, paintingguy, webdrips: Remove...
-
joseph.olstad →
committed 6a7a41f1 on 8.x-2.x
- Status changed to Postponed: needs info
about 1 year ago 4:33pm 16 November 2023 - 🇨🇦Canada joseph.olstad
Thanks for reporting the issues, it is reverted in rc4
https://www.drupal.org/project/file_entity/releases/8.x-2.0-rc4 →
- 🇺🇸United States webdrips
RC4 Removed the Status Report error message for me.
- 🇬🇧United Kingdom steven jones
RC4 added it back for me, this patch removed it.
@webdrips I wonder if you want a URL alias field on your files? Maybe we need to be smarter about when the base field is declared, are you also using the latest versions of pathauto?