Completed
Push — issue/174 ( 5f2a16 )
by Tomas Norre
11:34
created
modfunc1/class.tx_crawler_modfunc1.php 1 patch
Indentation   +942 added lines, -942 removed lines patch added patch discarded remove patch
@@ -28,126 +28,126 @@  discard block
 block discarded – undo
28 28
  * Class tx_crawler_modfunc1
29 29
  */
30 30
 class tx_crawler_modfunc1 extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule {
31
-		// Internal, dynamic:
32
-	var $duplicateTrack = array();
33
-	var $submitCrawlUrls = FALSE;
34
-	var $downloadCrawlUrls = FALSE;
35
-
36
-	var $scheduledTime = 0;
37
-	var $reqMinute = 0;
38
-
39
-	/**
40
-	 * @var array holds the selection of configuration from the configuration selector box
41
-	 */
42
-	var $incomingConfigurationSelection = array();
43
-
44
-	/**
45
-	 * @var tx_crawler_lib
46
-	 */
47
-	var $crawlerObj;
48
-
49
-	var $CSVaccu = array();
50
-
51
-	/**
52
-	 * If true the user requested a CSV export of the queue
53
-	 *
54
-	 * @var boolean
55
-	 */
56
-	var $CSVExport = FALSE;
57
-
58
-	var $downloadUrls = array();
59
-
60
-	/**
61
-	 * Holds the configuration from ext_conf_template loaded by loadExtensionSettings()
62
-	 *
63
-	 * @var array
64
-	 */
65
-	protected $extensionSettings = array();
66
-
67
-	/**
68
-	 * Indicate that an flash message with an error is present.
69
-	 *
70
-	 * @var boolean
71
-	 */
72
-	protected $isErrorDetected = false;
73
-
74
-	/**
75
-	 * the constructor
76
-	 */
77
-	public function __construct() {
78
-		$this->processManager = new tx_crawler_domain_process_manager();
79
-	}
80
-
81
-	/**
82
-	 * Additions to the function menu array
83
-	 *
84
-	 * @return	array		Menu array
85
-	 */
86
-	function modMenu()	{
87
-		global $LANG;
88
-
89
-		return array (
90
-			'depth' => array(
91
-				0 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_0'),
92
-				1 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_1'),
93
-				2 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_2'),
94
-				3 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_3'),
95
-				4 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_4'),
96
-				99 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_infi'),
97
-			),
98
-			'crawlaction' => array(
99
-				'start' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.start'),
100
-				'log' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.log'),
101
-				'multiprocess' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.multiprocess')
102
-			),
103
-			'log_resultLog' => '',
104
-			'log_feVars' => '',
105
-			'processListMode' => '',
106
-			'log_display' => array(
107
-				'all' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.all'),
108
-				'pending' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pending'),
109
-				'finished' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.finished')
110
-			),
111
-			'itemsPerPage' => array(
112
-				'5' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.5'),
113
-				'10' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.10'),
114
-				'50' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.50'),
115
-				'0' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.0')
116
-			)
117
-		);
118
-	}
119
-
120
-	/**
121
-	 * Load extension settings
122
-	 *
123
-	 * @param void
124
-	 * @return void
125
-	 */
126
-	protected function loadExtensionSettings() {
127
-		$this->extensionSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['crawler']);
128
-	}
129
-
130
-	/**
131
-	 * Main function
132
-	 *
133
-	 * @return	string		HTML output
134
-	 */
135
-	function main() {
136
-		global $LANG, $BACK_PATH;
137
-
138
-		$this->incLocalLang();
139
-
140
-		$this->loadExtensionSettings();
141
-		if (empty($this->pObj->MOD_SETTINGS['processListMode'])) {
142
-			$this->pObj->MOD_SETTINGS['processListMode'] = 'simple';
143
-		}
31
+        // Internal, dynamic:
32
+    var $duplicateTrack = array();
33
+    var $submitCrawlUrls = FALSE;
34
+    var $downloadCrawlUrls = FALSE;
35
+
36
+    var $scheduledTime = 0;
37
+    var $reqMinute = 0;
38
+
39
+    /**
40
+     * @var array holds the selection of configuration from the configuration selector box
41
+     */
42
+    var $incomingConfigurationSelection = array();
43
+
44
+    /**
45
+     * @var tx_crawler_lib
46
+     */
47
+    var $crawlerObj;
48
+
49
+    var $CSVaccu = array();
50
+
51
+    /**
52
+     * If true the user requested a CSV export of the queue
53
+     *
54
+     * @var boolean
55
+     */
56
+    var $CSVExport = FALSE;
57
+
58
+    var $downloadUrls = array();
59
+
60
+    /**
61
+     * Holds the configuration from ext_conf_template loaded by loadExtensionSettings()
62
+     *
63
+     * @var array
64
+     */
65
+    protected $extensionSettings = array();
66
+
67
+    /**
68
+     * Indicate that an flash message with an error is present.
69
+     *
70
+     * @var boolean
71
+     */
72
+    protected $isErrorDetected = false;
73
+
74
+    /**
75
+     * the constructor
76
+     */
77
+    public function __construct() {
78
+        $this->processManager = new tx_crawler_domain_process_manager();
79
+    }
80
+
81
+    /**
82
+     * Additions to the function menu array
83
+     *
84
+     * @return	array		Menu array
85
+     */
86
+    function modMenu()	{
87
+        global $LANG;
88
+
89
+        return array (
90
+            'depth' => array(
91
+                0 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_0'),
92
+                1 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_1'),
93
+                2 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_2'),
94
+                3 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_3'),
95
+                4 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_4'),
96
+                99 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_infi'),
97
+            ),
98
+            'crawlaction' => array(
99
+                'start' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.start'),
100
+                'log' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.log'),
101
+                'multiprocess' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.multiprocess')
102
+            ),
103
+            'log_resultLog' => '',
104
+            'log_feVars' => '',
105
+            'processListMode' => '',
106
+            'log_display' => array(
107
+                'all' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.all'),
108
+                'pending' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pending'),
109
+                'finished' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.finished')
110
+            ),
111
+            'itemsPerPage' => array(
112
+                '5' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.5'),
113
+                '10' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.10'),
114
+                '50' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.50'),
115
+                '0' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.0')
116
+            )
117
+        );
118
+    }
119
+
120
+    /**
121
+     * Load extension settings
122
+     *
123
+     * @param void
124
+     * @return void
125
+     */
126
+    protected function loadExtensionSettings() {
127
+        $this->extensionSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['crawler']);
128
+    }
129
+
130
+    /**
131
+     * Main function
132
+     *
133
+     * @return	string		HTML output
134
+     */
135
+    function main() {
136
+        global $LANG, $BACK_PATH;
137
+
138
+        $this->incLocalLang();
139
+
140
+        $this->loadExtensionSettings();
141
+        if (empty($this->pObj->MOD_SETTINGS['processListMode'])) {
142
+            $this->pObj->MOD_SETTINGS['processListMode'] = 'simple';
143
+        }
144 144
 
145
-			// Set CSS styles specific for this document:
146
-		$this->pObj->content = str_replace('/*###POSTCSSMARKER###*/','
145
+            // Set CSS styles specific for this document:
146
+        $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/','
147 147
 			TABLE.c-list TR TD { white-space: nowrap; vertical-align: top; }
148 148
 		',$this->pObj->content);
149 149
 
150
-		$this->pObj->content .= '<style type="text/css"><!--
150
+        $this->pObj->content .= '<style type="text/css"><!--
151 151
 			table.url-table,
152 152
 			table.param-expanded,
153 153
 			table.crawlerlog {
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
 		<link rel="stylesheet" type="text/css" href="'.$BACK_PATH.'../typo3conf/ext/crawler/template/res.css" />
166 166
 		';
167 167
 
168
-			// Type function menu:
169
-		$h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
170
-			$this->pObj->id,
171
-			'SET[crawlaction]',
172
-			$this->pObj->MOD_SETTINGS['crawlaction'],
173
-			$this->pObj->MOD_MENU['crawlaction'],
174
-			'index.php'
175
-		);
168
+            // Type function menu:
169
+        $h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
170
+            $this->pObj->id,
171
+            'SET[crawlaction]',
172
+            $this->pObj->MOD_SETTINGS['crawlaction'],
173
+            $this->pObj->MOD_MENU['crawlaction'],
174
+            'index.php'
175
+        );
176 176
 
177
-		/*
177
+        /*
178 178
 			// Showing depth-menu in certain cases:
179 179
 		if ($this->pObj->MOD_SETTINGS['crawlaction']!=='cli' && $this->pObj->MOD_SETTINGS['crawlaction']!== 'multiprocess' && ($this->pObj->MOD_SETTINGS['crawlaction']!=='log' || $this->pObj->id))	{
180 180
 			$h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
@@ -187,63 +187,63 @@  discard block
 block discarded – undo
187 187
 		}
188 188
 		*/
189 189
 
190
-			// Additional menus for the log type:
191
-		if ($this->pObj->MOD_SETTINGS['crawlaction']==='log')	{
192
-			$h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
193
-				$this->pObj->id,
194
-				'SET[depth]',
195
-				$this->pObj->MOD_SETTINGS['depth'],
196
-				$this->pObj->MOD_MENU['depth'],
197
-				'index.php'
198
-			);
190
+            // Additional menus for the log type:
191
+        if ($this->pObj->MOD_SETTINGS['crawlaction']==='log')	{
192
+            $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
193
+                $this->pObj->id,
194
+                'SET[depth]',
195
+                $this->pObj->MOD_SETTINGS['depth'],
196
+                $this->pObj->MOD_MENU['depth'],
197
+                'index.php'
198
+            );
199
+
200
+            $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : '';
201
+
202
+            $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
203
+
204
+            $h_func.= '<hr/>'.
205
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id,'SET[log_display]',$this->pObj->MOD_SETTINGS['log_display'],$this->pObj->MOD_MENU['log_display'],'index.php','&setID='.$setId) . ' - ' .
206
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_resultLog]',$this->pObj->MOD_SETTINGS['log_resultLog'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
207
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_feVars]',$this->pObj->MOD_SETTINGS['log_feVars'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
208
+                    $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' .
209
+                    \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
210
+                        $this->pObj->id,
211
+                        'SET[itemsPerPage]',
212
+                        $this->pObj->MOD_SETTINGS['itemsPerPage'],
213
+                        $this->pObj->MOD_MENU['itemsPerPage'],
214
+                        'index.php'
215
+                    );
216
+        }
199 217
 
200
-			$quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : '';
201
-
202
-			$setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
203
-
204
-			$h_func.= '<hr/>'.
205
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id,'SET[log_display]',$this->pObj->MOD_SETTINGS['log_display'],$this->pObj->MOD_MENU['log_display'],'index.php','&setID='.$setId) . ' - ' .
206
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_resultLog]',$this->pObj->MOD_SETTINGS['log_resultLog'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
207
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_feVars]',$this->pObj->MOD_SETTINGS['log_feVars'],'index.php','&setID='.$setId . $quiPart) . ' - ' .
208
-					$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' .
209
-					\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu(
210
-						$this->pObj->id,
211
-						'SET[itemsPerPage]',
212
-						$this->pObj->MOD_SETTINGS['itemsPerPage'],
213
-						$this->pObj->MOD_MENU['itemsPerPage'],
214
-						'index.php'
215
-					);
216
-		}
218
+        $theOutput= $this->pObj->doc->spacer(5);
219
+        $theOutput.= $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1);
217 220
 
218
-		$theOutput= $this->pObj->doc->spacer(5);
219
-		$theOutput.= $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1);
220
-
221
-			// Branch based on type:
222
-		switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) {
223
-			case 'start':
224
-				if (empty($this->pObj->id)) {
225
-					$this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
226
-				} else {
227
-					$theOutput .= $this->pObj->doc->section('', $this->drawURLs(), 0, 1);
228
-				}
229
-				break;
230
-			case 'log':
231
-				if (empty($this->pObj->id)) {
232
-					$this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
233
-				} else {
234
-					$theOutput .= $this->pObj->doc->section('', $this->drawLog(), 0, 1);
235
-				}
236
-				break;
237
-			case 'cli':
238
-				$theOutput .= $this->pObj->doc->section('', $this->drawCLIstatus(), 0, 1);
239
-				break;
240
-			case 'multiprocess':
241
-				$theOutput .= $this->pObj->doc->section('', $this->drawProcessOverviewAction(), 0, 1);
242
-				break;
243
-		}
221
+            // Branch based on type:
222
+        switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) {
223
+            case 'start':
224
+                if (empty($this->pObj->id)) {
225
+                    $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
226
+                } else {
227
+                    $theOutput .= $this->pObj->doc->section('', $this->drawURLs(), 0, 1);
228
+                }
229
+                break;
230
+            case 'log':
231
+                if (empty($this->pObj->id)) {
232
+                    $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected'));
233
+                } else {
234
+                    $theOutput .= $this->pObj->doc->section('', $this->drawLog(), 0, 1);
235
+                }
236
+                break;
237
+            case 'cli':
238
+                $theOutput .= $this->pObj->doc->section('', $this->drawCLIstatus(), 0, 1);
239
+                break;
240
+            case 'multiprocess':
241
+                $theOutput .= $this->pObj->doc->section('', $this->drawProcessOverviewAction(), 0, 1);
242
+                break;
243
+        }
244 244
 
245
-		return $theOutput;
246
-	}
245
+        return $theOutput;
246
+    }
247 247
 
248 248
 
249 249
 
@@ -256,176 +256,176 @@  discard block
 block discarded – undo
256 256
 
257 257
 
258 258
 
259
-	/*******************************
259
+    /*******************************
260 260
 	 *
261 261
 	 * Generate URLs for crawling:
262 262
 	 *
263 263
 	 ******************************/
264 264
 
