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