-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathos2web_logging.install
executable file
·58 lines (52 loc) · 1.95 KB
/
os2web_logging.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
<?php
use Symfony\Component\Yaml\Yaml;
/**
* Helper function to update configuration.
*
* @param $config_name
* String.
*/
function os2web_logging_read_in_new_config($config_name) {
$path = \Drupal::service('extension.list.module')->getPath('os2web_logging');
/** @var \Drupal\Core\Config\StorageInterface $active_storage */
$active_storage = \Drupal::service('config.storage');
$active_storage->write($config_name, Yaml::parse(file_get_contents($path . '/config/install/' . $config_name . '.yml')));
}
/**
* Increase requiest_uri field length.
*/
function os2web_logging_update_8801() {
$field_spec = [
'type' => 'varchar',
'length' => '500',
];
\Drupal::database()->schema()->changeField('os2web_logging_access_log','request_uri', 'request_uri', $field_spec);
}
/**
* Disable date_popup module.
*/
function os2web_logging_update_8802() {
\Drupal::service('module_installer')->uninstall(['date_popup']);
}
/**
* Updating logs search view.
*/
function os2web_logging_update_8803() {
// Updating view.
os2web_logging_read_in_new_config('views.view.os2web_logging_access_logs');
}
/**
* Updating watchdog config.
*/
function os2web_logging_update_8804() {
$configName = 'os2web_logging_watchdog.settings';
$watchdogConfig = \Drupal::config('os2web_logging_watchdog.settings');
$store_period = $watchdogConfig->get('files_store_period');
$files_log_path = $watchdogConfig->get('files_log_path');
$dblog_enabled = $watchdogConfig->get('dblog_enabled');
$config_factory = \Drupal::configFactory();
$config_factory->getEditable('os2web_logging.settings')->set('watchdog_dblog_enabled', $dblog_enabled)->save();
$config_factory->getEditable('os2web_logging.settings')->set('watchdog_files_store_period', $store_period)->save();
$config_factory->getEditable('os2web_logging.settings')->set('watchdog_files_log_path', $files_log_path)->save();
Drupal::configFactory()->getEditable('os2web_logging_watchdog.settings')->delete();
}