265
-	/**
266
-	 * Produces a table with overview of the URLs to be crawled for each page
267
-	 *
268
-	 * @return	string		HTML output
269
-	 */
270
-	function drawURLs()	{
271
-		global $BACK_PATH, $BE_USER;
272
-
273
-			// Init:
274
-		$this->duplicateTrack = array();
275
-		$this->submitCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_crawl');
276
-		$this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download');
277
-		$this->makeCrawlerProcessableChecks();
278
-
279
-		switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp'))	{
280
-			case 'midnight':
281
-				$this->scheduledTime = mktime(0,0,0);
282
-			break;
283
-			case '04:00':
284
-				$this->scheduledTime = mktime(0,0,0)+4*3600;
285
-			break;
286
-			case 'now':
287
-			default:
288
-				$this->scheduledTime = time();
289
-			break;
290
-		}
291
-		// $this->reqMinute = \TYPO3\CMS\Core\Utility\GeneralUtility::intInRange(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('perminute'),1,10000);
292
-		// TODO: check relevance
293
-		$this->reqMinute = 1000;
265
+    /**
266
+     * Produces a table with overview of the URLs to be crawled for each page
267
+     *
268
+     * @return	string		HTML output
269
+     */
270
+    function drawURLs()	{
271
+        global $BACK_PATH, $BE_USER;
272
+
273
+            // Init:
274
+        $this->duplicateTrack = array();
275
+        $this->submitCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_crawl');
276
+        $this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download');
277
+        $this->makeCrawlerProcessableChecks();
278
+
279
+        switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp'))	{
280
+            case 'midnight':
281
+                $this->scheduledTime = mktime(0,0,0);
282
+            break;
283
+            case '04:00':
284
+                $this->scheduledTime = mktime(0,0,0)+4*3600;
285
+            break;
286
+            case 'now':
287
+            default:
288
+                $this->scheduledTime = time();
289
+            break;
290
+        }
291
+        // $this->reqMinute = \TYPO3\CMS\Core\Utility\GeneralUtility::intInRange(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('perminute'),1,10000);
292
+        // TODO: check relevance
293
+        $this->reqMinute = 1000;
294 294
 
295 295
 
296
-		$this->incomingConfigurationSelection = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('configurationSelection');
297
-		$this->incomingConfigurationSelection = is_array($this->incomingConfigurationSelection) ? $this->incomingConfigurationSelection : array('');
296
+        $this->incomingConfigurationSelection = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('configurationSelection');
297
+        $this->incomingConfigurationSelection = is_array($this->incomingConfigurationSelection) ? $this->incomingConfigurationSelection : array('');
298 298
 
299
-		$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
300
-		$this->crawlerObj->setAccessMode('gui');
301
-		$this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
299
+        $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
300
+        $this->crawlerObj->setAccessMode('gui');
301
+        $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
302 302
 
303
-		if (empty($this->incomingConfigurationSelection)
304
-			|| (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0]))
305
-			) {
306
-			$code= '
303
+        if (empty($this->incomingConfigurationSelection)
304
+            || (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0]))
305
+            ) {
306
+            $code= '
307 307
 			<tr>
308 308
 				<td colspan="7"><b>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noConfigSelected').'</b></td>
309 309
 			</tr>';
310
-		} else {
311
-			if($this->submitCrawlUrls){
312
-				$reason = new tx_crawler_domain_reason();
313
-				$reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT);
314
-
315
-				if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; }
316
-				$reason->setDetailText('The user '.$username.' added pages to the crawler queue manually ');
317
-
318
-				tx_crawler_domain_events_dispatcher::getInstance()->post(	'invokeQueueChange',
319
-																			$this->findCrawler()->setID,
320
-																			array(	'reason' => $reason ));
321
-			}
322
-
323
-			$code = $this->crawlerObj->getPageTreeAndUrls(
324
-				$this->pObj->id,
325
-				$this->pObj->MOD_SETTINGS['depth'],
326
-				$this->scheduledTime,
327
-				$this->reqMinute,
328
-				$this->submitCrawlUrls,
329
-				$this->downloadCrawlUrls,
330
-				array(), // Do not filter any processing instructions
331
-				$this->incomingConfigurationSelection
332
-			);
310
+        } else {
311
+            if($this->submitCrawlUrls){
312
+                $reason = new tx_crawler_domain_reason();
313
+                $reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT);
314
+
315
+                if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; }
316
+                $reason->setDetailText('The user '.$username.' added pages to the crawler queue manually ');
317
+
318
+                tx_crawler_domain_events_dispatcher::getInstance()->post(	'invokeQueueChange',
319
+                                                                            $this->findCrawler()->setID,
320
+                                                                            array(	'reason' => $reason ));
321
+            }
322
+
323
+            $code = $this->crawlerObj->getPageTreeAndUrls(
324
+                $this->pObj->id,
325
+                $this->pObj->MOD_SETTINGS['depth'],
326
+                $this->scheduledTime,
327
+                $this->reqMinute,
328
+                $this->submitCrawlUrls,
329
+                $this->downloadCrawlUrls,
330
+                array(), // Do not filter any processing instructions
331
+                $this->incomingConfigurationSelection
332
+            );
333 333
 
334 334
 
335
-		}
335
+        }
336 336
 
337
-		$this->downloadUrls = $this->crawlerObj->downloadUrls;
338
-		$this->duplicateTrack = $this->crawlerObj->duplicateTrack;
337
+        $this->downloadUrls = $this->crawlerObj->downloadUrls;
338
+        $this->duplicateTrack = $this->crawlerObj->duplicateTrack;
339 339
 
340
-		$output = '';
341
-		if ($code)	{
340
+        $output = '';
341
+        if ($code)	{
342 342
 
343
-			$output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>';
344
-			$output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />';
343
+            $output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>';
344
+            $output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />';
345 345
 
346
-			if (!$this->submitCrawlUrls)	{
347
-				$output .= $this->drawURLs_cfgSelectors().'<br />';
348
-				$output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> ';
349
-				$output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> ';
350
-				$output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />';
351
-				$output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />';
352
-				$output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />';
353
-				$output .= '<br />
346
+            if (!$this->submitCrawlUrls)	{
347
+                $output .= $this->drawURLs_cfgSelectors().'<br />';
348
+                $output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> ';
349
+                $output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> ';
350
+                $output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />';
351
+                $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />';
352
+                $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />';
353
+                $output .= '<br />
354 354
 					<table class="lrPadding c-list url-table">'.
355
-						$this->drawURLs_printTableHeader().
356
-						$code.
357
-					'</table>';
358
-			} else {
359
-				$output .= count(array_keys($this->duplicateTrack)).' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.submitted').'. <br /><br />';
360
-				$output .= '<input type="submit" name="_" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continue').'" />';
361
-				$output .= '<input type="submit" onclick="this.form.elements[\'SET[crawlaction]\'].value=\'log\';" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continueinlog').'" />';
362
-			}
363
-		}
364
-
365
-			// Download Urls to crawl:
366
-		if ($this->downloadCrawlUrls)	{
367
-
368
-				// Creating output header:
369
-			$mimeType = 'application/octet-stream';
370
-			Header('Content-Type: '.$mimeType);
371
-			Header('Content-Disposition: attachment; filename=CrawlerUrls.txt');
372
-
373
-				// Printing the content of the CSV lines:
374
-			echo implode(chr(13).chr(10),$this->downloadUrls);
375
-
376
-				// Exits:
377
-			exit;
378
-		}
379
-
380
-			// Return output:
381
-		return 	$output;
382
-	}
355
+                        $this->drawURLs_printTableHeader().
356
+                        $code.
357
+                    '</table>';
358
+            } else {
359
+                $output .= count(array_keys($this->duplicateTrack)).' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.submitted').'. <br /><br />';
360
+                $output .= '<input type="submit" name="_" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continue').'" />';
361
+                $output .= '<input type="submit" onclick="this.form.elements[\'SET[crawlaction]\'].value=\'log\';" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continueinlog').'" />';
362
+            }
363
+        }
383 364
 
384
-	/**
385
-	 * Draws the configuration selectors for compiling URLs:
386
-	 *
387
-	 * @return	string		HTML table
388
-	 */
389
-	function drawURLs_cfgSelectors()	{
365
+            // Download Urls to crawl:
366
+        if ($this->downloadCrawlUrls)	{
390 367
 
391
-			// depth
392
-		$cell[] = $this->selectorBox(
393
-			array(
394
-				0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_0'),
395
-				1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_1'),
396
-				2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_2'),
397
-				3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_3'),
398
-				4 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_4'),
399
-				99 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_infi'),
400
-			),
401
-			'SET[depth]',
402
-			$this->pObj->MOD_SETTINGS['depth'],
403
-			0
404
-		);
405
-		$availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 );
368
+                // Creating output header:
369
+            $mimeType = 'application/octet-stream';
370
+            Header('Content-Type: '.$mimeType);
371
+            Header('Content-Disposition: attachment; filename=CrawlerUrls.txt');
406 372
 
407
-			// Configurations
408
-		$cell[] = $this->selectorBox(
409
-			empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations),
410
-			'configurationSelection',
411
-			$this->incomingConfigurationSelection,
412
-			1
413
-		);
373
+                // Printing the content of the CSV lines:
374
+            echo implode(chr(13).chr(10),$this->downloadUrls);
414 375
 
415
-			// Scheduled time:
416
-		$cell[] = $this->selectorBox(
417
-			array(
418
-				'now' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.now'),
419
-				'midnight' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.midnight'),
420
-				'04:00' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.4am'),
421
-			),
422
-			'tstamp',
423
-			\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('tstamp'),
424
-			0
425
-		);
376
+                // Exits:
377
+            exit;
378
+        }
426 379
 
427
-		// TODO: check relevance
428
-		/*
380
+            // Return output:
381
+        return 	$output;
382
+    }
383
+
384
+    /**
385
+     * Draws the configuration selectors for compiling URLs:
386
+     *
387
+     * @return	string		HTML table
388
+     */
389
+    function drawURLs_cfgSelectors()	{
390
+
391
+            // depth
392
+        $cell[] = $this->selectorBox(
393
+            array(
394
+                0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_0'),
395
+                1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_1'),
396
+                2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_2'),
397
+                3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_3'),
398
+                4 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_4'),
399
+                99 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_infi'),
400
+            ),
401
+            'SET[depth]',
402
+            $this->pObj->MOD_SETTINGS['depth'],
403
+            0
404
+        );
405
+        $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 );
406
+
407
+            // Configurations
408
+        $cell[] = $this->selectorBox(
409
+            empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations),
410
+            'configurationSelection',
411
+            $this->incomingConfigurationSelection,
412
+            1
413
+        );
414
+
415
+            // Scheduled time:
416
+        $cell[] = $this->selectorBox(
417
+            array(
418
+                'now' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.now'),
419
+                'midnight' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.midnight'),
420
+                '04:00' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.4am'),
421
+            ),
422
+            'tstamp',
423
+            \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('tstamp'),
424
+            0
425
+        );
426
+
427
+        // TODO: check relevance
428
+        /*
429 429
 			// Requests per minute:
430 430
 		$cell[] = $this->selectorBox(
431 431
 			array(
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 		);
447 447
 		*/
448 448
 
449
-		$output = '
449
+        $output = '
450 450
 			<table class="lrPadding c-list">
451 451
 				<tr class="bgColor5 tableheader">
452 452
 					<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.depth').':</td>
@@ -459,17 +459,17 @@  discard block
 block discarded – undo
459 459
 				</tr>
460 460
 			</table>';
461 461
 
462
-		return $output;
463
-	}
462
+        return $output;
463
+    }
464 464
 
465
-	/**
466
-	 * Create Table header row for URL display
467
-	 *
468
-	 * @return	string		Table header
469
-	 */
470
-	function drawURLs_printTableHeader()	{
465
+    /**
466
+     * Create Table header row for URL display
467
+     *
468
+     * @return	string		Table header
469
+     */
470
+    function drawURLs_printTableHeader()	{
471 471
 
472
-		$content = '
472
+        $content = '
473 473
 			<tr class="bgColor5 tableheader">
474 474
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pagetitle').':</td>
475 475
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.key').':</td>
@@ -480,8 +480,8 @@  discard block
 block discarded – undo
480 480
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.parameters').':</td>
481 481
 			</tr>';
482 482
 
483
-		return $content;
484
-	}
483
+        return $content;
484
+    }
485 485
 
486 486
 
487 487
 
@@ -494,109 +494,109 @@  discard block
 block discarded – undo
494 494
 
495 495
 
496 496
 
497
-	/*******************************
497
+    /*******************************
498 498
 	 *
499 499
 	 * Shows log of indexed URLs
500 500
 	 *
501 501
 	 ******************************/
502 502
 
503
-	/**
504
-	 * Shows the log of indexed URLs
505
-	 *
506
-	 * @return	string		HTML output
507
-	 */
508
-	function drawLog()	{
509
-		global $BACK_PATH;
510
-		$output = '';
511
-
512
-			// Init:
513
-		$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
514
-		$this->crawlerObj->setAccessMode('gui');
515
-		$this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
516
-
517
-		$this->CSVExport = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_csv');
518
-
519
-			// Read URL:
520
-		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read'))	{
521
-			$this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE);
522
-		}
503
+    /**
504
+     * Shows the log of indexed URLs
505
+     *
506
+     * @return	string		HTML output
507
+     */
508
+    function drawLog()	{
509
+        global $BACK_PATH;
510
+        $output = '';
511
+
512
+            // Init:
513
+        $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
514
+        $this->crawlerObj->setAccessMode('gui');
515
+        $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
516
+
517
+        $this->CSVExport = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_csv');
518
+
519
+            // Read URL:
520
+        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read'))	{
521
+            $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE);
522
+        }
523 523
 
524
-			// Look for set ID sent - if it is, we will display contents of that set:
525
-		$showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
524
+            // Look for set ID sent - if it is, we will display contents of that set:
525
+        $showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
526 526
 
