Loading dbee.info.yml +1 −1 Original line number Diff line number Diff line Loading @@ -7,4 +7,4 @@ dependencies: - encrypt:encrypt - real_aes:real_aes configure: entity.encryption_profile.collection core_version_requirement: ^8.9 || ^9 core_version_requirement: ^9.3 || ^10 dbee.install +5 −5 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ function dbee_install($is_syncing) { } // Don't recreate the index. // If successful, encrypt all existing email addresses. module_load_include('inc', 'dbee', 'dbee.users'); require_once \Drupal::service('extension.list.module')->getPath('dbee') . '/dbee.users.inc'; dbee_update_crypt_all('encrypt'); // Enable the dbee extra_field_only on the user view page. Loading Loading @@ -78,8 +78,8 @@ function dbee_install($is_syncing) { */ function dbee_uninstall() { // Decrypt all existing email addresses. module_load_include('module', 'dbee'); module_load_include('inc', 'dbee', 'dbee.users'); \Drupal::moduleHandler()->loadInclude('dbee', 'module'); \Drupal::moduleHandler()->loadInclude('dbee', 'inc', 'dbee.users'); dbee_update_crypt_all('decrypt', 'uninstall'); // Reset the mail and init storage length. // Recreate the mail index: it will be managed in the Loading @@ -92,7 +92,7 @@ function dbee_uninstall() { function dbee_requirements($phase) { $requirements = []; if ($phase == 'update') { module_load_include('inc', 'dbee', 'dbee.update'); \Drupal::moduleHandler()->loadInclude('dbee', 'inc', 'dbee.update'); if (dbee_update_previous_to_8200()) { $requirements['dbee']['title'] = t('Database Email Encryption module update'); $requirements['dbee']['description'] = t('Prevent from loosing Users email addresses.'); Loading Loading @@ -156,7 +156,7 @@ function dbee_requirements($phase) { * Prevent upgrading from lower than v8.x-2.x. */ function dbee_update_8200() { module_load_include('inc', 'dbee', 'dbee.update'); \Drupal::moduleHandler()->loadInclude('dbee', 'inc', 'dbee.update'); if (dbee_update_previous_to_8200()) { return t('<strong>You can not update form version prior to v8.x-2.x on the Database email Encryption module !</strong> You should rollback to your previous Dbee version, uninstall the module then install this version. Loading dbee.module +4 −6 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\encrypt\Entity\EncryptionProfile; use Drupal\Core\Access\AccessResult; use Drupal\Core\Database\Query\Condition; use Drupal\Core\Routing\RouteMatchInterface; define('DBEE_ENCRYPT_NAME', 'dbee'); Loading Loading @@ -383,11 +382,10 @@ function dbee_entity_presave(EntityInterface $entity) { * Implements hook_entity_update(). */ function dbee_entity_update(EntityInterface $entity) { if (($entity->getEntityTypeId() == 'key' || ($entity->getEntityTypeId() == 'encryption_profile' && $entity->getOriginalId() == DBEE_ENCRYPT_NAME)) && !empty($entity->dbee_change)) { // Batch for decrypting all user email addresses and then // re-encrypting them with the new parameters. module_load_include('inc', 'dbee', 'dbee.users'); \Drupal::moduleHandler()->loadInclude('dbee', 'inc', 'dbee.users'); dbee_update_crypt_all('change', 'change', TRUE); dbee_update_crypt_all('encrypt', 'change', TRUE); } Loading Loading @@ -734,13 +732,13 @@ function _dbee_where_clause(&$query, $users_alias, $dbee_alias) { } if ($need_rewrite) { if (!$where_match) { // Add to ignore empty values. // Retrieve empty values. $empty_users = \Drupal::database()->select('users_field_data', 'ufd') $connection = \Drupal::database(); $empty_users = $connection->select('users_field_data', 'ufd') ->fields('ufd', ['uid']) ->condition((new Condition('OR'))->condition("ufd.{$dbee_field}", '', '=')->isNull("ufd.{$dbee_field}")) ->condition(($connection->condition('OR'))->condition("ufd.{$dbee_field}", '', '=')->isNull("ufd.{$dbee_field}")) ->execute(); $added_empty = FALSE; foreach ($empty_users as $account) { Loading dbee.services.yml +1 −1 Original line number Diff line number Diff line services: dbee.authentication.cookie: class: Drupal\dbee\Authentication\Provider\DbeeCookie arguments: ['@session_configuration', '@database'] arguments: ['@session_configuration', '@database', '@messenger'] tags: - { name: authentication_provider, provider_id: 'cookie', priority: -10, global: TRUE } dbee.update.inc +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ use Drupal\Core\Form\FormStateInterface; */ function dbee_update_previous_to_8200() { // Retreive de current update number. $db_number = drupal_get_installed_schema_version('dbee'); $db_number = \Drupal::service('update.update_hook_registry')->getInstalledVersion('dbee'); // From v8.x-1.x. $dbee_table_exists = \Drupal::database()->schema()->tableExists('dbee'); // From v7.x-3.x. Loading Loading
dbee.info.yml +1 −1 Original line number Diff line number Diff line Loading @@ -7,4 +7,4 @@ dependencies: - encrypt:encrypt - real_aes:real_aes configure: entity.encryption_profile.collection core_version_requirement: ^8.9 || ^9 core_version_requirement: ^9.3 || ^10
dbee.install +5 −5 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ function dbee_install($is_syncing) { } // Don't recreate the index. // If successful, encrypt all existing email addresses. module_load_include('inc', 'dbee', 'dbee.users'); require_once \Drupal::service('extension.list.module')->getPath('dbee') . '/dbee.users.inc'; dbee_update_crypt_all('encrypt'); // Enable the dbee extra_field_only on the user view page. Loading Loading @@ -78,8 +78,8 @@ function dbee_install($is_syncing) { */ function dbee_uninstall() { // Decrypt all existing email addresses. module_load_include('module', 'dbee'); module_load_include('inc', 'dbee', 'dbee.users'); \Drupal::moduleHandler()->loadInclude('dbee', 'module'); \Drupal::moduleHandler()->loadInclude('dbee', 'inc', 'dbee.users'); dbee_update_crypt_all('decrypt', 'uninstall'); // Reset the mail and init storage length. // Recreate the mail index: it will be managed in the Loading @@ -92,7 +92,7 @@ function dbee_uninstall() { function dbee_requirements($phase) { $requirements = []; if ($phase == 'update') { module_load_include('inc', 'dbee', 'dbee.update'); \Drupal::moduleHandler()->loadInclude('dbee', 'inc', 'dbee.update'); if (dbee_update_previous_to_8200()) { $requirements['dbee']['title'] = t('Database Email Encryption module update'); $requirements['dbee']['description'] = t('Prevent from loosing Users email addresses.'); Loading Loading @@ -156,7 +156,7 @@ function dbee_requirements($phase) { * Prevent upgrading from lower than v8.x-2.x. */ function dbee_update_8200() { module_load_include('inc', 'dbee', 'dbee.update'); \Drupal::moduleHandler()->loadInclude('dbee', 'inc', 'dbee.update'); if (dbee_update_previous_to_8200()) { return t('<strong>You can not update form version prior to v8.x-2.x on the Database email Encryption module !</strong> You should rollback to your previous Dbee version, uninstall the module then install this version. Loading
dbee.module +4 −6 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\encrypt\Entity\EncryptionProfile; use Drupal\Core\Access\AccessResult; use Drupal\Core\Database\Query\Condition; use Drupal\Core\Routing\RouteMatchInterface; define('DBEE_ENCRYPT_NAME', 'dbee'); Loading Loading @@ -383,11 +382,10 @@ function dbee_entity_presave(EntityInterface $entity) { * Implements hook_entity_update(). */ function dbee_entity_update(EntityInterface $entity) { if (($entity->getEntityTypeId() == 'key' || ($entity->getEntityTypeId() == 'encryption_profile' && $entity->getOriginalId() == DBEE_ENCRYPT_NAME)) && !empty($entity->dbee_change)) { // Batch for decrypting all user email addresses and then // re-encrypting them with the new parameters. module_load_include('inc', 'dbee', 'dbee.users'); \Drupal::moduleHandler()->loadInclude('dbee', 'inc', 'dbee.users'); dbee_update_crypt_all('change', 'change', TRUE); dbee_update_crypt_all('encrypt', 'change', TRUE); } Loading Loading @@ -734,13 +732,13 @@ function _dbee_where_clause(&$query, $users_alias, $dbee_alias) { } if ($need_rewrite) { if (!$where_match) { // Add to ignore empty values. // Retrieve empty values. $empty_users = \Drupal::database()->select('users_field_data', 'ufd') $connection = \Drupal::database(); $empty_users = $connection->select('users_field_data', 'ufd') ->fields('ufd', ['uid']) ->condition((new Condition('OR'))->condition("ufd.{$dbee_field}", '', '=')->isNull("ufd.{$dbee_field}")) ->condition(($connection->condition('OR'))->condition("ufd.{$dbee_field}", '', '=')->isNull("ufd.{$dbee_field}")) ->execute(); $added_empty = FALSE; foreach ($empty_users as $account) { Loading
dbee.services.yml +1 −1 Original line number Diff line number Diff line services: dbee.authentication.cookie: class: Drupal\dbee\Authentication\Provider\DbeeCookie arguments: ['@session_configuration', '@database'] arguments: ['@session_configuration', '@database', '@messenger'] tags: - { name: authentication_provider, provider_id: 'cookie', priority: -10, global: TRUE }
dbee.update.inc +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ use Drupal\Core\Form\FormStateInterface; */ function dbee_update_previous_to_8200() { // Retreive de current update number. $db_number = drupal_get_installed_schema_version('dbee'); $db_number = \Drupal::service('update.update_hook_registry')->getInstalledVersion('dbee'); // From v8.x-1.x. $dbee_table_exists = \Drupal::database()->schema()->tableExists('dbee'); // From v7.x-3.x. Loading