-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathatmosphere.install
More file actions
43 lines (37 loc) · 1.09 KB
/
atmosphere.install
File metadata and controls
43 lines (37 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* @file
* Install, update, and uninstall functions for the ATmosphere module.
*/
declare(strict_types=1);
/**
* Implements hook_install().
*/
function atmosphere_install(): void {
// Generate a publication TID on install if not already set.
$config = \Drupal::configFactory()->getEditable('atmosphere.settings');
if (empty($config->get('publication_tid'))) {
$tidGenerator = \Drupal::service('atmosphere.tid_generator');
$config->set('publication_tid', $tidGenerator->generate())->save();
}
}
/**
* Implements hook_uninstall().
*/
function atmosphere_uninstall(): void {
// Clear connection state.
\Drupal::state()->delete('atmosphere.connection');
// Clear any queued items.
$queues = [
'atmosphere_publish',
'atmosphere_update',
'atmosphere_delete',
'atmosphere_sync_publication',
];
foreach ($queues as $queueName) {
\Drupal::queue($queueName)->deleteQueue();
}
// Clear expirable key-value stores.
\Drupal::keyValueExpirable('atmosphere.dpop_nonce')->deleteAll();
\Drupal::keyValueExpirable('atmosphere.oauth_transient')->deleteAll();
}