527
-			// Show details:
528
-		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))	{
527
+            // Show details:
528
+        if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))	{
529 529
 
530
-				// Get entry record:
531
-			list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')));
530
+                // Get entry record:
531
+            list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')));
532 532
 
533
-				// Explode values:
534
-				$resStatus = $this->getResStatus($q_entry);
535
-			$q_entry['parameters'] = unserialize($q_entry['parameters']);
536
-			$q_entry['result_data'] = unserialize($q_entry['result_data']);
537
-			if (is_array($q_entry['result_data']))	{
538
-				$q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']);
539
-			}
533
+                // Explode values:
534
+                $resStatus = $this->getResStatus($q_entry);
535
+            $q_entry['parameters'] = unserialize($q_entry['parameters']);
536
+            $q_entry['result_data'] = unserialize($q_entry['result_data']);
537
+            if (is_array($q_entry['result_data']))	{
538
+                $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']);
539
+            }
540 540
 
541
-			if(!$this->pObj->MOD_SETTINGS['log_resultLog']) {
542
-				unset($q_entry['result_data']['content']['log']);
543
-			}
541
+            if(!$this->pObj->MOD_SETTINGS['log_resultLog']) {
542
+                unset($q_entry['result_data']['content']['log']);
543
+            }
544 544
 
545
-				// Print rudimentary details:
546
-			$output .= '
545
+                // Print rudimentary details:
546
+            $output .= '
547 547
 				<br /><br />
548 548
 				<input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" />
549 549
 				<input type="hidden" value="' . $this->pObj->id . '" name="id" />
550 550
 				<input type="hidden" value="' . $showSetId . '" name="setID" />
551 551
 				<br />
552 552
 				Current server time: ' . date('H:i:s', time()) . '<br />' .
553
-				'Status: ' . $resStatus . '<br />' .
554
-				\TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry);
555
-		} else {	// Show list:
556
-
557
-				// If either id or set id, show list:
558
-			if ($this->pObj->id || $showSetId)	{
559
-				if ($this->pObj->id)	{
560
-						// Drawing tree:
561
-					$tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
562
-					$perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
563
-					$tree->init('AND '.$perms_clause);
564
-
565
-						// Set root row:
566
-					$HTML = \AOE\Crawler\Utility\IconUtility::getIconForRecord('pages', $this->pObj->pageinfo);
567
-					$tree->tree[] = Array(
568
-						'row' => $this->pObj->pageinfo,
569
-						'HTML' => $HTML
570
-					);
571
-
572
-						// Get branch beneath:
573
-					if ($this->pObj->MOD_SETTINGS['depth'])	{
574
-						$tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
575
-					}
576
-
577
-						// Traverse page tree:
578
-					$code = ''; $count = 0;
579
-					foreach($tree->tree as $data)	{
580
-						$code .= $this->drawLog_addRows(
581
-									$data['row'],
582
-									$data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE),
583
-									intval($this->pObj->MOD_SETTINGS['itemsPerPage'])
584
-								);
585
-						if (++$count == 1000) {
586
-							break;
587
-						}
588
-					}
589
-				} else {
590
-					$code = '';
591
-					$code.= $this->drawLog_addRows(
592
-								$showSetId,
593
-								'Set ID: '.$showSetId
594
-							);
595
-				}
596
-
597
-				if ($code)	{
598
-
599
-					$output .= '
553
+                'Status: ' . $resStatus . '<br />' .
554
+                \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry);
555
+        } else {	// Show list:
556
+
557
+                // If either id or set id, show list:
558
+            if ($this->pObj->id || $showSetId)	{
559
+                if ($this->pObj->id)	{
560
+                        // Drawing tree:
561
+                    $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
562
+                    $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
563
+                    $tree->init('AND '.$perms_clause);
564
+
565
+                        // Set root row:
566
+                    $HTML = \AOE\Crawler\Utility\IconUtility::getIconForRecord('pages', $this->pObj->pageinfo);
567
+                    $tree->tree[] = Array(
568
+                        'row' => $this->pObj->pageinfo,
569
+                        'HTML' => $HTML
570
+                    );
571
+
572
+                        // Get branch beneath:
573
+                    if ($this->pObj->MOD_SETTINGS['depth'])	{
574
+                        $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
575
+                    }
576
+
577
+                        // Traverse page tree:
578
+                    $code = ''; $count = 0;
579
+                    foreach($tree->tree as $data)	{
580
+                        $code .= $this->drawLog_addRows(
581
+                                    $data['row'],
582
+                                    $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE),
583
+                                    intval($this->pObj->MOD_SETTINGS['itemsPerPage'])
584
+                                );
585
+                        if (++$count == 1000) {
586
+                            break;
587
+                        }
588
+                    }
589
+                } else {
590
+                    $code = '';
591
+                    $code.= $this->drawLog_addRows(
592
+                                $showSetId,
593
+                                'Set ID: '.$showSetId
594
+                            );
595
+                }
596
+
597
+                if ($code)	{
598
+
599
+                    $output .= '
600 600
 						<br /><br />
601 601
 						<input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.reloadlist').'" name="_reload" />
602 602
 						<input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.downloadcsv').'" name="_csv" />
@@ -610,20 +610,20 @@  discard block
 block discarded – undo
610 610
 
611 611
 
612 612
 						<table class="lrPadding c-list crawlerlog">'.
613
-							$this->drawLog_printTableHeader().
614
-							$code.
615
-						'</table>';
616
-				}
617
-			} else {	// Otherwise show available sets:
618
-				$setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
619
-								'set_id, count(*) as count_value, scheduled',
620
-								'tx_crawler_queue',
621
-								'',
622
-								'set_id, scheduled',
623
-								'scheduled DESC'
624
-							);
625
-
626
-				$code = '
613
+                            $this->drawLog_printTableHeader().
614
+                            $code.
615
+                        '</table>';
616
+                }
617
+            } else {	// Otherwise show available sets:
618
+                $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
619
+                                'set_id, count(*) as count_value, scheduled',
620
+                                'tx_crawler_queue',
621
+                                '',
622
+                                'set_id, scheduled',
623
+                                'scheduled DESC'
624
+                            );
625
+
626
+                $code = '
627 627
 					<tr class="bgColor5 tableheader">
628 628
 						<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid').':</td>
629 629
 						<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').'t:</td>
@@ -631,9 +631,9 @@  discard block
 block discarded – undo
631 631
 					</tr>
632 632
 				';
633 633
 
634
-				$cc=0;
635
-				foreach($setList as $set)	{
636
-					$code.= '
634
+                $cc=0;
635
+                foreach($setList as $set)	{
636
+                    $code.= '
637 637
 						<tr class="bgColor'.($cc%2 ? '-20':'-10').'">
638 638
 							<td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td>
639 639
 							<td>'.$set['count_value'].'</td>
@@ -641,217 +641,217 @@  discard block
 block discarded – undo
641 641
 						</tr>
642 642
 					';
643 643
 
644
-					$cc++;
645
-				}
644
+                    $cc++;
645
+                }
646 646
 
647
-				$output .= '
647
+                $output .= '
648 648
 					<br /><br />
649 649
 					<table class="lrPadding c-list">'.
650
-						$code.
651
-					'</table>';
652
-			}
653
-		}
650
+                        $code.
651
+                    '</table>';
652
+            }
653
+        }
654 654
 
655
-		if($this->CSVExport) {
656
-			$this->outputCsvFile();
657
-		}
655
+        if($this->CSVExport) {
656
+            $this->outputCsvFile();
657
+        }
658 658
 
659
-			// Return output
660
-		return 	$output;
661
-	}
659
+            // Return output
660
+        return 	$output;
661
+    }
662 662
 
663
-	/**
664
-	 * Outputs the CSV file and sets the correct headers
665
-	 */
666
-	protected function outputCsvFile() {
663
+    /**
664
+     * Outputs the CSV file and sets the correct headers
665
+     */
666
+    protected function outputCsvFile() {
667 667
 
668
-		if (!count($this->CSVaccu)) {
669
-			$this->addWarningMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.canNotExportEmptyQueueToCsvText'));
670
-			return;
671
-		}
668
+        if (!count($this->CSVaccu)) {
669
+            $this->addWarningMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.canNotExportEmptyQueueToCsvText'));
670
+            return;
671
+        }
672 672
 
673
-		$csvLines = array();
673
+        $csvLines = array();
674 674
 
675
-			// Field names:
676
-		reset($this->CSVaccu);
677
-		$fieldNames = array_keys(current($this->CSVaccu));
678
-		$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames);
675
+            // Field names:
676
+        reset($this->CSVaccu);
677
+        $fieldNames = array_keys(current($this->CSVaccu));
678
+        $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames);
679 679
 
680
-			// Data:
681
-		foreach($this->CSVaccu as $row)	{
682
-			$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row);
683
-		}
680
+            // Data:
681
+        foreach($this->CSVaccu as $row)	{
682
+            $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row);
683
+        }
684 684
 
685
-			// Creating output header:
686
-		$mimeType = 'application/octet-stream';
687
-		Header('Content-Type: '.$mimeType);
688
-		Header('Content-Disposition: attachment; filename=CrawlerLog.csv');
685
+            // Creating output header:
686
+        $mimeType = 'application/octet-stream';
687
+        Header('Content-Type: '.$mimeType);
688
+        Header('Content-Disposition: attachment; filename=CrawlerLog.csv');
689
+
690
+            // Printing the content of the CSV lines:
691
+        echo implode(chr(13).chr(10),$csvLines);
692
+
693
+            // Exits:
694
+        exit;
695
+    }
696
+
697
+    /**
698
+     * Create the rows for display of the page tree
699
+     * For each page a number of rows are shown displaying GET variable configuration
700
+     *
701
+     * @param	array		Page row or set-id
702
+     * @param	string		Title string
703
+     * @param	int			Items per Page setting
704
+     * @return	string		HTML <tr> content (one or more)
705
+     */
706
+    function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) {
707
+
708
+            // If Flush button is pressed, flush tables instead of selecting entries:
709
+
710
+        if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
711
+            $doFlush = true;
712
+            $doFullFlush = false;
713
+        } elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
714
+            $doFlush = true;
715
+            $doFullFlush = true;
716
+        } else {
717
+            $doFlush = false;
718
+            $doFullFlush = false;
719
+        }
689 720
 
690
-			// Printing the content of the CSV lines:
691
-		echo implode(chr(13).chr(10),$csvLines);
721
+            // Get result:
722
+        if (is_array($pageRow_setId))	{
723
+            $res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
724
+        } else {
725
+            $res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
726
+        }
692 727
 
693
-			// Exits:
694
-		exit;
695
-	}
728
+            // Init var:
729
+        $colSpan = 9
730
+                + ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0)
731
+                + ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
732
+
733
+        if (count($res))	{
734
+                // Traverse parameter combinations:
735
+            $c = 0;
736
+            $content='';
737
+            foreach($res as $kk => $vv)	{
738
+
739
+                    // Title column:
740
+                if (!$c)	{
741
+                    $titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>';
742
+                } else {
743
+                    $titleClm = '';
744
+                }
696 745
 
697
-	/**
698
-	 * Create the rows for display of the page tree
699
-	 * For each page a number of rows are shown displaying GET variable configuration
700
-	 *
701
-	 * @param	array		Page row or set-id
702
-	 * @param	string		Title string
703
-	 * @param	int			Items per Page setting
704
-	 * @return	string		HTML <tr> content (one or more)
705
-	 */
706
-	function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) {
707
-
708
-			// If Flush button is pressed, flush tables instead of selecting entries:
709
-
710
-		if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
711
-			$doFlush = true;
712
-			$doFullFlush = false;
713
-		} elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
714
-			$doFlush = true;
715
-			$doFullFlush = true;
716
-		} else {
717
-			$doFlush = false;
718
-			$doFullFlush = false;
719
-		}
746
+                    // Result:
747
+                $resLog = $this->getResultLog($vv);
720 748
 
721
-			// Get result:
722
-		if (is_array($pageRow_setId))	{
723
-			$res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
724
-		} else {
725
-			$res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
726
-		}
749
+                $resStatus = $this->getResStatus($vv);
750
+                $resFeVars = $this->getResFeVars($vv);
751
+
752
+                    // Compile row:
753
+                $parameters = unserialize($vv['parameters']);
754
+
755
+                    // Put data into array:
756
+                $rowData = array();
757
+                if ($this->pObj->MOD_SETTINGS['log_resultLog'])	{
758
+                    $rowData['result_log'] = $resLog;
759
+                } else {
760
+                    $rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
761
+                    $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
762
+                }
763
+                $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50);
764
+                $rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>';
765
+                $rowData['feUserGroupList'] = $parameters['feUserGroupList'];
766
+                $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : '';
767
+                $rowData['set_id'] = $vv['set_id'];
768
+
769
+                if ($this->pObj->MOD_SETTINGS['log_feVars']) {
770
+                    $rowData['tsfe_id'] = $resFeVars['id'];
771
+                    $rowData['tsfe_gr_list'] = $resFeVars['gr_list'];
772
+                    $rowData['tsfe_no_cache'] = $resFeVars['no_cache'];
773
+                }
774
+
775
+                $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
776
+
777
+                $refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
778
+                if (version_compare(TYPO3_version,'7.0','>=')) {
779
+                    $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
780
+                }
727 781
 
