Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

Cannot properly upgrade rdf_entity to a newer version because it throws exception when running database updates #139

Open
ansergeyg opened this issue Sep 3, 2021 · 0 comments

Comments

@ansergeyg
Copy link

ansergeyg commented Sep 3, 2021

Hi there,

Recently we have tried to bring new major changes to our modules (we use openeuropa module rdf_skos and many other dependent on rdf_skos). In this module:
https://github.com/openeuropa/rdf_skos
there is a description of the three step deployment process to bring new refactored rdf_entity and sparql_entity_storage changes.
In one of the steps, after we upgraded rdf_entity to a latest version, we ran drush updatedb and face the following issue:

[notice] Update started: rdf_entity_update_8004
[error]  modules/contrib/address/config/install is not a directory. 
[error]  Update failed: rdf_entity_update_8004 
[error]  Update aborted by: rdf_entity_update_8004 
[error]  Finished performing updates. 

The problem is that in the rdf_entity.install file in the update 8004
the

$file_system->scanDirectory

is used and according to the drupal manual if the method cannot find a directory it throws an exception which breaks the whole update pipeline.
And the reason why it cannot find a directory is because install and optional folders are not mandatory when building a module.

I would provide a Pull Request but I have no access.

Anyways the fix is simple:

foreach (['install', 'optional'] as $sub_path) {
  $config_files_path = "$extension_path/config/$sub_path";
  if (is_dir($config_files_path)) {
    foreach ($file_system->scanDirectory($config_files_path, $file_pattern) as $path => $file) {
      $new_config_candidates[$path] = $file->name;
    }
  }
}

Regards, Sergey

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant