26
26
27
27
use TYPO3 \CMS \Core \Messaging \FlashMessage ;
28
28
use TYPO3 \CMS \Core \Utility \GeneralUtility ;
29
-
29
+ use TYPO3 \ CMS \ Core \ Database \ DatabaseConnection ;
30
30
31
31
/**
32
32
* Index Queue Module
@@ -67,7 +67,7 @@ public function indexAction() {
67
67
* @return void
68
68
*/
69
69
public function initializeIndexQueueAction () {
70
- $ initializedIndexingConfigurations = array () ;
70
+ $ initializedIndexingConfigurations = [] ;
71
71
72
72
$ itemIndexQueue = GeneralUtility::makeInstance ('Tx_Solr_IndexQueue_Queue ' );
73
73
$ indexingConfigurationsToInitialize = GeneralUtility::_POST ('tx_solr-index-queue-initialization ' );
@@ -93,7 +93,7 @@ public function initializeIndexQueueAction() {
93
93
);
94
94
}
95
95
96
- $ messagesForConfigurations = array () ;
96
+ $ messagesForConfigurations = [] ;
97
97
foreach (array_keys ($ initializedIndexingConfigurations ) as $ indexingConfigurationName ) {
98
98
$ itemCount = $ itemIndexQueue ->getItemsCountBySite ($ this ->site , $ indexingConfigurationName );
99
99
if (!is_int ($ itemCount )) {
@@ -113,6 +113,32 @@ public function initializeIndexQueueAction() {
113
113
$ this ->forward ('index ' );
114
114
}
115
115
116
+ /**
117
+ * Removes all errors in the index queue list. So that the items can be indexed again.
118
+ *
119
+ * @return void
120
+ */
121
+ public function flushLogErrorsAction () {
122
+ /** @var DatabaseConnection $database */
123
+ $ database = $ GLOBALS ['TYPO3_DB ' ];
124
+ $ flushResult = $ database ->exec_UPDATEquery ('tx_solr_indexqueue_item ' , 'errors NOT LIKE "" ' , ['errors ' => '' ]);
125
+
126
+ $ message = 'All errors has been flushed ' ;
127
+ $ severity = FlashMessage::OK ;
128
+ if (!$ flushResult ) {
129
+ $ message = 'An error occured while removing the error log in the index queue. ' ;
130
+ $ severity = FlashMessage::ERROR ;
131
+ }
132
+
133
+ $ this ->addFlashMessage (
134
+ $ message ,
135
+ 'Index Queue errors ' ,
136
+ $ severity
137
+ );
138
+
139
+ $ this ->forward ('index ' );
140
+ }
141
+
116
142
/**
117
143
* Renders a field to select which indexing configurations to initialize.
118
144
*
@@ -142,7 +168,7 @@ protected function getIndexQueueStats() {
142
168
'pending, erroneous '
143
169
);
144
170
145
- $ stats = array () ;
171
+ $ stats = [] ;
146
172
foreach ($ indexQueueStats as $ row ) {
147
173
if ($ row ['erroneous ' ] == 1 ) {
148
174
$ stats ['erroneous ' ] = $ row ['count ' ];
0 commit comments