728
-			// Init var:
729
-		$colSpan = 9
730
-				+ ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0)
731
-				+ ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
732
-
733
-		if (count($res))	{
734
-				// Traverse parameter combinations:
735
-			$c = 0;
736
-			$content='';
737
-			foreach($res as $kk => $vv)	{
738
-
739
-					// Title column:
740
-				if (!$c)	{
741
-					$titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>';
742
-				} else {
743
-					$titleClm = '';
744
-				}
745
-
746
-					// Result:
747
-				$resLog = $this->getResultLog($vv);
748
-
749
-				$resStatus = $this->getResStatus($vv);
750
-				$resFeVars = $this->getResFeVars($vv);
751
-
752
-					// Compile row:
753
-				$parameters = unserialize($vv['parameters']);
754
-
755
-					// Put data into array:
756
-				$rowData = array();
757
-				if ($this->pObj->MOD_SETTINGS['log_resultLog'])	{
758
-					$rowData['result_log'] = $resLog;
759
-				} else {
760
-					$rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
761
-					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
762
-				}
763
-				$rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50);
764
-				$rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>';
765
-				$rowData['feUserGroupList'] = $parameters['feUserGroupList'];
766
-				$rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : '';
767
-				$rowData['set_id'] = $vv['set_id'];
768
-
769
-				if ($this->pObj->MOD_SETTINGS['log_feVars']) {
770
-					$rowData['tsfe_id'] = $resFeVars['id'];
771
-					$rowData['tsfe_gr_list'] = $resFeVars['gr_list'];
772
-					$rowData['tsfe_no_cache'] = $resFeVars['no_cache'];
773
-				}
774
-
775
-				$setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
776
-
777
-				$refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
778
-				if (version_compare(TYPO3_version,'7.0','>=')) {
779
-					$refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
780
-				}
781
-
782
-					// Put rows together:
783
-				$content.= '
782
+                    // Put rows together:
783
+                $content.= '
784 784
 					<tr class="bgColor'.($c%2 ? '-20':'-10').'">
785 785
 						'.$titleClm.'
786 786
 						<td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)) . '">'.htmlspecialchars($vv['qid']).'</a></td>
787 787
 						<td><a href="' . $this->getModuleUrl(array('qid_read' => $vv['qid'], 'setID' => $setId)) . '"><img src="' . $refreshIcon . '" width="14" hspace="1" vspace="2" height="14" border="0" title="'.htmlspecialchars('Read').'" alt="" /></a></td>';
788
-				foreach($rowData as $fKey => $value) {
788
+                foreach($rowData as $fKey => $value) {
789 789
 
790
-					if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey))	{
791
-						$content.= '
790
+                    if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey))	{
791
+                        $content.= '
792 792
 						<td>'.$value.'</td>';
793
-					} else {
794
-						$content.= '
793
+                    } else {
794
+                        $content.= '
795 795
 						<td>'.nl2br(htmlspecialchars($value)).'</td>';
796
-					}
797
-				}
798
-				$content.= '
796
+                    }
797
+                }
798
+                $content.= '
799 799
 					</tr>';
800
-				$c++;
801
-
802
-				if ($this->CSVExport)	{
803
-						// Only for CSV (adding qid and scheduled/exec_time if needed):
804
-					$rowData['result_log'] = implode('// ',explode(chr(10),$resLog));
805
-					$rowData['qid'] = $vv['qid'];
806
-					$rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
807
-					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
808
-					$this->CSVaccu[] = $rowData;
809
-				}
810
-			}
811
-		} else {
800
+                $c++;
801
+
802
+                if ($this->CSVExport)	{
803
+                        // Only for CSV (adding qid and scheduled/exec_time if needed):
804
+                    $rowData['result_log'] = implode('// ',explode(chr(10),$resLog));
805
+                    $rowData['qid'] = $vv['qid'];
806
+                    $rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
807
+                    $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
808
+                    $this->CSVaccu[] = $rowData;
809
+                }
810
+            }
811
+        } else {
812 812
 
813
-				// Compile row:
814
-			$content = '
813
+                // Compile row:
814
+            $content = '
815 815
 				<tr class="bgColor-20">
816 816
 					<td>'.$titleString.'</td>
817 817
 					<td colspan="'.$colSpan.'"><em>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noentries').'</em></td>
818 818
 				</tr>';
819
-		}
820
-
821
-		return $content;
822
-	}
819
+        }
823 820
 
824
-	/**
825
-	 * Find Fe vars
826
-	 *
827
-	 * @param array $row
828
-	 * @return array
829
-	 */
830
-	function getResFeVars($row) {
831
-		$feVars = array();
832
-
833
-		if ($row['result_data']) {
834
-			$resultData = unserialize($row['result_data']);
835
-			$requestResult = unserialize($resultData['content']);
836
-			$feVars = $requestResult['vars'];
837
-		}
821
+        return $content;
822
+    }
823
+
824
+    /**
825
+     * Find Fe vars
826
+     *
827
+     * @param array $row
828
+     * @return array
829
+     */
830
+    function getResFeVars($row) {
831
+        $feVars = array();
832
+
833
+        if ($row['result_data']) {
834
+            $resultData = unserialize($row['result_data']);
835
+            $requestResult = unserialize($resultData['content']);
836
+            $feVars = $requestResult['vars'];
837
+        }
838 838
 
839
-		return $feVars;
840
-	}
839
+        return $feVars;
840
+    }
841 841
 
842
-	/**
843
-	 * Create Table header row (log)
844
-	 *
845
-	 * @return	string		Table header
846
-	 */
847
-	function drawLog_printTableHeader()	{
842
+    /**
843
+     * Create Table header row (log)
844
+     *
845
+     * @return	string		Table header
846
+     */
847
+    function drawLog_printTableHeader()	{
848 848
 
849
-		$content = '
849
+        $content = '
850 850
 			<tr class="bgColor5 tableheader">
851 851
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pagetitle').':</td>
852 852
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.qid').':</td>
853 853
 				<td>&nbsp;</td>'.
854
-				($this->pObj->MOD_SETTINGS['log_resultLog'] ? '
854
+                ($this->pObj->MOD_SETTINGS['log_resultLog'] ? '
855 855
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.resultlog').':</td>' : '
856 856
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.scheduledtime').':</td>
857 857
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.runtime').':</td>').'
@@ -860,14 +860,14 @@  discard block
 block discarded – undo
860 860
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.groups').':</td>
861 861
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.procinstr').':</td>
862 862
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid').':</td>'.
863
-				($this->pObj->MOD_SETTINGS['log_feVars'] ? '
863
+                ($this->pObj->MOD_SETTINGS['log_feVars'] ? '
864 864
 				<td>'.htmlspecialchars('TSFE->id').'</td>
865 865
 				<td>'.htmlspecialchars('TSFE->gr_list').'</td>
866 866
 				<td>'.htmlspecialchars('TSFE->no_cache').'</td>' : '').'
867 867
 			</tr>';
868 868
 
869
-		return $content;
870
-	}
869
+        return $content;
870
+    }
871 871
 
872 872
         /**
873 873
          * Extract the log information from the current row and retrive it as formatted string.
@@ -894,25 +894,25 @@  discard block
 block discarded – undo
894 894
                 return $content;
895 895
         }
896 896
 
897
-	function getResStatus($vv) {
898
-		if ($vv['result_data'])	{
899
-			$requestContent = unserialize($vv['result_data']);
900
-			$requestResult = unserialize($requestContent['content']);
901
-			if (is_array($requestResult)) {
902
-				if (empty($requestResult['errorlog'])) {
903
-					$resStatus = 'OK';
904
-				} else {
905
-					$resStatus = implode("\n", $requestResult['errorlog']);
906
-				}
907
-				$resLog = is_array($requestResult['log']) ?  implode(chr(10),$requestResult['log']) : '';
908
-			} else {
909
-				$resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...';
910
-			}
911
-		} else {
912
-			$resStatus = '-';
913
-		}
914
-		return $resStatus;
915
-	}
897
+    function getResStatus($vv) {
898
+        if ($vv['result_data'])	{
899
+            $requestContent = unserialize($vv['result_data']);
900
+            $requestResult = unserialize($requestContent['content']);
901
+            if (is_array($requestResult)) {
902
+                if (empty($requestResult['errorlog'])) {
903
+                    $resStatus = 'OK';
904
+                } else {
905
+                    $resStatus = implode("\n", $requestResult['errorlog']);
906
+                }
907
+                $resLog = is_array($requestResult['log']) ?  implode(chr(10),$requestResult['log']) : '';
908
+            } else {
909
+                $resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...';
910
+            }
911
+        } else {
912
+            $resStatus = '-';
913
+        }
914
+        return $resStatus;
915
+    }
916 916
 
917 917
 
918 918
 
@@ -921,343 +921,343 @@  discard block
 block discarded – undo
921 921
 
922 922
 
923 923
 
924
-	/*****************************
924
+    /*****************************
925 925
 	 *
926 926
 	 * CLI status display
927 927
 	 *
928 928
 	 *****************************/
929 929
 
930
-	/**
931
-	 * This method is used to show an overview about the active an the finished crawling processes
932
-	 *
933
-	 * @author Timo Schmidt
934
-	 * @param void
935
-	 * @return string
936
-	 */
937
-	protected function drawProcessOverviewAction(){
938
-
939
-		$this->runRefreshHooks();
940
-
941
-		global $BACK_PATH;
942
-		$this->makeCrawlerProcessableChecks();
943
-
944
-		$crawler = $this->findCrawler();
945
-		try {
946
-			$this->handleProcessOverviewActions();
947
-		} catch (Exception $e) {
948
-			$this->addErrorMessage($e->getMessage());
949
-		}
950
-
951
-		$offset 	= intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
952
-		$perpage 	= 20;
953
-
954
-		$processRepository	= new tx_crawler_domain_process_repository();
955
-		$queueRepository	= new tx_crawler_domain_queue_repository();
956
-
957
-		$mode = $this->pObj->MOD_SETTINGS['processListMode'];
958
-		if ($mode == 'detail') {
959
-			$where = '';
960
-		} elseif($mode == 'simple') {
961
-			$where = 'active = 1';
962
-		}
963
-
964
-		$allProcesses 		= $processRepository->findAll('ttl','DESC', $perpage, $offset,$where);
965
-		$allCount			= $processRepository->countAll($where);
966
-
967
-		$listView			= new tx_crawler_view_process_list();
968
-		$listView->setPageId($this->pObj->id);
969
-		$listView->setIconPath($BACK_PATH.'../typo3conf/ext/crawler/template/process/res/img/');
970
-		$listView->setProcessCollection($allProcesses);
971
-		$listView->setCliPath($this->processManager->getCrawlerCliPath());
972
-		$listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected);
973
-		$listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems());
974
-		$listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems());
975
-		$listView->setActiveProcessCount($processRepository->countActive());
976
-		$listView->setMaxActiveProcessCount(tx_crawler_api::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1));
977
-		$listView->setMode($mode);
978
-
979
-		$paginationView		= new tx_crawler_view_pagination();
980
-		$paginationView->setCurrentOffset($offset);
981
-		$paginationView->setPerPage($perpage);
982
-		$paginationView->setTotalItemCount($allCount);
983
-
984
-		$output = $listView->render();
985
-
986
-		if ($paginationView->getTotalPagesCount() > 1) {
987
-			$output .= ' <br />'.$paginationView->render();
988
-		}
989
-
990
-		return $output;
991
-	}
992
-
993
-	/**
994
-	 * Verify that the crawler is exectuable.
995
-	 *
996
-	 * @access protected
997
-	 * @return void
998
-	 *
999
-	 * @author Michael Klapper <[email protected]>
1000
-	 */
1001
-	protected function makeCrawlerProcessableChecks() {
1002
-		global $LANG;
1003
-
1004
-		if ($this->isCrawlerUserAvailable() === false) {
1005
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noBeUserAvailable'));
1006
-		} elseif ($this->isCrawlerUserNotAdmin() === false) {
1007
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.beUserIsAdmin'));
1008
-		}
930
+    /**
931
+     * This method is used to show an overview about the active an the finished crawling processes
932
+     *
933
+     * @author Timo Schmidt
934
+     * @param void
935
+     * @return string
936
+     */
937
+    protected function drawProcessOverviewAction(){
938
+
939
+        $this->runRefreshHooks();
940
+
941
+        global $BACK_PATH;
942
+        $this->makeCrawlerProcessableChecks();
943
+
944
+        $crawler = $this->findCrawler();
945
+        try {
946
+            $this->handleProcessOverviewActions();
947
+        } catch (Exception $e) {
948
+            $this->addErrorMessage($e->getMessage());
949
+        }
1009 950
 
1010
-		if ($this->isPhpForkAvailable() === false) {
1011
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noPhpForkAvailable'));
1012
-		}
951
+        $offset 	= intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
952
+        $perpage 	= 20;
1013 953
 
1014
-		$exitCode = 0;
1015
-		$out = array();
1016
-		exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode);
1017
-		if ($exitCode > 0) {
1018
-			$this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath'])));
1019
-		}
1020
-	}
1021
-
1022
-	/**
1023
-	 * Indicate that the required PHP method "popen" is
1024
-	 * available in the system.
1025
-	 *
1026
-	 * @access protected
1027
-	 * @return boolean
1028
-	 *
1029
-	 * @author Michael Klapper <[email protected]>
1030
-	 */
1031
-	protected function isPhpForkAvailable() {
1032
-		return function_exists('popen');
1033
-	}
1034
-
1035
-	/**
1036
-	 * Indicate that the required be_user "_cli_crawler" is
1037
-	 * global available in the system.
1038
-	 *
1039
-	 * @access protected
1040
-	 * @return boolean
1041
-	 *
1042
-	 * @author Michael Klapper <[email protected]>
1043
-	 */
1044
-	protected function isCrawlerUserAvailable() {
1045
-		$isAvailable = false;
1046
-		$userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
954
+        $processRepository	= new tx_crawler_domain_process_repository();
955
+        $queueRepository	= new tx_crawler_domain_queue_repository();
1047 956
 
1048
-		if (is_array($userArray))
1049
-			$isAvailable = true;
1050
-
1051
-		return $isAvailable;
1052
-	}
957
+        $mode = $this->pObj->MOD_SETTINGS['processListMode'];
958
+        if ($mode == 'detail') {
959
+            $where = '';
960
+        } elseif($mode == 'simple') {
961
+            $where = 'active = 1';
962
+        }
1053 963
 
