Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release versions/v1.7.2 #910

Merged
merged 18 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
fa22f8e
Prevent warning created by passing non array when array is expected
berliner Jan 25, 2024
10ff0f2
Merge pull request #901 from UN-OCHA/berliner/warnings
berliner Jan 25, 2024
6fa561c
HPC-9390: Fix issue with endpoint query arguments not being properly …
berliner Jan 26, 2024
4b08d6d
Add memcache to local stack
berliner Jan 26, 2024
0436737
Merge pull request #902 from UN-OCHA/berliner/HPC-9390
berliner Jan 26, 2024
88ea7ac
Merge pull request #903 from UN-OCHA/berliner/local-memcache
berliner Jan 26, 2024
1e0817a
HPC-9350: Try to make the article import quicker
berliner Jan 26, 2024
eed87d9
Merge pull request #904 from UN-OCHA/berliner/HPC-9350
berliner Jan 26, 2024
5cfbd3e
HPC-9350: Initialize options array and explicitely set update to false
berliner Jan 29, 2024
e194d50
Merge pull request #906 from UN-OCHA/berliner/berliner/HPC-9350
berliner Jan 29, 2024
28e49da
Don't use cookies and headers when building cache keys for remote con…
berliner Jan 29, 2024
253c0dd
Merge pull request #907 from UN-OCHA/berliner/improve-content-caching
berliner Jan 29, 2024
ed61b50
HPC-9363: Fix regression that prevents setting associated data objects
berliner Jan 29, 2024
4958a51
HPC-9363: Fix issue with data object context selection in ghi blocks …
berliner Jan 29, 2024
244ba64
Merge pull request #908 from UN-OCHA/berliner/HPC-9363
berliner Jan 29, 2024
c26263a
HPC-9386: Fix issue with how controller is called, suit to changes in…
berliner Jan 31, 2024
f254f59
Merge pull request #909 from UN-OCHA/berliner/HPC-9386
berliner Jan 31, 2024
1a78621
Merge branch 'develop' into release-versions/v1.7.2
berliner Jan 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .docksal/docksal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@ services:
volumes:
- ${PROJECT_ROOT}/.docksal/etc/solr/solr811:/opt/solr/server/solr/configsets/solr811
environment:
SOLR_CORE: ${SOLR_CORE:-ghi}
SOLR_CORE: ${SOLR_CORE:-ghi}

memcached:
extends:
file: ${HOME}/.docksal/stacks/services.yml
service: memcached
1 change: 0 additions & 1 deletion config/core.entity_form_display.node.article.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ third_party_settings:
children:
- field_remote_article
- field_image
- field_chapter
- field_summary
- field_tags
label: 'Remote article'
Expand Down
2 changes: 1 addition & 1 deletion config/imagemagick.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ path_to_binaries: ''
prepend: ''
log_warnings: true
debug: false
locale: en_US.UTF-8
image_formats:
PNG:
mime_type: image/png
Expand Down Expand Up @@ -59,3 +58,4 @@ advanced:
colorspace: '0'
profile: ''
coalesce: false
locale: en_US.UTF-8
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
$form['label']['#access'] = FALSE;
$form['label']['#required'] = FALSE;
$form['label_display']['#access'] = FALSE;
$form['context_mapping']['#access'] = FALSE;
$form['context_mapping']['#access'] = $form_state->get('current_subform') == self::CONTEXTS_FORM_KEY && !$this->isConfigurationPreview();

$settings_form = &$form['container'];

