-
Notifications
You must be signed in to change notification settings - Fork 0
/
d8.install
83 lines (71 loc) · 1.76 KB
/
d8.install
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* @file
* Install, update and uninstall functions for the d8 installation profile.
*/
use Drupal\d8\D8Setup;
use Drupal\d8\Form\D8CaptchaForm;
use Drupal\d8\Form\D8ConfigureForm;
/**
* Implements hook_install().
*/
function d8_install(bool $is_syncing): void {
if (!$is_syncing) {
\Drupal::classResolver(D8Setup::class)->install();
}
}
/**
* Implements hook_install_tasks().
*/
function d8_install_tasks(array &$install_state): array {
return [
'install_captcha_form' => [
'display_name' => t('Activate captcha'),
'type' => 'form',
'function' => D8CaptchaForm::class,
],
];
}
/**
* Implements hook_install_tasks_alter().
*/
function d8_install_tasks_alter(array &$tasks, array $install_state): void {
$tasks['install_configure_form']['function'] = D8ConfigureForm::class;
}
/**
* Implements hook_update_last_removed().
*/
function d8_update_last_removed(): int {
return 10203;
}
/**
* Check only for security updates, even for uninstalled extensions.
*/
function d8_update_10301(array &$sandbox): void {
\Drupal::configFactory()->getEditable('update.settings')
->set('check.disabled_extensions', TRUE)
->set('notification.threshold', 'security')
->save();
}
/**
* Install Help module.
*/
function d8_update_10302(array &$sandbox): void {
\Drupal::classResolver(D8Setup::class)->module('help');
}
/**
* Process list of update hooks.
*
* @param int[] ...
* The update hook identifiers.
*/
function _d8_update(): void {
$item = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 1)[0];
if (preg_match('#([^/]+)\.install$#', $item['file'], $matches)) {
$sandbox = [];
foreach (func_get_args() as $number) {
$function = "{$matches[1]}_update_$number";
$function($sandbox);
}
}
}