1054
-	/**
1055
-	 * Indicate that the required be_user "_cli_crawler" is
1056
-	 * has no admin rights.
1057
-	 *
1058
-	 * @access protected
1059
-	 * @return boolean
1060
-	 *
1061
-	 * @author Michael Klapper <[email protected]>
1062
-	 */
1063
-	protected function isCrawlerUserNotAdmin() {
1064
-		$isAvailable = false;
1065
-		$userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
964
+        $allProcesses 		= $processRepository->findAll('ttl','DESC', $perpage, $offset,$where);
965
+        $allCount			= $processRepository->countAll($where);
966
+
967
+        $listView			= new tx_crawler_view_process_list();
968
+        $listView->setPageId($this->pObj->id);
969
+        $listView->setIconPath($BACK_PATH.'../typo3conf/ext/crawler/template/process/res/img/');
970
+        $listView->setProcessCollection($allProcesses);
971
+        $listView->setCliPath($this->processManager->getCrawlerCliPath());
972
+        $listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected);
973
+        $listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems());
974
+        $listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems());
975
+        $listView->setActiveProcessCount($processRepository->countActive());
976
+        $listView->setMaxActiveProcessCount(tx_crawler_api::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1));
977
+        $listView->setMode($mode);
978
+
979
+        $paginationView		= new tx_crawler_view_pagination();
980
+        $paginationView->setCurrentOffset($offset);
981
+        $paginationView->setPerPage($perpage);
982
+        $paginationView->setTotalItemCount($allCount);
983
+
984
+        $output = $listView->render();
985
+
986
+        if ($paginationView->getTotalPagesCount() > 1) {
987
+            $output .= ' <br />'.$paginationView->render();
988
+        }
1066 989
 
1067
-		if (is_array($userArray) && $userArray[0]['admin'] == 0)
1068
-			$isAvailable = true;
990
+        return $output;
991
+    }
992
+
993
+    /**
994
+     * Verify that the crawler is exectuable.
995
+     *
996
+     * @access protected
997
+     * @return void
998
+     *
999
+     * @author Michael Klapper <[email protected]>
1000
+     */
1001
+    protected function makeCrawlerProcessableChecks() {
1002
+        global $LANG;
1003
+
1004
+        if ($this->isCrawlerUserAvailable() === false) {
1005
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noBeUserAvailable'));
1006
+        } elseif ($this->isCrawlerUserNotAdmin() === false) {
1007
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.beUserIsAdmin'));
1008
+        }
1069 1009
 
1070
-		return $isAvailable;
1071
-	}
1010
+        if ($this->isPhpForkAvailable() === false) {
1011
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noPhpForkAvailable'));
1012
+        }
1072 1013
 
1073
-	/**
1074
-	 * Method to handle incomming actions of the process overview
1075
-	 *
1076
-	 * @param void
1077
-	 * @return void
1078
-	 */
1079
-	protected function handleProcessOverviewActions(){
1080
-
1081
-		$crawler = $this->findCrawler();
1082
-
1083
-		switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) {
1084
-			case 'stopCrawling' :
1085
-				//set the cli status to disable (all processes will be terminated)
1086
-				$crawler->setDisabled(true);
1087
-				break;
1088
-			case 'resumeCrawling' :
1089
-				//set the cli status to end (all processes will be terminated)
1090
-				$crawler->setDisabled(false);
1091
-				break;
1092
-			case 'addProcess' :
1093
-				$handle = $this->processManager->startProcess();
1094
-				if ($handle === false) {
1095
-					throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocesserror'));
1096
-				}
1097
-				$this->addNoticeMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocess'));
1098
-				break;
1099
-		}
1100
-	}
1014
+        $exitCode = 0;
1015
+        $out = array();
1016
+        exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode);
1017
+        if ($exitCode > 0) {
1018
+            $this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath'])));
1019
+        }
1020
+    }
1021
+
1022
+    /**
1023
+     * Indicate that the required PHP method "popen" is
1024
+     * available in the system.
1025
+     *
1026
+     * @access protected
1027
+     * @return boolean
1028
+     *
1029
+     * @author Michael Klapper <[email protected]>
1030
+     */
1031
+    protected function isPhpForkAvailable() {
1032
+        return function_exists('popen');
1033
+    }
1034
+
1035
+    /**
1036
+     * Indicate that the required be_user "_cli_crawler" is
1037
+     * global available in the system.
1038
+     *
1039
+     * @access protected
1040
+     * @return boolean
1041
+     *
1042
+     * @author Michael Klapper <[email protected]>
1043
+     */
1044
+    protected function isCrawlerUserAvailable() {
1045
+        $isAvailable = false;
1046
+        $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1047
+
1048
+        if (is_array($userArray))
1049
+            $isAvailable = true;
1050
+
1051
+        return $isAvailable;
1052
+    }
1053
+
1054
+    /**
1055
+     * Indicate that the required be_user "_cli_crawler" is
1056
+     * has no admin rights.
1057
+     *
1058
+     * @access protected
1059
+     * @return boolean
1060
+     *
1061
+     * @author Michael Klapper <[email protected]>
1062
+     */
1063
+    protected function isCrawlerUserNotAdmin() {
1064
+        $isAvailable = false;
1065
+        $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1066
+
1067
+        if (is_array($userArray) && $userArray[0]['admin'] == 0)
1068
+            $isAvailable = true;
1069
+
1070
+        return $isAvailable;
1071
+    }
1072
+
1073
+    /**
1074
+     * Method to handle incomming actions of the process overview
1075
+     *
1076
+     * @param void
1077
+     * @return void
1078
+     */
1079
+    protected function handleProcessOverviewActions(){
1080
+
1081
+        $crawler = $this->findCrawler();
1082
+
1083
+        switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) {
1084
+            case 'stopCrawling' :
1085
+                //set the cli status to disable (all processes will be terminated)
1086
+                $crawler->setDisabled(true);
1087
+                break;
1088
+            case 'resumeCrawling' :
1089
+                //set the cli status to end (all processes will be terminated)
1090
+                $crawler->setDisabled(false);
1091
+                break;
1092
+            case 'addProcess' :
1093
+                $handle = $this->processManager->startProcess();
1094
+                if ($handle === false) {
1095
+                    throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocesserror'));
1096
+                }
1097
+                $this->addNoticeMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocess'));
1098
+                break;
1099
+        }
1100
+    }
1101 1101
 
1102 1102
 
1103 1103
 
1104 1104
 
1105
-	/**
1106
-	 * Returns the singleton instance of the crawler.
1107
-	 *
1108
-	 * @param void
1109
-	 * @return tx_crawler_lib crawler object
1110
-	 * @author Timo Schmidt <[email protected]>
1111
-	 */
1112
-	protected function findCrawler(){
1113
-		if(!$this->crawlerObj instanceof tx_crawler_lib){
1114
-			$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1115
-		}
1116
-		return $this->crawlerObj;
1117
-	}
1105
+    /**
1106
+     * Returns the singleton instance of the crawler.
1107
+     *
1108
+     * @param void
1109
+     * @return tx_crawler_lib crawler object
1110
+     * @author Timo Schmidt <[email protected]>
1111
+     */
1112
+    protected function findCrawler(){
1113
+        if(!$this->crawlerObj instanceof tx_crawler_lib){
1114
+            $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1115
+        }
1116
+        return $this->crawlerObj;
1117
+    }
1118 1118
 
1119 1119
 
1120 1120
 
1121
-	/*****************************
1121
+    /*****************************
1122 1122
 	 *
1123 1123
 	 * General Helper Functions
1124 1124
 	 *
1125 1125
 	 *****************************/
1126 1126
 
1127
-	/**
1128
-	 * This method is used to add a message to the internal queue
1129
-	 *
1130
-	 * NOTE:
1131
-	 * This method is basesd on TYPO3 4.3 or higher!
1132
-	 *
1133
-	 * @param  string  the message itself
1134
-	 * @param  integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error)
1135
-	 *
1136
-	 * @access private
1137
-	 * @return void
1138
-	 */
1139
-	private function addMessage($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) {
1140
-		$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1141
-			'TYPO3\CMS\Core\Messaging\FlashMessage',
1142
-			$message,
1143
-			'',
1144
-			$severity
1145
-		);
1146
-
1147
-		// TODO:
1148
-		/** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
1149
-		$flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
1150
-		$flashMessageService->getMessageQueueByIdentifier()->addMessage($message);
1151
-	}
1152
-
1153
-	/**
1154
-	 * Add notice message to the user interface.
1155
-	 *
1156
-	 * NOTE:
1157
-	 * This method is basesd on TYPO3 4.3 or higher!
1158
-	 *
1159
-	 * @param string The message
1160
-	 *
1161
-	 * @access protected
1162
-	 * @return void
1163
-	 *
1164
-	 * @author Michael Klapper <[email protected]>
1165
-	 */
1166
-	protected function addNoticeMessage($message) {
1167
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
1168
-	}
1169
-
1170
-	/**
1171
-	 * Add error message to the user interface.
1172
-	 *
1173
-	 * NOTE:
1174
-	 * This method is basesd on TYPO3 4.3 or higher!
1175
-	 *
1176
-	 * @param string The message
1177
-	 *
1178
-	 * @access protected
1179
-	 * @return void
1180
-	 *
1181
-	 * @author Michael Klapper <[email protected]>
1182
-	 */
1183
-	protected function addErrorMessage($message) {
1184
-		$this->isErrorDetected = TRUE;
1185
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
1186
-	}
1187
-
1188
-	/**
1189
-	 * Add error message to the user interface.
1190
-	 *
1191
-	 * NOTE:
1192
-	 * This method is basesd on TYPO3 4.3 or higher!
1193
-	 *
1194
-	 * @param string The message
1195
-	 *
1196
-	 * @access protected
1197
-	 * @return void
1198
-	 *
1199
-	 * @author Michael Klapper <[email protected]>
1200
-	 */
1201
-	protected function addWarningMessage($message) {
1202
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
1203
-	}
1204
-
1205
-	/**
1206
-	 * Create selector box
1207
-	 *
1208
-	 * @param	array		Options key(value) => label pairs
1209
-	 * @param	string		Selector box name
1210
-	 * @param	string		Selector box value (array for multiple...)
1211
-	 * @param	boolean		If set, will draw multiple box.
1212
-	 * @return	string		HTML select element
1213
-	 */
1214
-	function selectorBox($optArray, $name, $value, $multiple)	{
1215
-
1216
-		$options = array();
1217
-		foreach($optArray as $key => $val)	{
1218
-			$options[] = '
1127
+    /**
1128
+     * This method is used to add a message to the internal queue
1129
+     *
1130
+     * NOTE:
1131
+     * This method is basesd on TYPO3 4.3 or higher!
1132
+     *
1133
+     * @param  string  the message itself
1134
+     * @param  integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error)
1135
+     *
1136
+     * @access private
1137
+     * @return void
1138
+     */
1139
+    private function addMessage($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) {
1140
+        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1141
+            'TYPO3\CMS\Core\Messaging\FlashMessage',
1142
+            $message,
1143
+            '',
1144
+            $severity
1145
+        );
1146
+
1147
+        // TODO:
1148
+        /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
1149
+        $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
1150
+        $flashMessageService->getMessageQueueByIdentifier()->addMessage($message);
1151
+    }
1152
+
1153
+    /**
1154
+     * Add notice message to the user interface.
1155
+     *
1156
+     * NOTE:
1157
+     * This method is basesd on TYPO3 4.3 or higher!
1158
+     *
1159
+     * @param string The message
1160
+     *
1161
+     * @access protected
1162
+     * @return void
1163
+     *
1164
+     * @author Michael Klapper <[email protected]>
1165
+     */
1166
+    protected function addNoticeMessage($message) {
1167
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
1168
+    }
1169
+
1170
+    /**
1171
+     * Add error message to the user interface.
1172
+     *
1173
+     * NOTE:
1174
+     * This method is basesd on TYPO3 4.3 or higher!
1175
+     *
1176
+     * @param string The message
1177
+     *
1178
+     * @access protected
1179
+     * @return void
1180
+     *
1181
+     * @author Michael Klapper <[email protected]>
1182
+     */
1183
+    protected function addErrorMessage($message) {
1184
+        $this->isErrorDetected = TRUE;
1185
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
1186
+    }
1187
+
1188
+    /**
1189
+     * Add error message to the user interface.
1190
+     *
1191
+     * NOTE:
1192
+     * This method is basesd on TYPO3 4.3 or higher!
1193
+     *
1194
+     * @param string The message
1195
+     *
1196
+     * @access protected
1197
+     * @return void
1198
+     *
1199
+     * @author Michael Klapper <[email protected]>
1200
+     */
1201
+    protected function addWarningMessage($message) {
1202
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
1203
+    }
1204
+
1205
+    /**
1206
+     * Create selector box
1207
+     *
1208
+     * @param	array		Options key(value) => label pairs
1209
+     * @param	string		Selector box name
1210
+     * @param	string		Selector box value (array for multiple...)
1211
+     * @param	boolean		If set, will draw multiple box.
1212
+     * @return	string		HTML select element
1213
+     */
1214
+    function selectorBox($optArray, $name, $value, $multiple)	{
1215
+
1216
+        $options = array();
1217
+        foreach($optArray as $key => $val)	{
1218
+            $options[] = '
1219 1219
 				<option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value,$key)) || ($multiple && in_array($key,(array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>';
1220
-		}
1221
-
1222
-		$output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>';
1223
-
1224
-		return $output;
1225
-	}
1226
-
1227
-	/**
1228
-	 * Activate hooks
1229
-	 *
1230
-	 * @return	void
1231
-	 */
1232
-	function runRefreshHooks() {
1233
-		$crawlerLib = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1234
-		if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'])) {
1235
-			foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'] as $objRef) {
1236
-				$hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
1237
-				if (is_object($hookObj)) {
1238
-					$hookObj->crawler_init($crawlerLib);
1239
-				}
1240
-			}
1241
-		}
1220
+        }
1242 1221
 
