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

Commit

Permalink
Merge pull request #2539 from ec-europa/ISAICP-6637
Browse files Browse the repository at this point in the history
ISAICP-6637: Provide an update path for the collections' abstracts.
  • Loading branch information
saidatom authored Aug 13, 2021
2 parents f8981c0 + 57be285 commit d77fb3c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions web/modules/custom/joinup_core/joinup_core.post_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,28 @@
*/

declare(strict_types = 1);

/**
* Update the text format of the abstract field for collections.
*/
function joinup_core_post_update_0107400(&$sandbox): void {
$graphs = [
'http://joinup.eu/collection/draft',
'http://joinup.eu/collection/published',
];

// This query updates the text format of the abstract field for collections.
// The field was updated to have a new sole format but the existing data were
// not updated.
foreach ($graphs as $graph) {
$query = <<<QUERY
WITH <{$graph}>
DELETE { ?entity_id <http://joinup.eu/text_format> "basic_html"^^<http://www.w3.org/2001/XMLSchema#string> }
INSERT { ?entity_id <http://joinup.eu/text_format> "essential_html"^^<http://www.w3.org/2001/XMLSchema#string> }
WHERE { ?entity_id <http://joinup.eu/text_format> "basic_html"^^<http://www.w3.org/2001/XMLSchema#string> }
QUERY;

\Drupal::getContainer()->get('sparql.endpoint')->query($query);
}

}

0 comments on commit d77fb3c

Please sign in to comment.