-
Notifications
You must be signed in to change notification settings - Fork 52
/
search_api_solr.post_update.php
66 lines (62 loc) · 1.88 KB
/
search_api_solr.post_update.php
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
<?php
/**
* @file
* Post updates.
*/
/**
* Delete Solr 4 and 5 field types.
*/
function search_api_solr_post_update_8204_replace_solr_4_field_types() {
try {
$storage = \Drupal::entityTypeManager()->getStorage('solr_field_type');
$storage->delete($storage->loadMultiple([
'm_text_und_5_2_0',
'text_und_4_5_0',
'm_text_de_5_2_0',
'm_text_en_5_2_0',
'm_text_nl_5_2_0',
'text_cs_5_0_0',
'text_de_4_5_0',
'text_de_5_0_0',
'text_de_scientific_5_0_0',
'text_el_4_5_0',
'text_en_4_5_0',
'text_es_4_5_0',
'text_fi_4_5_0',
'text_fr_4_5_0',
'text_it_4_5_0',
'text_nl_4_5_0',
'text_ru_4_5_0',
'text_uk_4_5_0',
]));
}
catch (\Exception $e) {
// Don't break the upgrade, ignore the error because it is just nice to have
// cleanup.
}
}
/**
* Install new Solr Field Types and uninstall search_api_solr_multilingual.
*/
function search_api_solr_post_update_8319() {
$module_handler = \Drupal::moduleHandler();
if ($module_handler->moduleExists('search_api_solr_multilingual')) {
/** @var \Drupal\Core\Extension\ModuleInstallerInterface $module_installer */
$module_installer = \Drupal::service('module_installer');
$module_installer->uninstall(['search_api_solr_multilingual']);
}
// module_load_include is required in case that no update_hooks were run
// before.
$module_handler->loadInclude('search_api_solr', 'install');
search_api_solr_update_helper_install_configs();
}
/**
* Install new Search API Solr Autocomplete.
*/
function search_api_solr_post_update_8320(): void {
if (\Drupal::moduleHandler()->moduleExists('search_api_autocomplete')) {
/** @var \Drupal\Core\Extension\ModuleInstallerInterface $module_installer */
$module_installer = \Drupal::service('module_installer');
$module_installer->install(['search_api_solr_autocomplete']);
}
}