1243
-	}
1222
+        $output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>';
1223
+
1224
+        return $output;
1225
+    }
1226
+
1227
+    /**
1228
+     * Activate hooks
1229
+     *
1230
+     * @return	void
1231
+     */
1232
+    function runRefreshHooks() {
1233
+        $crawlerLib = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1234
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'])) {
1235
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'] as $objRef) {
1236
+                $hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
1237
+                if (is_object($hookObj)) {
1238
+                    $hookObj->crawler_init($crawlerLib);
1239
+                }
1240
+            }
1241
+        }
1244 1242
 
1245
-	/**
1246
-	 * Returns the URL to the current module, including $_GET['id'].
1247
-	 *
1248
-	 * @param array $urlParameters optional parameters to add to the URL
1249
-	 * @return string
1250
-	 */
1251
-	protected function getModuleUrl(array $urlParameters = array()) {
1252
-	    if ($this->pObj->id) {
1253
-	        $urlParameters = array_merge($urlParameters, array(
1243
+    }
1244
+
1245
+    /**
1246
+     * Returns the URL to the current module, including $_GET['id'].
1247
+     *
1248
+     * @param array $urlParameters optional parameters to add to the URL
1249
+     * @return string
1250
+     */
1251
+    protected function getModuleUrl(array $urlParameters = array()) {
1252
+        if ($this->pObj->id) {
1253
+            $urlParameters = array_merge($urlParameters, array(
1254 1254
                 'id' => $this->pObj->id
1255 1255
             ));
1256
-	    }
1256
+        }
1257 1257
         return \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('M'), $urlParameters);
1258
-	}
1258
+    }
1259 1259
 }
1260 1260
 
1261 1261
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php'])	{
1262
-	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']);
1262
+    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']);
1263 1263
 }
Please login to merge, or discard this patch.
view/process/class.tx_crawler_view_process_list.php 1 patch
Indentation   +391 added lines, -391 removed lines patch added patch discarded remove patch
@@ -29,397 +29,397 @@
 block discarded – undo
29 29
  */
30 30
 class tx_crawler_view_process_list {
31 31
 
32
-	/**
33
-	 * @var string template path
34
-	 */
35
-	protected $template = 'EXT:crawler/template/process/list.php';
36
-
37
-	/**
38
-	 * @var string icon path
39
-	 */
40
-	protected $iconPath;
41
-
42
-	/**
43
-	 * @var string Holds the path to start a cli process via command line
44
-	 */
45
-	protected $cliPath;
46
-
47
-	/**
48
-	 * @var int Holds the total number of items pending in the queue to be processed
49
-	 */
50
-	protected $totalItemCount;
51
-
52
-	/**
53
-	 * @var boolean Holds the enable state of the crawler
54
-	 */
55
-	protected $isCrawlerEnabled;
56
-
57
-	/**
58
-	 * @var int Holds the number of active processes
59
-	 */
60
-	protected $activeProcessCount;
61
-
62
-	/**
63
-	 * @var int Holds the number of maximum active processes
64
-	 */
65
-	protected $maxActiveProcessCount;
66
-
67
-	/**
68
-	 * @var string Holds the mode state, can be simple or detail
69
-	 */
70
-	protected $mode;
71
-
72
-	/**
73
-	 * @var int Holds the current page id
74
-	 */
75
-	protected $pageId;
76
-
77
-	/**
78
-	 * @var int $totalItemCount number of total item
79
-	 */
80
-	protected $totalUnprocessedItemCount;
81
-
82
-	/**
83
-	 * @var int Holds the number of assigned unprocessed items
84
-	 */
85
-	protected $assignedUnprocessedItemCount;
86
-
87
-	/**
88
-	 * @return int
89
-	 */
90
-	public function getAssignedUnprocessedItemCount() {
91
-		return $this->assignedUnprocessedItemCount;
92
-	}
93
-
94
-	/**
95
-	 * @return int
96
-	 */
97
-	public function getTotalUnprocessedItemCount() {
98
-		return $this->totalUnprocessedItemCount;
99
-	}
100
-
101
-	/**
102
-	 * @param int $assignedUnprocessedItemCount
103
-	 */
104
-	public function setAssignedUnprocessedItemCount($assignedUnprocessedItemCount) {
105
-		$this->assignedUnprocessedItemCount = $assignedUnprocessedItemCount;
106
-	}
107
-
108
-	/**
109
-	 * @param int $totalUnprocessedItemCount
110
-	 */
111
-	public function setTotalUnprocessedItemCount($totalUnprocessedItemCount) {
112
-		$this->totalUnprocessedItemCount = $totalUnprocessedItemCount;
113
-	}
114
-
115
-	/**
116
-	 * Set the page id
117
-	 *
118
-	 * @param int page id
119
-	 */
120
-	public function setPageId($pageId) {
121
-		$this->pageId = $pageId;
122
-	}
123
-
124
-	/**
125
-	 * Get the page id
126
-	 *
127
-	 * @return int page id
128
-	 */
129
-	public function getPageId() {
130
-		return $this->pageId;
131
-	}
132
-
133
-	/**
134
-	 * @return string
135
-	 */
136
-	public function getMode() {
137
-		return $this->mode;
138
-	}
139
-
140
-	/**
141
-	 * @param string $mode
142
-	 */
143
-	public function setMode($mode) {
144
-		$this->mode = $mode;
145
-	}
146
-
147
-
148
-	/**
149
-	 * @return int
150
-	 */
151
-	public function getMaxActiveProcessCount() {
152
-		return $this->maxActiveProcessCount;
153
-	}
154
-
155
-	/**
156
-	 * @param int $maxActiveProcessCount
157
-	 */
158
-	public function setMaxActiveProcessCount($maxActiveProcessCount) {
159
-		$this->maxActiveProcessCount = $maxActiveProcessCount;
160
-	}
161
-
162
-
163
-	/**
164
-	 * @return int
165
-	 */
166
-	public function getActiveProcessCount() {
167
-		return $this->activeProcessCount;
168
-	}
169
-
170
-	/**
171
-	 * @param int $activeProcessCount
172
-	 */
173
-	public function setActiveProcessCount($activeProcessCount) {
174
-		$this->activeProcessCount = $activeProcessCount;
175
-	}
176
-
177
-	/**
178
-	 * @return boolean
179
-	 */
180
-	public function getIsCrawlerEnabled() {
181
-		return $this->isCrawlerEnabled;
182
-	}
183
-
184
-	/**
185
-	 * @param boolean $isCrawlerEnabled
186
-	 */
187
-	public function setIsCrawlerEnabled($isCrawlerEnabled) {
188
-		$this->isCrawlerEnabled = $isCrawlerEnabled;
189
-	}
190
-
191
-
192
-	/**
193
-	 * Returns the path to start a cli process from the shell
194
-	 * @return string
195
-	 */
196
-	public function getCliPath() {
197
-		return $this->cliPath;
198
-	}
199
-
200
-	/**
201
-	 * @param string $cliPath
202
-	 */
203
-	public function setCliPath($cliPath) {
204
-		$this->cliPath = $cliPath;
205
-	}
206
-
207
-
208
-	/**
209
-	 * @return int
210
-	 */
211
-	public function getTotalItemCount() {
212
-		return $this->totalItemCount;
213
-	}
214
-
215
-	/**
216
-	 * @param int $totalItemCount
217
-	 */
218
-	public function setTotalItemCount($totalItemCount) {
219
-		$this->totalItemCount = $totalItemCount;
220
-	}
221
-
222
-	/**
223
-	 * Method to set the path to the icon from outside
224
-	 *
225
-	 * @param string $iconPath
226
-	 */
227
-	public function setIconPath($iconPath) {
228
-		$this->iconPath = $iconPath;
229
-	}
230
-
231
-	/**
232
-	 * Method to read the configured icon path
233
-	 *
234
-	 * @return string
235
-	 */
236
-	protected function getIconPath() {
237
-		return $this->iconPath;
238
-	}
239
-
240
-	/**
241
-	 * Method to set a collection of process objects to be displayed in
242
-	 * the list view.
243
-	 *
244
-	 * @param tx_crawler_domain_process_collection $processCollection
245
-	 */
246
-	public function setProcessCollection($processCollection) {
247
-		$this->processCollection = $processCollection;
248
-	}
249
-
250
-	/**
251
-	 * Returns a collection of processObjects.
252
-	 *
253
-	 * @return tx_crawler_domain_process_collection
254
-	 */
255
-	protected function getProcessCollection() {
256
-		return $this->processCollection;
257
-	}
258
-
259
-	/**
260
-	 * Formats a timestamp as date
261
-	 *
262
-	 * @param int $timestamp
263
-	 * @return string
264
-	 */
265
-	protected function asDate($timestamp) {
266
-		if ($timestamp > 0) {
267
-			return date($this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:time.detailed'), $timestamp);
268
-		} else {
269
-			return '';
270
-		}
271
-	}
272
-
273
-	/**
274
-	 * Converts seconds into minutes
275
-	 *
276
-	 * @param int $seconds
277
-	 * @return int
278
-	 */
279
-	protected function asMinutes($seconds) {
280
-		return round($seconds / 60);
281
-	}
282
-
283
-	/**
284
-	 * Returns the state icon for the current job
285
-	 *
286
-	 * @param string $state
287
-	 * @return string icon
288
-	 */
289
-	protected function getIconForState($state) {
290
-		switch($state) {
291
-			case 'running':
292
-				$icon = 'bullet_orange';
293
-				$title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.running');
294
-				break;
295
-			case 'completed':
296
-				$icon = 'bullet_green';
297
-				$title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.success');
298
-				break;
299
-			case 'cancelled':
300
-				$icon = 'bullet_red';
301
-				$title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.cancelled');
302
-				break;
303
-		}
304
-
305
-		return $this->getIcon($icon, $title);
306
-	}
307
-
308
-	/**
309
-	 * Returns a tag for the refresh icon
310
-	 *
311
-	 * @return string
312
-	 */
313
-	protected function getRefreshIcon() {
314
-		return $this->getIcon('arrow_refresh');
315
-	}
316
-
317
-	/**
318
-	 * Returns a tag for the refresh icon
319
-	 *
320
-	 * @return string
321
-	 */
322
-	protected function getRefreshLink() {
323
-		return '<input onclick="window.location=\'' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_info') . '&SET[crawlaction]=multiprocess&id=' . $this->pageId . '\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_refresh.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.refresh') . '" />';
324
-	}
325
-
326
-	/**
327
-	 * Returns an icon to stop all processes
328
-	 *
329
-	 * @return string html tag for stop icon
330
-	 */
331
-	protected function getStopIcon() {
332
-		return $this->getIcon('stop');
333
-	}
334
-
335
-	/**
336
-	 * Returns a link for the panel to enable or disable the crawler
337
-	 *
338
-	 * @return string
339
-	 */
340
-	protected function getEnableDisableLink() {
341
-		if ($this->getIsCrawlerEnabled()) {
342
-			return '<input onclick="window.location+=\'&action=stopCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_stop_blue.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.disablecrawling') . '" />';
343
-		} else {
344
-			return '<input onclick="window.location+=\'&action=resumeCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_play.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.enablecrawling') . '" />';
345
-		}
346
-	}
347
-
348
-	/**
349
-	 * Get mode link
350
-	 *
351
-	 * @param void
352
-	 * @return string a-tag
353
-	 */
354
-	protected function getModeLink() {
355
-		if ($this->getMode() == 'detail') {
356
-			return '<input onclick="window.location+=\'&SET[processListMode]=simple\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_in.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.running') . '" />';
357
-		} elseif ($this->getMode() == 'simple') {
358
-			return '<input onclick="window.location+=\'&SET[processListMode]=detail\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_out.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.all') . '" />';
359
-		}
360
-	}
361
-
362
-	/**
363
-	 * Get add link
364
-	 *
365
-	 * @param void
366
-	 * @return string a-tag
367
-	 */
368
-	protected function getAddLink() {
369
-		if ($this->getActiveProcessCount() < $this->getMaxActiveProcessCount() && $this->getIsCrawlerEnabled()) {
370
-			return '<input onclick="window.location+=\'&action=addProcess\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'add.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.add') . '" />';
371
-		} else {
372
-			return '';
373
-		}
374
-	}
375
-
376
-	/**
377
-	 * Returns the icon to add new crawler processes
378
-	 *
379
-	 * @return string html tag for image to add new processes
380
-	 */
381
-	protected function getAddIcon() {
382
-		return $this->getIcon('add');
383
-	}
384
-
385
-	/**
386
-	 * Returns an imagetag for an icon
387
-	 *
388
-	 * @param string $icon
389
-	 * @return string html tag for icon
390
-	 */
391
-	protected function getIcon($icon, $title='') {
392
-		if (!empty($title)) {
393
-			$title = ' title="'.$title.'"';
394
-		}
395
-		return '<img src="'.$this->getIconPath().$icon.'.png" ' . $title . ' />';
396
-	}
397
-
398
-	/**
399
-	 * Method to render the view.
400
-	 *
401
-	 * @return string html content
402
-	 */
403
-	public function render() {
404
-		ob_start();
405
-		$this->template = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->template);
406
-		include($this->template);
407
-		$content = ob_get_contents();
408
-		ob_end_clean();
409
-		return $content;
410
-	}
411
-
412
-	/**
413
-	 * retrieve locallanglabel from environment
414
-	 * just a wrapper should be done in a cleaner way
415
-	 * later on
416
-	 *
417
-	 * @param $label
418
-	 * @return string
419
-	 */
420
-	protected function getLLLabel($label) {
421
-		return $GLOBALS['LANG']->sL($label);
422
-	}
32
+    /**
33
+     * @var string template path
34
+     */
35
+    protected $template = 'EXT:crawler/template/process/list.php';
36
+
37
+    /**
38
+     * @var string icon path
39
+     */
40
+    protected $iconPath;
41
+
42
+    /**
43
+     * @var string Holds the path to start a cli process via command line
44
+     */
45
+    protected $cliPath;
46
+
47
+    /**
48
+     * @var int Holds the total number of items pending in the queue to be processed
49
+     */
50
+    protected $totalItemCount;
51
+
52
+    /**
53
+     * @var boolean Holds the enable state of the crawler
54
+     */
55
+    protected $isCrawlerEnabled;
56
+
57
+    /**
58
+     * @var int Holds the number of active processes
59
+     */
60
+    protected $activeProcessCount;
61
+
62
+    /**
63
+     * @var int Holds the number of maximum active processes
64
+     */
65
+    protected $maxActiveProcessCount;
66
+
67
+    /**
68
+     * @var string Holds the mode state, can be simple or detail
69
+     */
70
+    protected $mode;
71
+
72
+    /**
73
+     * @var int Holds the current page id
74
+     */
75
+    protected $pageId;
76
+
77
+    /**
78
+     * @var int $totalItemCount number of total item
79
+     */
80
+    protected $totalUnprocessedItemCount;
81
+
82
+    /**
83
+     * @var int Holds the number of assigned unprocessed items
84
+     */
85
+    protected $assignedUnprocessedItemCount;
86
+
87
+    /**
88
+     * @return int
89
+     */
90
+    public function getAssignedUnprocessedItemCount() {
91
+        return $this->assignedUnprocessedItemCount;
92
+    }
93
+
94
+    /**
95
+     * @return int
96
+     */
97
+    public function getTotalUnprocessedItemCount() {
98
+        return $this->totalUnprocessedItemCount;
99
+    }
100
+
101
+    /**
102
+     * @param int $assignedUnprocessedItemCount
103
+     */
104
+    public function setAssignedUnprocessedItemCount($assignedUnprocessedItemCount) {
105
+        $this->assignedUnprocessedItemCount = $assignedUnprocessedItemCount;
106
+    }
107
+
108
+    /**
109
+     * @param int $totalUnprocessedItemCount
110
+     */
111
+    public function setTotalUnprocessedItemCount($totalUnprocessedItemCount) {
112
+        $this->totalUnprocessedItemCount = $totalUnprocessedItemCount;
113
+    }
114
+
115
+    /**
116
+     * Set the page id
117
+     *
118
+     * @param int page id
119
+     */
120
+    public function setPageId($pageId) {
121
+        $this->pageId = $pageId;
122
+    }
123
+
124
+    /**
125
+     * Get the page id
126
+     *
127
+     * @return int page id
128
+     */
129
+    public function getPageId() {
130
+        return $this->pageId;
131
+    }
132
+
133
+    /**
134
+     * @return string
135
+     */
136
+    public function getMode() {
137
+        return $this->mode;
138
+    }
139
+
140
+    /**
141
+     * @param string $mode
142
+     */
143
+    public function setMode($mode) {
144
+        $this->mode = $mode;
145
+    }
146
+
147
+
148
+    /**
149
+     * @return int
150
+     */
151
+    public function getMaxActiveProcessCount() {
152
+        return $this->maxActiveProcessCount;
153
+    }
154
+
155
+    /**
156
+     * @param int $maxActiveProcessCount
157
+     */
158
+    public function setMaxActiveProcessCount($maxActiveProcessCount) {
159
+        $this->maxActiveProcessCount = $maxActiveProcessCount;
160
+    }
161
+
162
+
163
+    /**
164
+     * @return int
165
+     */
166
+    public function getActiveProcessCount() {
167
+        return $this->activeProcessCount;
168
+    }
169
+
170
+    /**
171
+     * @param int $activeProcessCount
172
+     */
173
+    public function setActiveProcessCount($activeProcessCount) {
174
+        $this->activeProcessCount = $activeProcessCount;
175
+    }
176
+
177
+    /**
178
+     * @return boolean
179
+     */
180
+    public function getIsCrawlerEnabled() {
181
+        return $this->isCrawlerEnabled;
182
+    }
183
+
184
+    /**
185
+     * @param boolean $isCrawlerEnabled
186
+     */
187
+    public function setIsCrawlerEnabled($isCrawlerEnabled) {
188
+        $this->isCrawlerEnabled = $isCrawlerEnabled;
189
+    }
190
+
191
+
192
+    /**
193
+     * Returns the path to start a cli process from the shell
194
+     * @return string
195
+     */
196
+    public function getCliPath() {
197
+        return $this->cliPath;
198
+    }
199
+
200
+    /**
201
+     * @param string $cliPath
202
+     */
203
+    public function setCliPath($cliPath) {
204
+        $this->cliPath = $cliPath;
205
+    }
206
+
207
+
208
+    /**
209
+     * @return int
210
+     */
211
+    public function getTotalItemCount() {
212
+        return $this->totalItemCount;
213
+    }
214
+
215
+    /**
216
+     * @param int $totalItemCount
217
+     */
218
+    public function setTotalItemCount($totalItemCount) {
219
+        $this->totalItemCount = $totalItemCount;
220
+    }
221
+
222
+    /**
223
+     * Method to set the path to the icon from outside
224
+     *
225
+     * @param string $iconPath
226
+     */
227
+    public function setIconPath($iconPath) {
228
+        $this->iconPath = $iconPath;
229
+    }
230
+
231
+    /**
232
+     * Method to read the configured icon path
233
+     *
234
+     * @return string
235
+     */
236
+    protected function getIconPath() {
237
+        return $this->iconPath;
238
+    }
239
+
240
+    /**
241
+     * Method to set a collection of process objects to be displayed in
242
+     * the list view.
243
+     *
244
+     * @param tx_crawler_domain_process_collection $processCollection
245
+     */
246
+    public function setProcessCollection($processCollection) {
247
+        $this->processCollection = $processCollection;
248
+    }
249
+
250
+    /**
251
+     * Returns a collection of processObjects.
252
+     *
253
+     * @return tx_crawler_domain_process_collection
254
+     */
255
+    protected function getProcessCollection() {
256
+        return $this->processCollection;
257
+    }
258
+
259
+    /**
260
+     * Formats a timestamp as date
261
+     *
262
+     * @param int $timestamp
263
+     * @return string
264
+     */
265
+    protected function asDate($timestamp) {
266
+        if ($timestamp > 0) {
267
+            return date($this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:time.detailed'), $timestamp);
268
+        } else {
269
+            return '';
270
+        }
271
+    }
272
+
273
+    /**
274
+     * Converts seconds into minutes
275
+     *
276
+     * @param int $seconds
277
+     * @return int
278
+     */
279
+    protected function asMinutes($seconds) {
280
+        return round($seconds / 60);
281
+    }
282
+
283
+    /**
284
+     * Returns the state icon for the current job
285
+     *
286
+     * @param string $state
287
+     * @return string icon
288
+     */
289
+    protected function getIconForState($state) {
290
+        switch($state) {
291
+            case 'running':
292
+                $icon = 'bullet_orange';
293
+                $title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.running');
294
+                break;
295
+            case 'completed':
296
+                $icon = 'bullet_green';
297
+                $title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.success');
298
+                break;
299
+            case 'cancelled':
300
+                $icon = 'bullet_red';
301
+                $title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.cancelled');
302
+                break;
303
+        }
304
+
305
+        return $this->getIcon($icon, $title);
306
+    }
307
+
308
+    /**
309
+     * Returns a tag for the refresh icon
310
+     *
311
+     * @return string
312
+     */
313
+    protected function getRefreshIcon() {
314
+        return $this->getIcon('arrow_refresh');
315
+    }
316
+
317
+    /**
318
+     * Returns a tag for the refresh icon
319
+     *
320
+     * @return string
321
+     */
322
+    protected function getRefreshLink() {
323
+        return '<input onclick="window.location=\'' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_info') . '&SET[crawlaction]=multiprocess&id=' . $this->pageId . '\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_refresh.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.refresh') . '" />';
324
+    }
325
+
326
+    /**
327
+     * Returns an icon to stop all processes
328
+     *
329
+     * @return string html tag for stop icon
330
+     */
331
+    protected function getStopIcon() {
332
+        return $this->getIcon('stop');
333
+    }
334
+
335
+    /**
336
+     * Returns a link for the panel to enable or disable the crawler
337
+     *
338
+     * @return string
339
+     */
340
+    protected function getEnableDisableLink() {
341
+        if ($this->getIsCrawlerEnabled()) {
342
+            return '<input onclick="window.location+=\'&action=stopCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_stop_blue.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.disablecrawling') . '" />';
343
+        } else {
344
+            return '<input onclick="window.location+=\'&action=resumeCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_play.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.enablecrawling') . '" />';
345
+        }
346
+    }
347
+
348
+    /**
349
+     * Get mode link
350
+     *
351
+     * @param void
352
+     * @return string a-tag
353
+     */
354
+    protected function getModeLink() {
355
+        if ($this->getMode() == 'detail') {
356
+            return '<input onclick="window.location+=\'&SET[processListMode]=simple\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_in.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.running') . '" />';
357
+        } elseif ($this->getMode() == 'simple') {
358
+            return '<input onclick="window.location+=\'&SET[processListMode]=detail\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_out.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.all') . '" />';
359
+        }
360
+    }
361
+
362
+    /**
363
+     * Get add link
364
+     *
365
+     * @param void
366
+     * @return string a-tag
367
+     */
368
+    protected function getAddLink() {
369
+        if ($this->getActiveProcessCount() < $this->getMaxActiveProcessCount() && $this->getIsCrawlerEnabled()) {
370
+            return '<input onclick="window.location+=\'&action=addProcess\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'add.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.add') . '" />';
371
+        } else {
372
+            return '';
373
+        }
374
+    }
375
+
376
+    /**
377
+     * Returns the icon to add new crawler processes
378
+     *
379
+     * @return string html tag for image to add new processes
380
+     */
381
+    protected function getAddIcon() {
382
+        return $this->getIcon('add');
383
+    }
384
+
385
+    /**
386
+     * Returns an imagetag for an icon
387
+     *
388
+     * @param string $icon
389
+     * @return string html tag for icon
390
+     */
391
+    protected function getIcon($icon, $title='') {
392
+        if (!empty($title)) {
393
+            $title = ' title="'.$title.'"';
394
+        }
395
+        return '<img src="'.$this->getIconPath().$icon.'.png" ' . $title . ' />';
396
+    }
397
+
398
+    /**
399
+     * Method to render the view.
400
+     *
401
+     * @return string html content
402
+     */
403
+    public function render() {
404
+        ob_start();
405
+        $this->template = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->template);
406
+        include($this->template);
407
+        $content = ob_get_contents();
408
+        ob_end_clean();
409
+        return $content;
410
+    }
411
+
412
+    /**
413
+     * retrieve locallanglabel from environment
414
+     * just a wrapper should be done in a cleaner way
415
+     * later on
416
+     *
417
+     * @param $label
418
+     * @return string
419
+     */
420
+    protected function getLLLabel($label) {
421
+        return $GLOBALS['LANG']->sL($label);
422
+    }
423 423
 }
