@@ -50,11 +50,11 @@ public function buildForm(array $form, FormStateInterface $form_state) {
50
50
'#open ' => TRUE ,
51
51
];
52
52
53
- $ form ['watchdog_db_details ' ]['dblog_enabled ' ] = [
53
+ $ form ['watchdog_db_details ' ]['watchdog_dblog_enabled ' ] = [
54
54
'#type ' => 'checkbox ' ,
55
55
'#title ' => $ this ->t ('DB Log enabled ' ),
56
56
'#description ' => $ this ->t ('If logs are to be stored in the database as dblog entries. ' ),
57
- '#default_value ' => $ config ->get ('dblog_enabled ' ) ?? TRUE ,
57
+ '#default_value ' => $ config ->get ('watchdog_dblog_enabled ' ) ?? TRUE ,
58
58
];
59
59
60
60
// Set up the link.
@@ -71,29 +71,29 @@ public function buildForm(array $form, FormStateInterface $form_state) {
71
71
->t ('Watchdog File logs ' ),
72
72
];
73
73
74
- $ form ['watchdog_files_details ' ]['files_store_period ' ] = [
74
+ $ form ['watchdog_files_details ' ]['watchdog_files_store_period ' ] = [
75
75
'#type ' => 'number ' ,
76
76
'#title ' => $ this ->t ('Store log files for this period ' ),
77
77
'#field_suffix ' => $ this ->t ('days ' ),
78
78
'#size ' => 5 ,
79
79
'#min ' => 180 ,
80
80
'#description ' => $ this ->t ('Log file will be stored for the selected number of days, after that they will be automatically deleted ' ),
81
- '#default_value ' => $ config ->get ('files_store_period ' ) ?? 180 ,
81
+ '#default_value ' => $ config ->get ('watchdog_files_store_period ' ) ?? 180 ,
82
82
];
83
83
84
- $ form ['watchdog_files_details ' ]['files_log_path ' ] = [
84
+ $ form ['watchdog_files_details ' ]['watchdog_files_log_path ' ] = [
85
85
'#type ' => 'textfield ' ,
86
86
'#title ' => $ this ->t ('Store log files directory ' ),
87
87
'#description ' => $ this ->t ('Log file will be stored for the selected number of days, after that they will be automatically deleted ' ),
88
- '#default_value ' => $ config ->get ('files_log_path ' ) ?? '../logs ' ,
88
+ '#default_value ' => $ config ->get ('watchdog_files_log_path ' ) ?? '../logs ' ,
89
89
'#field_suffix ' => '<em>/os2web_logging_watchdog-YYYY-MM-DD.log</em> ' ,
90
90
];
91
91
92
92
$ options = [];
93
- if ($ config ->get ('files_log_path ' )) {
93
+ if ($ config ->get ('watchdog_files_log_path ' )) {
94
94
/** @var FileSystemInterface $fileSystem */
95
95
$ fileSystem = \Drupal::service ('file_system ' );
96
- $ storedLogFiles = $ fileSystem ->scanDirectory ($ config ->get ('files_log_path ' ), '/os2web_logging_watchdog-\d{4}-\d{2}-\d{2}\.(log|gz)/ ' );
96
+ $ storedLogFiles = $ fileSystem ->scanDirectory ($ config ->get ('watchdog_files_log_path ' ), '/os2web_logging_watchdog-\d{4}-\d{2}-\d{2}\.(log|gz)/ ' );
97
97
98
98
foreach ($ storedLogFiles as $ file ) {
99
99
$ url = Url::fromRoute ('os2web_logging.logfile.download ' , ['filename ' => $ file ->filename ]);
@@ -123,7 +123,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
123
123
public function validateForm (array &$ form , FormStateInterface $ form_state ) {
124
124
parent ::validateForm ($ form , $ form_state );
125
125
126
- $ files_log_path = $ form_state ->getValue ('files_log_path ' );
126
+ $ files_log_path = $ form_state ->getValue ('watchdog_files_log_path ' );
127
127
128
128
$ exists = \Drupal::service ('file_system ' )->prepareDirectory ($ files_log_path , FileSystemInterface::MODIFY_PERMISSIONS );
129
129
if (!$ exists ) {
@@ -137,9 +137,9 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
137
137
public function submitForm (array &$ form , FormStateInterface $ form_state ) {
138
138
// Saving values.
139
139
$ config = $ this ->config (WatchdogSettingsForm::$ configName );
140
- $ old_files_store_period = $ config ->get ('files_store_period ' );
141
- $ old_files_store_path = $ config ->get ('files_log_path ' );
142
- $ old_dblog_enabled = $ config ->get ('dblog_enabled ' );
140
+ $ old_files_store_period = $ config ->get ('watchdog_files_store_period ' );
141
+ $ old_files_store_path = $ config ->get ('watchdog_files_log_path ' );
142
+ $ old_dblog_enabled = $ config ->get ('watchdog_dblog_enabled ' );
143
143
144
144
$ values = $ form_state ->getValues ();
145
145
foreach ($ values as $ key => $ value ) {
@@ -149,9 +149,9 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
149
149
150
150
// Rebuilding cache only if 'files_store_period' or 'files_log_path'
151
151
// changed. New setting requires cache to be rebuilt.
152
- if ($ old_files_store_period != $ config ->get ('files_store_period ' ) ||
153
- $ old_files_store_path != $ config ->get ('files_log_path ' ) ||
154
- $ old_dblog_enabled != $ config ->get ('dblog_enabled ' )) {
152
+ if ($ old_files_store_period != $ config ->get ('watchdog_files_store_period ' ) ||
153
+ $ old_files_store_path != $ config ->get ('watchdog_files_log_path ' ) ||
154
+ $ old_dblog_enabled != $ config ->get ('watchdog_dblog_enabled ' )) {
155
155
156
156
// Rebuild module and theme data.
157
157
$ module_data = \Drupal::service ('extension.list.module ' )->getList ();
0 commit comments