Expand Down
4 changes: 2 additions & 2 deletions html/modules/custom/ghi_content/ghi_content.module
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function ghi_content_form_ghi_subpages_admin_views_form_alter(array &$form, Form
/**
* Implements hook_form_FORM_ID_alter().
*
* Used to disable fields that automatically populated.
* Used to disable fields that are automatically populated.
*/
function ghi_content_form_node_article_edit_form_alter(array &$form, FormStateInterface $form_state) {
/** @var \Drupal\ghi_content\ContentManager\ArticleManager $article_manager */
Expand All @@ -201,7 +201,7 @@ function ghi_content_form_node_article_edit_form_alter(array &$form, FormStateIn
/**
* Implements hook_form_FORM_ID_alter().
*
* Used to disable fields that automatically populated.
* Used to disable fields that are automatically populated.
*/
function ghi_content_form_node_document_edit_form_alter(array &$form, FormStateInterface $form_state) {
/** @var \Drupal\ghi_content\ContentManager\DocumentManager $article_manager */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ public function updateNodeFromRemote(NodeInterface $node, $dry_run = FALSE, $res

if (!$dry_run) {
$this->importManager->layoutManagerDiscardChanges($node, NULL);
$node->setSyncing(TRUE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,12 @@ public function nodeEditFormAlter(array &$form, FormStateInterface $form_state)
$this->messenger->addWarning($this->t('Some of the fields in this form are disabled because their content is automatically synced from the remote source.'));
}

$migration_id = $this->getMigration($node)->id();
$loaded_migration = Migration::load($migration_id);
$destination = $loaded_migration->get('destination');
$migration = $this->getMigration($node);
$loaded_migration = $migration ? Migration::load($migration->id()) : NULL;
$destination = $loaded_migration?->get('destination') ?? NULL;
$disabled_field_text = $this->t('This field is disabled because it is automatically populated from the remote source.');

$field_keys = array_merge($destination['overwrite_properties'], ['field_image']);
$field_keys = array_merge($destination ? $destination['overwrite_properties'] : [], ['field_image']);
foreach ($field_keys as $field_key) {
if (empty($form[$field_key])) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ protected function runMigration($redirect, array $tags = NULL) {
$this->messenger()->addWarning($this->t('The import is currently running. Please try again later.'));
return new RedirectResponse($redirect);
}
$options = [
'update' => 0,
];
if ($tags !== NULL) {
$options['configuration'] = ['source_tags' => $tags];
}
$executable = new MigrateBatchExecutable($migration, new MigrateMessage());
$executable = new MigrateBatchExecutable($migration, new MigrateMessage(), $options);
$executable->batchImport();
batch_process($redirect);
$batch = batch_get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function onMigratePostRowSave(MigratePostRowSaveEvent $event) {
if (!in_array($event->getMigration()->id(), $migration_ids)) {
return;
}
if (!$event->getRow()->needsUpdate()) {
if (!$event->getRow()->changed()) {
return;
}
$ids = $event->getDestinationIdValues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ public function getArticle() {
}
/** @var \Drupal\ghi_content\RemoteSource\RemoteSourceManager $remote_source_manager */
$remote_source_manager = \Drupal::service('plugin.manager.remote_source');
/** @var \Drupal\ghi_content\RemoteSource\RemoteSourceInterface $remote_source */
$remote_source = $remote_source_manager->createInstance($remote_source_key);
$article_id = $conf['article_select']['article']['article_id'] ?? NULL;
if (!$remote_source || !$article_id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function query($payload) {
];

// See if we have a cached version already for this request.
$cache_key = $this->getCacheKey(['url' => $this->getRemoteEndpointUrl()] + $post_args);
$cache_key = $this->getCacheKey(['url' => $this->getRemoteEndpointUrl()] + ['body' => $post_args['body']]);
if (!$this->disableCache && $response = $this->cache($cache_key)) {
// If we have a cached version, use that.
return $response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Drupal\ghi_enforce_alias_pattern;

use Drupal\Component\Utility\NestedArray;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Entity\ContentEntityFormInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
Expand All @@ -15,6 +16,7 @@
class EnforceAliasPatternManager {

use StringTranslationTrait;
use DependencySerializationTrait;

/**
* The pathauto generator service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static function getPlanEntityObjects($plan_data) {
*/
public static function getPlanEntity($entity_id, $version_argument = 'current') {
/** @var \Drupal\hpc_api\Query\EndpointQuery $query */
$query = \Drupal::service('hpc_api.endpoint_query');
$query = clone \Drupal::service('hpc_api.endpoint_query');
$query->setArguments([
'endpoint' => 'planEntity/' . $entity_id,
'api_version' => 'v2',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
* id = "plan_project_funding_query",
* label = @Translation("Plan funding summary query"),
* endpoint = {
* "public" = "fts/project/plan?planid={plan_id}&groupBy=project",
* "version" = "v1"
* "public" = "fts/project/plan",
* "version" = "v1",
* "query" = {
* "planid" = "{plan_id}",
* "groupBy" = "project"
* }
* }
* )
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,8 @@ protected function successfulAjaxSubmit(array $form, FormStateInterface $form_st
$response->addCommand(new RedirectCommand($entity_url->toString()));
}
else {
/** @var \Drupal\layout_builder_ipe\Controller\EntityEditController $entity_edit_controller */
$entity_edit_controller = $this->controllerResolver->getControllerFromDefinition(EntityEditController::class);
$response = $entity_edit_controller->edit($form_state->get('section_storage'));
$callable = $this->controllerResolver->getControllerFromDefinition(EntityEditController::class . '::edit');
$response = $callable($form_state->get('section_storage'));
$response->addCommand(new CloseDialogCommand('#layout-builder-modal'));
}
return $response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,8 @@ protected function successfulAjaxSubmit(array $form, FormStateInterface $form_st
$response->addCommand(new RedirectCommand($entity_url->toString()));
}
else {
/** @var \Drupal\layout_builder_ipe\Controller\EntityEditController $entity_edit_controller */
$entity_edit_controller = $this->controllerResolver->getControllerFromDefinition(EntityEditController::class);
$response = $entity_edit_controller->edit($form_state->get('section_storage'));
$callable = $this->controllerResolver->getControllerFromDefinition(EntityEditController::class . '::edit');
$response = $callable($form_state->get('section_storage'));
$response->addCommand(new CloseDialogCommand('#layout-builder-modal'));
}
return $response;
Expand Down
18 changes: 10 additions & 8 deletions html/modules/custom/hpc_api/src/Query/EndpointQueryBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,19 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
$endpoint_query_args = $plugin_definition['endpoint']['query'] ?? [];

$this->isAutenticatedEndpoint = $endpoint_authenticated && $this->user->isAuthenticated() && $this->getHidAccessToken();
$endpoint_url = $this->isAutenticatedEndpoint ? $endpoint_authenticated : $endpoint_public;
$auth_method = EndpointQuery::AUTH_METHOD_BASIC;
if ($endpoint_api_key) {
$this->endpointQuery->setAuthMethod(EndpointQuery::AUTH_METHOD_API_KEY);
$this->endpointQuery->setEndpoint($endpoint_api_key);
}
else {
$this->endpointQuery->setAuthMethod(EndpointQuery::AUTH_METHOD_BASIC);
$this->endpointQuery->setEndpoint($this->isAutenticatedEndpoint ? $endpoint_authenticated : $endpoint_public);
$auth_method = EndpointQuery::AUTH_METHOD_API_KEY;
$endpoint_url = $endpoint_api_key;
}

$this->endpointQuery->setEndpointVersion($endpoint_version);
$this->endpointQuery->setEndpointArguments($endpoint_query_args);
$this->endpointQuery->setArguments([
'api_version' => $endpoint_version,
'endpoint' => $endpoint_url,
'query_args' => $endpoint_query_args,
'auth_method' => $auth_method,
]);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions html/sites/default/settings.docksal.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;

// Memcache.
$settings['memcache']['servers'] = ['memcached:11211' => 'default'];
$settings['memcache']['bins'] = ['default' => 'default'];
$settings['memcache']['key_prefix'] = '';
$settings['cache']['default'] = 'cache.backend.memcache';

// Reverse proxy configuration (Docksal vhost-proxy)
if (PHP_SAPI !== 'cli') {
$settings['reverse_proxy'] = TRUE;
Expand Down
Loading