424 424
 
425 425
 ?>
Please login to merge, or discard this patch.
domain/process/class.tx_crawler_domain_process_manager.php 1 patch
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -27,176 +27,176 @@
 block discarded – undo
27 27
  *
28 28
  */
29 29
 class tx_crawler_domain_process_manager  {
30
-	/**
31
-	 * @var $timeToLive integer
32
-	 */
33
-	private $timeToLive;
34
-	/**
35
-	 * @var integer
36
-	 */
37
-	private $countInARun;
30
+    /**
31
+     * @var $timeToLive integer
32
+     */
33
+    private $timeToLive;
34
+    /**
35
+     * @var integer
36
+     */
37
+    private $countInARun;
38 38
 
39
-	/**
40
-	 * @var integer
41
-	 */
42
-	private $processLimit;
39
+    /**
40
+     * @var integer
41
+     */
42
+    private $processLimit;
43 43
 
44
-	/**
45
-	 * @var $crawlerObj tx_crawler_lib
46
-	 */
47
-	private $crawlerObj;
44
+    /**
45
+     * @var $crawlerObj tx_crawler_lib
46
+     */
47
+    private $crawlerObj;
48 48
 
49
-	/**
50
-	 * @var $queueRepository tx_crawler_domain_queue_repository
51
-	 */
52
-	private $queueRepository;
49
+    /**
50
+     * @var $queueRepository tx_crawler_domain_queue_repository
51
+     */
52
+    private $queueRepository;
53 53
 
54
-	/**
55
-	 * @var tx_crawler_domain_process_repository
56
-	 */
57
-	private $processRepository;
54
+    /**
55
+     * @var tx_crawler_domain_process_repository
56
+     */
57
+    private $processRepository;
58 58
 
59
-	/**
60
-	 * @var $verbose boolean
61
-	 */
62
-	private $verbose;
59
+    /**
60
+     * @var $verbose boolean
61
+     */
62
+    private $verbose;
63 63
 
64
-	/**
65
-	 * the constructor
66
-	 */
67
-	public function __construct() {
68
-		$this->processRepository	= new tx_crawler_domain_process_repository();
69
-		$this->queueRepository	= new tx_crawler_domain_queue_repository();
70
-		$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
71
-		$this->timeToLive = intval($this->crawlerObj->extensionSettings['processMaxRunTime']);
72
-		$this->countInARun = intval($this->crawlerObj->extensionSettings['countInARun']);
73
-		$this->processLimit = intval($this->crawlerObj->extensionSettings['processLimit']);
74
-		$this->verbose = intval($this->crawlerObj->extensionSettings['processVerbose']);
75
-	}
64
+    /**
65
+     * the constructor
66
+     */
67
+    public function __construct() {
68
+        $this->processRepository	= new tx_crawler_domain_process_repository();
69
+        $this->queueRepository	= new tx_crawler_domain_queue_repository();
70
+        $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
71
+        $this->timeToLive = intval($this->crawlerObj->extensionSettings['processMaxRunTime']);
72
+        $this->countInARun = intval($this->crawlerObj->extensionSettings['countInARun']);
73
+        $this->processLimit = intval($this->crawlerObj->extensionSettings['processLimit']);
74
+        $this->verbose = intval($this->crawlerObj->extensionSettings['processVerbose']);
75
+    }
76 76
 
77
-	/**
78
-	 * starts multiple processes
79
-	 *
80
-	 * @param integer $timeout
81
-	 */
82
-	public function multiProcess($timeout) {
83
-		if ($this->processLimit <= 1) {
84
-			throw new RuntimeException('To run crawler in multi process mode you have to configure the processLimit > 1.' . PHP_EOL);
85
-		}
77
+    /**
78
+     * starts multiple processes
79
+     *
80
+     * @param integer $timeout
81
+     */
82
+    public function multiProcess($timeout) {
83
+        if ($this->processLimit <= 1) {
84
+            throw new RuntimeException('To run crawler in multi process mode you have to configure the processLimit > 1.' . PHP_EOL);
85
+        }
86 86
 
87
-		$pendingItemsStart = $this->queueRepository->countAllPendingItems();
88
-		$itemReportLimit = 20;
89
-		$reportItemCount = $pendingItemsStart - $itemReportLimit;
90
-		if ($this->verbose) {
91
-			$this->reportItemStatus();
92
-		}
93
-		$this->startRequiredProcesses();
94
-		$nextTimeOut = time() + $this->timeToLive;
87
+        $pendingItemsStart = $this->queueRepository->countAllPendingItems();
88
+        $itemReportLimit = 20;
89
+        $reportItemCount = $pendingItemsStart - $itemReportLimit;
90
+        if ($this->verbose) {
91
+            $this->reportItemStatus();
92
+        }
93
+        $this->startRequiredProcesses();
94
+        $nextTimeOut = time() + $this->timeToLive;
95 95
         $currentPendingItems = '';
96 96
         for ($i = 0; $i < $timeout; $i++) {
97
-			$currentPendingItems = $this->queueRepository->countAllPendingItems();
97
+            $currentPendingItems = $this->queueRepository->countAllPendingItems();
98 98
             if ($this->startRequiredProcesses()) {
99 99
                 $nextTimeOut = time() + $this->timeToLive;
100
-			}
101
-			if ($currentPendingItems == 0) {
102
-				if ($this->verbose) {
103
-					echo 'Finished...' . chr(10);
104
-				}
105
-				break;
106
-			}
107
-			if ($currentPendingItems < $reportItemCount) {
108
-				if ($this->verbose) {
109
-					$this->reportItemStatus();
110
-				}
111
-				$reportItemCount = $currentPendingItems - $itemReportLimit;
112
-			}
113
-			sleep(1);
114
-			if ($nextTimeOut < time()) {
115
-				$timedOutProcesses = $this->processRepository->findAll('', 'DESC', NULL, 0, 'ttl >' . $nextTimeOut);
116
-				$nextTimeOut = time() + $this->timeToLive;
117
-				if ($this->verbose) {
118
-					echo 'Cleanup' . implode(',', $timedOutProcesses->getProcessIds()) . chr(10);
119
-				}
120
-				$this->crawlerObj->CLI_releaseProcesses($timedOutProcesses->getProcessIds(), true);
121
-			}
122
-		}
123
-		if ($currentPendingItems > 0 && $this->verbose) {
124
-			echo 'Stop with timeout' . chr(10);
125
-		}
126
-	}
100
+            }
101
+            if ($currentPendingItems == 0) {
102
+                if ($this->verbose) {
103
+                    echo 'Finished...' . chr(10);
104
+                }
105
+                break;
106
+            }
107
+            if ($currentPendingItems < $reportItemCount) {
108
+                if ($this->verbose) {
109
+                    $this->reportItemStatus();
110
+                }
111
+                $reportItemCount = $currentPendingItems - $itemReportLimit;
112
+            }
113
+            sleep(1);
114
+            if ($nextTimeOut < time()) {
115
+                $timedOutProcesses = $this->processRepository->findAll('', 'DESC', NULL, 0, 'ttl >' . $nextTimeOut);
116
+                $nextTimeOut = time() + $this->timeToLive;
117
+                if ($this->verbose) {
118
+                    echo 'Cleanup' . implode(',', $timedOutProcesses->getProcessIds()) . chr(10);
119
+                }
120
+                $this->crawlerObj->CLI_releaseProcesses($timedOutProcesses->getProcessIds(), true);
121
+            }
122
+        }
123
+        if ($currentPendingItems > 0 && $this->verbose) {
124
+            echo 'Stop with timeout' . chr(10);
125
+        }
126
+    }
127 127
 
