Skip to content
Snippets Groups Projects
Commit 352006cf authored by Claudiu Cristea's avatar Claudiu Cristea
Browse files

Merge remote-tracking branch 'origin/release/2.2.1' into ISAICP-9510

parents 34c0f923 fea42bb1
No related branches found
Tags 2.2.1
1 merge request!210Patch release 2.2.1
@api @group-clone
Feature: Aliases are not updates.
@update:joinup_core_deploy_200300
Scenario Outline: Update collection alias.
Given I am logged in as a user with the "moderator" role
And I visit "<path>"
And I fill in "Short ID" with "<Short ID>"
And I press "Publish"
When I should be on "<expected>"
Examples:
| path | Short ID | expected |
| /collection/nifo-national-interoperability-framework-observatory/edit | | /collection/iopeu-monitoring |
| /interoperable-europe/edit | inter-europe | /interoperable-europe |
@update:joinup_core_deploy_200300
Scenario Outline: Update solution alias.
Given I am logged in as a user with the "moderator" role
And I visit "<path>"
And I fill in "Short ID" with "<Short ID>"
And I select "Architecture Principle" from "Solution type"
And I press "Publish"
When I should be on "<expected>"
Examples:
| path | Short ID | expected |
| /collection/european-interoperability-reference-architecture-eira/solution/egovera/edit | egovera | /collection/european-interoperability-reference-architecture-eira/solution/egovera |
| /collection/statistics/solution/eurotrace/edit | etsolution | /collection/statistics/solution/etsolution |
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
namespace Drupal\eu_oss_catalogue\Plugin\eu_oss_catalogue\Resolver; namespace Drupal\eu_oss_catalogue\Plugin\eu_oss_catalogue\Resolver;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Database\Connection; use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
...@@ -74,6 +75,9 @@ public function resolve(?array &$value, Project $project, array $metadata, Field ...@@ -74,6 +75,9 @@ public function resolve(?array &$value, Project $project, array $metadata, Field
return; return;
} }
// Remove empty term names.
$value = NestedArray::filter($value);
// Get a flat list of all term names regardless of the language. // Get a flat list of all term names regardless of the language.
$allTermNames = array_values(array_merge(...array_values($value))); $allTermNames = array_values(array_merge(...array_values($value)));
......
...@@ -159,7 +159,7 @@ default: ...@@ -159,7 +159,7 @@ default:
- website-builder - website-builder
roadmap: http://roadmap.example.com/vendor/solution2 roadmap: http://roadmap.example.com/vendor/solution2
developmentStatus: development developmentStatus: development
softwareType: library softwareType: ""
description: description:
it: it:
genericName: '[IT] ACME Solution 2' genericName: '[IT] ACME Solution 2'
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
declare(strict_types=1); declare(strict_types=1);
use Drupal\Core\Database\Database;
use Drupal\interoperable_europe\InteroperableEuropeCollectionInterface;
use Drupal\joinup_assessment\AssessmentInterface;
use Drupal\joinup_oss_catalogue\OssCatalogueCollectionInterface;
use EasyRdf\Graph; use EasyRdf\Graph;
/** /**
...@@ -28,11 +32,57 @@ function joinup_core_deploy_200300(): void { ...@@ -28,11 +32,57 @@ function joinup_core_deploy_200300(): void {
])->save(); ])->save();
} }
/**
* Update pathauto state for "RDF" nodes with aliases.
*/
function joinup_core_deploy_200301(array &$sandbox): string {
$database = Database::getConnection();
if (!isset($sandbox['ids'])) {
$query = $database->select('node_field_data', 'nd');
$query->fields('nd', ['nid'])
->condition('nd.type', [
'collection',
'solution',
'distribution',
'release',
'contact_information',
'owner',
], 'IN');
$query->join('node', 'n', 'n.nid = nd.nid');
$query->fields('n', ['uuid'])
->condition('n.uuid', [
InteroperableEuropeCollectionInterface::COLLECTION_UUID,
OssCatalogueCollectionInterface::COLLECTION_UUID,
AssessmentInterface::GROUP_UUID,
], 'NOT IN');
$query->join('key_value', 'k', 'nd.nid = k.name AND k.collection = :collection', [':collection' => 'pathauto_state.node']);
$query->condition('k.value', 'i:0;');
$sandbox['ids'] = $query->execute()->fetchCol();
$sandbox['total'] = count($sandbox['ids']);
$sandbox['progress'] = 0;
}
$ids = array_splice($sandbox['ids'], 0, 200);
if (!empty($ids)) {
$database->update('key_value')
->fields(['value' => 'i:1;'])
->condition('name', $ids, 'IN')
->condition('collection', 'pathauto_state.node')
->execute();
}
$sandbox['progress'] += count($ids);
$sandbox['#finished'] = (int) empty($sandbox['ids']);
return "Processed {$sandbox['progress']} out of {$sandbox['total']}";
}
/** /**
* Gather information about the current state of solution type terms. * Gather information about the current state of solution type terms.
*/ */
function joinup_core_deploy_200301(): string { function joinup_core_deploy_200302(): string {
// We only need to check the revision table as all data are there including // We only need to check the revision table as all data are there including
// the data from the data table. // the data from the data table.
$solution_type_values = \Drupal::database() $solution_type_values = \Drupal::database()
...@@ -70,7 +120,7 @@ function joinup_core_deploy_200301(): string { ...@@ -70,7 +120,7 @@ function joinup_core_deploy_200301(): string {
/** /**
* Deploy EIRA 6.1.0, simplified solution type (EIRA 6.0.0) and eGovERA. * Deploy EIRA 6.1.0, simplified solution type (EIRA 6.0.0) and eGovERA.
*/ */
function joinup_core_deploy_200302(): void { function joinup_core_deploy_200303(): void {
// Import the simplified EIRA 6.0.0. // Import the simplified EIRA 6.0.0.
$graph = new Graph(); $graph = new Graph();
$graph->parseFile('../resources/vocab/EIRA_SKOS_v6_0_0.rdf'); $graph->parseFile('../resources/vocab/EIRA_SKOS_v6_0_0.rdf');
...@@ -99,7 +149,7 @@ function joinup_core_deploy_200302(): void { ...@@ -99,7 +149,7 @@ function joinup_core_deploy_200302(): void {
/** /**
* Update the solution type field and revision values. * Update the solution type field and revision values.
*/ */
function joinup_core_deploy_200303(): string { function joinup_core_deploy_200304(): string {
$data = \Drupal::state()->get('joinup_core_deploy_200200'); $data = \Drupal::state()->get('joinup_core_deploy_200200');
if (!$data) { if (!$data) {
throw new Exception('No relevant data found about solution type field.'); throw new Exception('No relevant data found about solution type field.');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment