Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
If you have forget to configure a private directory or somewhy you can't write in it or somewhy the file doesn't created, you will get this exception:
Error: Call to a member function id() on boolean in gdpr_tasks_entity_presave() (line 161 of D:\phptest\gdpr-test\modules\gdpr\modules\gdpr_tasks\gdpr_tasks.module) #0 [internal function]: gdpr_tasks_entity_presave(Object(Drupal\gdpr_tasks\Entity\Task))
#1 D:\phptest\gdpr-test\core\lib\Drupal\Core\Extension\ModuleHandler.php(402): call_user_func_array('gdpr_tasks_enti...', Array)
#2 D:\phptest\gdpr-test\core\lib\Drupal\Core\Entity\EntityStorageBase.php(169): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_presave', Array)
#3 D:\phptest\gdpr-test\core\lib\Drupal\Core\Entity\ContentEntityStorageBase.php(730): Drupal\Core\Entity\EntityStorageBase->invokeHook('presave', Object(Drupal\gdpr_tasks\Entity\Task))
....
Reproduce:
1. Install new site and do not set private directory.
2. Install GDPR module.
3. Create (i.e.) a user export.
Comment | File | Size | Author |
---|---|---|---|
#2 | gdpr-exception_on_wrong_prive_dir-2975467-2-D8.patch | 584 bytes | golddragon007 |
Comments
Comment #2
golddragon007 CreditAttribution: golddragon007 at Brainsum commentedThis patch will fix it.
Comment #3
mhavelant CreditAttribution: mhavelant at Brainsum for Tieto commentedThis is not the correct way. The exception is thrown because of that, yes, but there are warnings generated a lot sooner, at the first
file_prepare_directory
call.We should check the private files folder:
Comment #4
pedrop CreditAttribution: pedrop at Brainsum commentedComment #6
mhavelant CreditAttribution: mhavelant at Brainsum for Tieto commentedI added the check to the requirements hook, it should now prevent install, update and throw an error on reports, as well, if the private files are not set, don't exist or is not writable.
This should be enough for now, if there are any more errors, let's implement the second one (check during tasks entity presave), too. But for now, that part is postponed.