128
-	/**
129
-	 * Reports curent Status of queue
130
-	 */
131
-	protected function reportItemStatus() {
132
-		echo 'Pending:'.$this->queueRepository->countAllPendingItems().' / Assigned:'.$this->queueRepository->countAllAssignedPendingItems().chr(10);
133
-	}
128
+    /**
129
+     * Reports curent Status of queue
130
+     */
131
+    protected function reportItemStatus() {
132
+        echo 'Pending:'.$this->queueRepository->countAllPendingItems().' / Assigned:'.$this->queueRepository->countAllAssignedPendingItems().chr(10);
133
+    }
134 134
 
135
-	/**
136
-	 * according to the given count of pending items and the countInARun Setting this method
137
-	 * starts more crawling processes
138
-	 * @return boolean if processes are started
139
-	 */
140
-	private function startRequiredProcesses() {
141
-		$ret = FALSE;
142
-		$currentProcesses= $this->processRepository->countActive();
143
-		$availableProcessesCount = $this->processLimit-$currentProcesses;
144
-		$requiredProcessesCount = ceil($this->queueRepository->countAllUnassignedPendingItems() / $this->countInARun);
145
-		$startProcessCount = min(array($availableProcessesCount,$requiredProcessesCount));
146
-		if ($startProcessCount <= 0) {
147
-			return $ret;
148
-		}
149
-		if ($startProcessCount && $this->verbose) {
150
-			echo 'Start '.$startProcessCount.' new processes (Running:'.$currentProcesses.')';
151
-		}
152
-		for($i=0;$i<$startProcessCount;$i++) {
153
-			usleep(100);
154
-			if ($this->startProcess()) {
155
-				if ($this->verbose) {
156
-					echo '.';
157
-					$ret = TRUE;
158
-				}
159
-			}
160
-		}
161
-		if ($this->verbose) {
162
-			echo chr(10);
163
-		}
164
-		return $ret;
165
-	}
135
+    /**
136
+     * according to the given count of pending items and the countInARun Setting this method
137
+     * starts more crawling processes
138
+     * @return boolean if processes are started
139
+     */
140
+    private function startRequiredProcesses() {
141
+        $ret = FALSE;
142
+        $currentProcesses= $this->processRepository->countActive();
143
+        $availableProcessesCount = $this->processLimit-$currentProcesses;
144
+        $requiredProcessesCount = ceil($this->queueRepository->countAllUnassignedPendingItems() / $this->countInARun);
145
+        $startProcessCount = min(array($availableProcessesCount,$requiredProcessesCount));
146
+        if ($startProcessCount <= 0) {
147
+            return $ret;
148
+        }
149
+        if ($startProcessCount && $this->verbose) {
150
+            echo 'Start '.$startProcessCount.' new processes (Running:'.$currentProcesses.')';
151
+        }
152
+        for($i=0;$i<$startProcessCount;$i++) {
153
+            usleep(100);
154
+            if ($this->startProcess()) {
155
+                if ($this->verbose) {
156
+                    echo '.';
157
+                    $ret = TRUE;
158
+                }
159
+            }
160
+        }
161
+        if ($this->verbose) {
162
+            echo chr(10);
163
+        }
164
+        return $ret;
165
+    }
166 166
 
167
-	/**
168
-	 * starts new process
169
-	 * @throws Exception if no crawlerprocess was started
170
-	 */
171
-	public function startProcess() {
172
-		$ttl = (time() + $this->timeToLive -1);
173
-		$current = $this->processRepository->countNotTimeouted($ttl);
174
-		$completePath = '(' .escapeshellcmd($this->getCrawlerCliPath()) . ' &) > /dev/null';
175
-		if (system($completePath) === FALSE) {
176
-			throw new Exception('could not start process!');
177
-		}
178
-		else {
179
-			for ($i=0;$i<10;$i++) {
180
-				if ($this->processRepository->countNotTimeouted($ttl) > $current) {
181
-					return true;
182
-				}
183
-				sleep(1);
184
-			}
185
-			throw new Exception('Something went wrong: process did not appear within 10 seconds.');
186
-		}
187
-	}
167
+    /**
168
+     * starts new process
169
+     * @throws Exception if no crawlerprocess was started
170
+     */
171
+    public function startProcess() {
172
+        $ttl = (time() + $this->timeToLive -1);
173
+        $current = $this->processRepository->countNotTimeouted($ttl);
174
+        $completePath = '(' .escapeshellcmd($this->getCrawlerCliPath()) . ' &) > /dev/null';
175
+        if (system($completePath) === FALSE) {
176
+            throw new Exception('could not start process!');
177
+        }
178
+        else {
179
+            for ($i=0;$i<10;$i++) {
180
+                if ($this->processRepository->countNotTimeouted($ttl) > $current) {
181
+                    return true;
182
+                }
183
+                sleep(1);
184
+            }
185
+            throw new Exception('Something went wrong: process did not appear within 10 seconds.');
186
+        }
187
+    }
188 188
 
189
-	/**
190
-	 * Returns the path to start the crawler from the command line
191
-	 *
192
-	 * @return string
193
-	 */
194
-	public function getCrawlerCliPath(){
195
-		$phpPath 		= $this->crawlerObj->extensionSettings['phpPath'] . ' ';
196
-		$pathToTypo3 	= rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_DOCUMENT_ROOT'), '/');
197
-		$pathToTypo3 	.= rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'), '/');
198
-		$cliPart	 	= '/typo3/cli_dispatch.phpsh crawler';
199
-		return $phpPath.$pathToTypo3.$cliPart;
200
-	}
189
+    /**
190
+     * Returns the path to start the crawler from the command line
191
+     *
192
+     * @return string
193
+     */
194
+    public function getCrawlerCliPath(){
195
+        $phpPath 		= $this->crawlerObj->extensionSettings['phpPath'] . ' ';
196
+        $pathToTypo3 	= rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_DOCUMENT_ROOT'), '/');
197
+        $pathToTypo3 	.= rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'), '/');
198
+        $cliPart	 	= '/typo3/cli_dispatch.phpsh crawler';
199
+        return $phpPath.$pathToTypo3.$cliPart;
200
+    }
201 201
 
202 202
 }
Please login to merge, or discard this patch.
Classes/Task/CrawlerQueueTaskAdditionalFieldProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
         // input for startPage
88 88
         $fieldId = 'task_startPage';
89
-        $fieldCode = '<input name="tx_scheduler[startPage]" type="text" id="' . $fieldId . '" value="' . $task->startPage . '" class="form-control" />';
89
+        $fieldCode = '<input name="tx_scheduler[startPage]" type="text" id="'.$fieldId.'" value="'.$task->startPage.'" class="form-control" />';
90 90
         $additionalFields[$fieldId] = array(
91 91
             'code' => $fieldCode,
92 92
             'label' => 'LLL:EXT:crawler/Resources/Private/Language/Backend.xlf:crawler_im.startPage'
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
             '4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_4'),
103 103
             '99' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.depth_infi'),
104 104
         );
105
-        $fieldCode = '<select name="tx_scheduler[depth]" id="' . $fieldId . '" class="form-control">';
105
+        $fieldCode = '<select name="tx_scheduler[depth]" id="'.$fieldId.'" class="form-control">';
106 106
 
107 107
         foreach ($fieldValueArray as $key => $label) {
108
-            $fieldCode .= "\t" . '<option value="' . $key . '"' . (($key == $task->depth) ? ' selected="selected"' : '') . '>' . $label . '</option>';
108
+            $fieldCode .= "\t".'<option value="'.$key.'"'.(($key == $task->depth) ? ' selected="selected"' : '').'>'.$label.'</option>';
109 109
         }
110 110
 
111 111
         $fieldCode .= '</select>';
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
         // combobox for configuration records
118 118
         $recordsArray = $this->getCrawlerConfigurationRecords();
119 119
         $fieldId = 'task_configuration';
120
-        $fieldCode = '<select name="tx_scheduler[configuration][]" multiple="multiple" id="' . $fieldId . '" class="form-control">';
121
-        $fieldCode .= "\t" . '<option value=""></option>';
120
+        $fieldCode = '<select name="tx_scheduler[configuration][]" multiple="multiple" id="'.$fieldId.'" class="form-control">';
121
+        $fieldCode .= "\t".'<option value=""></option>';
122 122
         $arraySize = count($recordsArray);
123 123
         for ($i = 0; $i < $arraySize; $i++) {
124
-            $fieldCode .= "\t" . '<option ' . $this->getSelectedState($task->configuration, $recordsArray[$i]['name']) . 'value="' . $recordsArray[$i]['name'] . '">' . $recordsArray[$i]['name'] . '</option>';
124
+            $fieldCode .= "\t".'<option '.$this->getSelectedState($task->configuration, $recordsArray[$i]['name']).'value="'.$recordsArray[$i]['name'].'">'.$recordsArray[$i]['name'].'</option>';
125 125
         }
126 126
         $fieldCode .= '</select>';
127 127
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
165 165
             '*',
166 166
             'tx_crawler_configuration',
167
-            '1=1' . BackendUtility::deleteClause('tx_crawler_configuration')
167
+            '1=1'.BackendUtility::deleteClause('tx_crawler_configuration')
168 168
         );
169 169
 
170 170
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
Please login to merge, or discard this patch.