Skip to content

Commit

Permalink
Merge pull request #453 from City-of-Helsinki/develop
Browse files Browse the repository at this point in the history
Release 13.9.
  • Loading branch information
tvalimaa authored Sep 13, 2023
2 parents e4548e9 + 20ba384 commit 525ceda
Show file tree
Hide file tree
Showing 32 changed files with 288 additions and 46 deletions.
1 change: 1 addition & 0 deletions conf/cmi/core.extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module:
asu_apartment_search: 0
asu_api: 0
asu_application: 0
asu_clear_cache: 0
asu_content: 0
asu_content_alter: 0
asu_csv_import: 0
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.asu_api_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- asu_api
title: 'Default cron handler'
id: asu_api_cron
weight: 0
weight: -12
module: asu_api
callback: asu_api_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.asu_application_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- asu_application
title: 'Default cron handler'
id: asu_application_cron
weight: 0
weight: -11
module: asu_application
callback: asu_application_cron
scheduler:
Expand Down
29 changes: 29 additions & 0 deletions conf/cmi/ultimate_cron.job.asu_clear_cache_cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
uuid: 310bcedf-04c9-4684-b38f-6244b1348e47
langcode: fi
status: true
dependencies:
module:
- asu_clear_cache
title: 'Default cron handler'
id: asu_clear_cache_cron
weight: 1
module: asu_clear_cache
callback: asu_clear_cache_cron
scheduler:
id: simple
configuration:
rules:
- '*/5+@ * * * *'
launcher:
id: serial
configuration:
timeouts:
lock_timeout: 3600
launcher:
thread: 0
logger:
id: database
configuration:
method: '3'
expire: 1209600
retain: 1000
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.asu_content_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- asu_content
title: 'Default cron handler'
id: asu_content_cron
weight: 0
weight: -10
module: asu_content
callback: asu_content_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.content_lock_timeout_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- content_lock_timeout
title: 'Default cron handler'
id: content_lock_timeout_cron
weight: 0
weight: -9
module: content_lock_timeout
callback: content_lock_timeout_cron
scheduler:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- elasticsearch_connector
title: 'Default cron handler'
id: elasticsearch_connector_cron
weight: 0
weight: -8
module: elasticsearch_connector
callback: elasticsearch_connector_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.field_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- field
title: 'Purges deleted Field API data'
id: field_cron
weight: 0
weight: 4
module: field
callback: field_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.file_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- file
title: 'Deletes temporary files'
id: file_cron
weight: 0
weight: 3
module: file
callback: file_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.flysystem_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- flysystem
title: 'Default cron handler'
id: flysystem_cron
weight: 0
weight: -7
module: flysystem
callback: flysystem_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.honeypot_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- honeypot
title: 'Default cron handler'
id: honeypot_cron
weight: 0
weight: -6
module: honeypot
callback: honeypot_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.imagecache_external_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- imagecache_external
title: 'Default cron handler'
id: imagecache_external_cron
weight: 0
weight: -5
module: imagecache_external
callback: imagecache_external_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.locale_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- locale
title: 'Default cron handler'
id: locale_cron
weight: 0
weight: -4
module: locale
callback: locale_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.node_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- node
title: 'Updates search rankings for nodes'
id: node_cron
weight: 0
weight: 7
module: node
callback: node_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.redirect_404_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- redirect_404
title: 'Default cron handler'
id: redirect_404_cron
weight: 0
weight: -3
module: redirect_404
callback: redirect_404_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.scheduler_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- scheduler
title: 'Default cron handler'
id: scheduler_cron
weight: 0
weight: -2
module: scheduler
callback: scheduler_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.simple_sitemap_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- simple_sitemap
title: 'Default cron handler'
id: simple_sitemap_cron
weight: 0
weight: 2
module: simple_sitemap
callback: simple_sitemap_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.system_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- system
title: 'Cleanup (caches, batch, flood, temp-files, etc.)'
id: system_cron
weight: 0
weight: -13
module: system
callback: system_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.ultimate_cron_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ status: true
dependencies: { }
title: 'Runs internal cleanup operations'
id: ultimate_cron_cron
weight: 0
weight: 5
module: ultimate_cron
callback: ultimate_cron_cron
scheduler:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: ed515030-6598-4b75-b0fd-657a69367024
langcode: en
status: true
dependencies:
module:
- asu_content
title: 'Queue: Asu content apartment update worker'
id: ultimate_cron_queue_asu_content_queue_worker
weight: -1
module: asu_content
callback: 'ultimate_cron.queue_worker:queueCallback'
scheduler:
id: simple
configuration:
rules:
- '* * * * *'
launcher:
id: serial
logger:
id: database
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: 51744f57-3447-48d6-8386-2280c3eea12a
langcode: en
status: true
dependencies:
module:
- entity_reference_revisions
title: 'Queue: Entity Reference Revisions Orphan Purger'
id: ultimate_cron_queue_entity_reference_revisions_orphan_purger
weight: 8
module: entity_reference_revisions
callback: 'ultimate_cron.queue_worker:queueCallback'
scheduler:
id: simple
configuration:
rules:
- '* * * * *'
launcher:
id: serial
logger:
id: database
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: 4c346814-7761-4eb9-ba08-fd4eb7ac723c
langcode: en
status: true
dependencies:
module:
- entity_usage
title: 'Queue: Entity Usage Regenerate Tracking Queue'
id: ultimate_cron_queue_entity_usage_regenerate_queue
weight: 9
module: entity_usage
callback: 'ultimate_cron.queue_worker:queueCallback'
scheduler:
id: simple
configuration:
rules:
- '* * * * *'
launcher:
id: serial
logger:
id: database
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: 1fafd13b-580e-4bfb-833f-4f106f84f313
langcode: en
status: true
dependencies:
module:
- imagecache_external
title: 'Queue: Imagechache external flush images.'
id: ultimate_cron_queue_imagecache_external_flush_images
weight: 10
module: imagecache_external
callback: 'ultimate_cron.queue_worker:queueCallback'
scheduler:
id: simple
configuration:
rules:
- '* * * * *'
launcher:
id: serial
logger:
id: database
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: e7504516-b20b-41e8-8fcf-2b29fa22e56e
langcode: en
status: true
dependencies:
module:
- locale
title: 'Queue: Update translations'
id: ultimate_cron_queue_locale_translation
weight: 12
module: locale
callback: 'ultimate_cron.queue_worker:queueCallback'
scheduler:
id: simple
configuration:
rules:
- '* * * * *'
launcher:
id: serial
logger:
id: database
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: 0a8680f1-97c8-4cc4-b7fb-6f50f4199d76
langcode: en
status: true
dependencies:
module:
- media
title: 'Queue: Thumbnail downloader'
id: ultimate_cron_queue_media_entity_thumbnail
weight: 11
module: media
callback: 'ultimate_cron.queue_worker:queueCallback'
scheduler:
id: simple
configuration:
rules:
- '* * * * *'
launcher:
id: serial
logger:
id: database
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.job.update_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- update
title: 'Update indexes'
id: update_cron
weight: 0
weight: 6
module: update
callback: update_cron
scheduler:
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/ultimate_cron.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ _core:
default_config_hash: xNvhVNcCJsZiYwYTw9TTnRv1SjLVO7H5BCK1U8Brvfo
bypass_transactional_safe_connection: false
queue:
enabled: false
enabled: true
timeouts:
lease_time: !!float 30
time: !!float 15
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: 'ASU - Clear cache'
type: module
description: 'ASU - Clear cache cron.'
core: 8.x
core_version_requirement: ^8 || ^9 || ^10
package: 'ASU'
32 changes: 32 additions & 0 deletions public/modules/custom/asu_clear_cache/asu_clear_cache.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Drupal\node\Entity\Node;

/**
* @file
* Contains asu_clear_cache.module.
*/

/**
* Implements hook_cron().
*/
function asu_clear_cache_cron() {
$time_ago = strtotime('-5 minutes');
$database = \Drupal::database();
$query = $database->select('node_field_data', 'n');
$query->condition('n.type', 'project');
$query->condition('n.status', 1);
$query->condition('n.changed', $time_ago, '>=');
$query->fields('n', ['nid']);

$projects = $query->execute()->fetchAll();

if (count($projects) > 0) {
foreach ($projects as $project) {
$project = Node::load($project->nid);
// Clear listing page cache.
$cid = 'asu_rest:apartment_list:' . $project->getOwnershipType();
\Drupal::cache()->delete($cid);
}
}
}
Loading

0 comments on commit 525ceda

Please sign in to comment.