Problem/Motivation
For certain site configurations, you can end up with errors on the Google Translator UI form (/admin/tmgmt/translators/manage/google_v3). We have sites that are configured with this file setting:
$config['file.settings']['make_unused_managed_files_temporary'] = TRUE;See the change record for information on that setting.
When your site is configured this way, you end up with the following error message when you attempt to update your GCP credentials JSON:
The file used in the Google API Credentials field may not be referenced.
The issue here is that the module is not registering file usage for the JSON file uploaded, so when make_unused_managed_files_temporary is set, Drupal wants to downgrade the file to termporary b/c it doesn't see any file usage.
Steps to reproduce
Add this to your settings.php:
$config['file.settings']['make_unused_managed_files_temporary'] = TRUE;Attempt to upload your GCP credentials JSON at /admin/tmgmt/translators/manage/google_v3
Proposed resolution
Use the file.usage service to register use of the uploaded GCP credentials JSON file.
Remaining tasks
Patch.
- Delete file usage when the JSON credentials file is removed
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork tmgmt_google_v3-3519748
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:
- 3519748-file-usage-of
changes, plain diff MR !5
Comments
Comment #3
m4oliveiOpened an MR with a fix. This will work, but be aware that it doesn't take care to clean up file usage. Left as an exercise for the reader for now.
Comment #4
kallado commentedThanks m4olivei kind of busy at the moment I'll check this as soon as possible.
Comment #5
m4oliveiComment #6
kallado commented@m4olivei sorry about the time I also want to fix coding standards and avoid static calls inside the GoogleV3TranslatorUi so the idea would be to use dependency injection and injec the file.usage service and also the language_manager and entity_type.manager let's see if I can find time to fix this soon.
Comment #7
kallado commentedSeams dependency njection inside TranslatorUi is still an issue (Support dependency injection for Translator plugins UI class) so not worring about that for now.
Comment #9
kallado commented@m4olivei pushed to 1.0.x will be fixed on a new release