Completed
Push — issue/203 ( 66dda3...51c0a4 )
by Tomas Norre
32:37 queued 23:42
created
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.
Classes/Api/CrawlerApi.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@
 block discarded – undo
209 209
     /**
210 210
      * Determines if a page is queued
211 211
      *
212
-     * @param $uid
212
+     * @param integer $uid
213 213
      * @param bool $unprocessed_only
214 214
      * @param bool $timed_only
215 215
      * @param bool $timestamp
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     protected function findCrawler()
93 93
     {
94
-        if ( ! is_object($this->crawlerObj)) {
94
+        if (!is_object($this->crawlerObj)) {
95 95
             $this->crawlerObj = GeneralUtility::makeInstance('tx_crawler_lib');
96 96
             $this->crawlerObj->setID = GeneralUtility::md5int(microtime());
97 97
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         if (count($this->allowedConfigrations) > 0) {
127 127
             // 	remove configuration that does not match the current selection
128 128
             foreach ($configurations as $confKey => $confArray) {
129
-                if ( ! in_array($confKey, $this->allowedConfigrations)) {
129
+                if (!in_array($confKey, $this->allowedConfigrations)) {
130 130
                     unset($configurations[$confKey]);
131 131
                 }
132 132
             }
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
         //if the same page is scheduled for the same time and has not be executed?
193 193
         if ($schedule_timestamp == 0) {
194 194
             //untimed elements need an exec_time with 0 because they can occure multiple times
195
-            $where = 'page_id=' . $page_uid . ' AND exec_time = 0 AND scheduled=' . $schedule_timestamp;
195
+            $where = 'page_id='.$page_uid.' AND exec_time = 0 AND scheduled='.$schedule_timestamp;
196 196
         } else {
197 197
             //timed elementes have got a fixed schedule time, if a record with this time
198 198
             //exists it is maybe queued for the future, or is has been queue for the past and therefore
199 199
             //also been processed.
200
-            $where = 'page_id=' . $page_uid . ' AND scheduled=' . $schedule_timestamp;
200
+            $where = 'page_id='.$page_uid.' AND scheduled='.$schedule_timestamp;
201 201
         }
202 202
 
203 203
         $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*) as cnt',
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
         $isPageInQueue = false;
226 226
 
227
-        $whereClause = 'page_id = ' . (integer)$uid;
227
+        $whereClause = 'page_id = '.(integer) $uid;
228 228
 
229 229
         if (false !== $unprocessed_only) {
230 230
             $whereClause .= ' AND exec_time = 0';
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         }
236 236
 
237 237
         if (false !== $timestamp) {
238
-            $whereClause .= ' AND scheduled = ' . (integer)$timestamp;
238
+            $whereClause .= ' AND scheduled = '.(integer) $timestamp;
239 239
         }
240 240
 
241 241
         $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
     {
265 265
         $uid   = intval($uid);
266 266
         $query = 'max(scheduled) as latest';
267
-        $where = ' page_id = ' . $uid;
267
+        $where = ' page_id = '.$uid;
268 268
 
269 269
         if ($future_crawldates_only) {
270
-            $where .= ' AND scheduled > ' . time();
270
+            $where .= ' AND scheduled > '.time();
271 271
         }
272 272
 
273 273
         if ($unprocessed_only) {
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
         $limit = $GLOBALS['TYPO3_DB']->fullQuoteStr($limit, 'tx_crawler_queue');
301 301
 
302 302
         $query = 'scheduled, exec_time, set_id';
303
-        $where = ' page_id = ' . $uid;
303
+        $where = ' page_id = '.$uid;
304 304
 
305 305
         $limit_query = ($limit) ? $limit : null;
306 306
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
     {
379 379
         $qid   = intval($qid);
380 380
         $table = 'tx_crawler_queue';
381
-        $where = ' qid=' . $qid;
381
+        $where = ' qid='.$qid;
382 382
         $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where);
383 383
     }
384 384
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
      */
407 407
     protected function getQueueRepository()
408 408
     {
409
-        if ( ! $this->queueRepository instanceof \tx_crawler_domain_queue_repository) {
409
+        if (!$this->queueRepository instanceof \tx_crawler_domain_queue_repository) {
410 410
             $this->queueRepository = new \tx_crawler_domain_queue_repository();
411 411
         }
412 412
 
Please login to merge, or discard this patch.
class.tx_crawler_lib.php 4 patches
Doc Comments   +19 added lines, -7 removed lines patch added patch discarded remove patch
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
      * @param string $piString                     PI to test
421 421
      * @param array $incomingProcInstructions     Processing instructions
422 422
      *
423
-     * @return boolean                              TRUE if found
423
+     * @return boolean|null                              TRUE if found
424 424
      */
425 425
     public function drawURLs_PIfilter($piString, array $incomingProcInstructions) {
426 426
         if (empty($incomingProcInstructions)) {
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
     }
627 627
 
628 628
     /**
629
-     * @param $rootId
629
+     * @param integer $rootId
630 630
      * @param $depth
631 631
      *
632 632
      * @return array
@@ -732,6 +732,7 @@  discard block
 block discarded – undo
732 732
      *
733 733
      * @param    array        Array with key (GET var name) and values (value of GET var which is configuration for expansion)
734 734
      * @param    integer        Current page ID
735
+     * @param integer $pid
735 736
      * @return    array        Array with key (GET var name) with the value being an array of all possible values for that key.
736 737
      */
737 738
     protected function expandParameters($paramArray, $pid)    {
@@ -850,7 +851,7 @@  discard block
 block discarded – undo
850 851
      * The number of URLs will be the multiplication of the number of parameter values for each key
851 852
      *
852 853
      * @param  array  $paramArray   Output of expandParameters(): Array with keys (GET var names) and for each an array of values
853
-     * @param  array  $urls         URLs accumulated in this array (for recursion)
854
+     * @param  string[]  $urls         URLs accumulated in this array (for recursion)
854 855
      * @return array                URLs accumulated, if number of urls exceed 'maxCompileUrls' it will return false as an error!
855 856
      */
856 857
     public function compileUrls($paramArray, $urls = array()) {
@@ -1018,6 +1019,8 @@  discard block
 block discarded – undo
1018 1019
      * @param    integer        Scheduled-time
1019 1020
      * @param     string        (optional) configuration hash
1020 1021
      * @param     bool        (optional) skip inner duplication check
1022
+     * @param string $url
1023
+     * @param double $tstamp
1021 1024
      * @return    bool        true if the url was added, false if it already existed
1022 1025
      */
1023 1026
     protected function addUrl (
@@ -1460,6 +1463,7 @@  discard block
 block discarded – undo
1460 1463
 
1461 1464
     /**
1462 1465
      * @param message
1466
+     * @param string $message
1463 1467
      */
1464 1468
     protected function log($message) {
1465 1469
         if (!empty($this->extensionSettings['logFileName'])) {
@@ -1473,7 +1477,7 @@  discard block
 block discarded – undo
1473 1477
      * @param array $url
1474 1478
      * @param string $crawlerId
1475 1479
      *
1476
-     * @return array
1480
+     * @return string[]
1477 1481
      */
1478 1482
     protected function buildRequestHeaderArray(array $url, $crawlerId) {
1479 1483
         $reqHeaders = array();
@@ -1567,6 +1571,12 @@  discard block
 block discarded – undo
1567 1571
      * @param    boolean        If set (and submitcrawlUrls is false) will fill $downloadUrls with entries)
1568 1572
      * @param    array        Array of processing instructions
1569 1573
      * @param    array        Array of configuration keys
1574
+     * @param integer $id
1575
+     * @param integer $depth
1576
+     * @param integer $scheduledTime
1577
+     * @param integer $reqMinute
1578
+     * @param boolean $submitCrawlUrls
1579
+     * @param boolean $downloadCrawlUrls
1570 1580
      * @return    string        HTML code
1571 1581
      */
1572 1582
     function getPageTreeAndUrls(
@@ -1715,6 +1725,7 @@  discard block
 block discarded – undo
1715 1725
      *
1716 1726
      * @param    array        Page row
1717 1727
      * @param    string        Page icon and title for row
1728
+     * @param string $pageTitleAndIcon
1718 1729
      * @return    string        HTML <tr> content (one or more)
1719 1730
      */
1720 1731
     public function drawURLs_addRowsForPage(array $pageRow, $pageTitleAndIcon)    {
@@ -2008,7 +2019,7 @@  discard block
 block discarded – undo
2008 2019
     /**
2009 2020
      * Function executed by crawler_im.php cli script.
2010 2021
      *
2011
-     * @return bool
2022
+     * @return null|boolean
2012 2023
      */
2013 2024
     function CLI_main_flush() {
2014 2025
         $this->setAccessMode('cli_flush');
@@ -2065,7 +2076,7 @@  discard block
 block discarded – undo
2065 2076
      * @param  int $countInARun
2066 2077
      * @param  int $sleepTime
2067 2078
      * @param  int $sleepAfterFinish
2068
-     * @return string                   Status message
2079
+     * @return integer                   Status message
2069 2080
      */
2070 2081
     public function CLI_run($countInARun, $sleepTime, $sleepAfterFinish) {
2071 2082
         $result = 0;
@@ -2337,6 +2348,7 @@  discard block
 block discarded – undo
2337 2348
      * Used to determine timeouts and to ensure a proper cleanup if there's a timeout
2338 2349
      *
2339 2350
      * @param  string  identification string for the process
2351
+     * @param string $pid
2340 2352
      * @return boolean determines if the process is still active / has resources
2341 2353
      *
2342 2354
      * FIXME: Please remove Transaction, not needed as only a select query.
@@ -2374,7 +2386,7 @@  discard block
 block discarded – undo
2374 2386
     /**
2375 2387
      * @param bool $get_as_float
2376 2388
      *
2377
-     * @return mixed
2389
+     * @return string
2378 2390
      *
2379 2391
      * @codeCoverageIgnore
2380 2392
      */
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
         return time();
1150 1150
     }
1151 1151
 
1152
-     /************************************
1152
+        /************************************
1153 1153
      *
1154 1154
      * URL reading
1155 1155
      *
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
             return FALSE;
1317 1317
         }
1318 1318
 
1319
- 	    // direct request
1319
+            // direct request
1320 1320
         if ($this->extensionSettings['makeDirectRequests']) {
1321 1321
             $result = $this->sendDirectRequest($originalUrl, $crawlerId);
1322 1322
             return $result;
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
      *
2329 2329
      * @return void
2330 2330
      */
2331
-     public function CLI_deleteProcessesMarkedDeleted() {
2331
+        public function CLI_deleteProcessesMarkedDeleted() {
2332 2332
         $this->db->exec_DELETEquery('tx_crawler_process', 'deleted = 1');
2333 2333
     }
2334 2334
 
Please login to merge, or discard this patch.
Braces   +48 added lines, -18 removed lines patch added patch discarded remove patch
@@ -640,7 +640,9 @@  discard block
 block discarded – undo
640 640
             $sets = $pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.'];
641 641
             if(is_array($sets)) {
642 642
                 foreach($sets as $key=>$value) {
643
-                    if(!is_array($value)) continue;
643
+                    if(!is_array($value)) {
644
+                        continue;
645
+                    }
644 646
                     $configurationsForBranch[] = substr($key,-1)=='.'?substr($key,0,-1):$key;
645 647
                 }
646 648
             }
@@ -987,7 +989,9 @@  discard block
 block discarded – undo
987 989
      */
988 990
     public function addQueueEntry_callBack($setId,$params,$callBack,$page_id=0,$schedule=0) {
989 991
 
990
-        if (!is_array($params))    $params = array();
992
+        if (!is_array($params)) {
993
+            $params = array();
994
+        }
991 995
         $params['_CALLBACKOBJ'] = $callBack;
992 996
 
993 997
             // Compile value array:
@@ -1079,7 +1083,7 @@  discard block
 block discarded – undo
1079 1083
                 $rows[] = $uid;
1080 1084
                 $urlAdded = true;
1081 1085
                 tx_crawler_domain_events_dispatcher::getInstance()->post('urlAddedToQueue',$this->setID,array('uid' => $uid, 'fieldArray' => $fieldArray));
1082
-            }else{
1086
+            } else{
1083 1087
                 tx_crawler_domain_events_dispatcher::getInstance()->post('duplicateUrlInQueue',$this->setID,array('rows' => $rows, 'fieldArray' => $fieldArray));
1084 1088
             }
1085 1089
         }
@@ -1108,7 +1112,7 @@  discard block
 block discarded – undo
1108 1112
                 $timeBegin     = $currentTime - 100;
1109 1113
                 $timeEnd     = $currentTime + 100;
1110 1114
                 $where         = ' ((scheduled BETWEEN '.$timeBegin.' AND '.$timeEnd.' ) OR scheduled <= '. $currentTime.') ';
1111
-            }else{
1115
+            } else{
1112 1116
                 $where = 'scheduled <= ' . $currentTime;
1113 1117
             }
1114 1118
         } elseif ($tstamp > $currentTime) {
@@ -1301,18 +1305,24 @@  discard block
 block discarded – undo
1301 1305
      */
1302 1306
     public function requestUrl($originalUrl, $crawlerId, $timeout=2, $recursion=10) {
1303 1307
 
1304
-        if (!$recursion) return false;
1308
+        if (!$recursion) {
1309
+            return false;
1310
+        }
1305 1311
 
1306 1312
             // Parse URL, checking for scheme:
1307 1313
         $url = parse_url($originalUrl);
1308 1314
 
1309 1315
         if ($url === FALSE) {
1310
-            if (TYPO3_DLOG) \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Could not parse_url() for string "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1316
+            if (TYPO3_DLOG) {
1317
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Could not parse_url() for string "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1318
+            }
1311 1319
             return FALSE;
1312 1320
         }
1313 1321
 
1314 1322
         if (!in_array($url['scheme'], array('','http','https'))) {
1315
-            if (TYPO3_DLOG) \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Scheme does not match for url "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1323
+            if (TYPO3_DLOG) {
1324
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Scheme does not match for url "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1325
+            }
1316 1326
             return FALSE;
1317 1327
         }
1318 1328
 
@@ -1346,7 +1356,9 @@  discard block
 block discarded – undo
1346 1356
         $fp = fsockopen($host, $port, $errno, $errstr, $timeout);
1347 1357
 
1348 1358
         if (!$fp) {
1349
-            if (TYPO3_DLOG) \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Error while opening "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1359
+            if (TYPO3_DLOG) {
1360
+                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Error while opening "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1361
+            }
1350 1362
             return FALSE;
1351 1363
         } else {
1352 1364
                 // Request message:
@@ -1374,7 +1386,9 @@  discard block
 block discarded – undo
1374 1386
                 if (is_array($newRequestUrl)) {
1375 1387
                     $result = array_merge(array('parentRequest'=>$result), $newRequestUrl);
1376 1388
                 } else {
1377
-                    if (TYPO3_DLOG) \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Error while opening "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1389
+                    if (TYPO3_DLOG) {
1390
+                        \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Error while opening "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1391
+                    }
1378 1392
                     return FALSE;
1379 1393
                 }
1380 1394
             }
@@ -1500,20 +1514,32 @@  discard block
 block discarded – undo
1500 1514
      * @return    string        URL from redirection
1501 1515
      */
1502 1516
     protected function getRequestUrlFrom302Header($headers,$user='',$pass='') {
1503
-        if(!is_array($headers)) return false;
1504
-        if(!(stristr($headers[0],'301 Moved') || stristr($headers[0],'302 Found') || stristr($headers[0],'302 Moved'))) return false;
1517
+        if(!is_array($headers)) {
1518
+            return false;
1519
+        }
1520
+        if(!(stristr($headers[0],'301 Moved') || stristr($headers[0],'302 Found') || stristr($headers[0],'302 Moved'))) {
1521
+            return false;
1522
+        }
1505 1523
 
1506 1524
         foreach($headers as $hl) {
1507 1525
             $tmp = explode(": ",$hl);
1508 1526
             $header[trim($tmp[0])] = trim($tmp[1]);
1509
-            if(trim($tmp[0])=='Location') break;
1527
+            if(trim($tmp[0])=='Location') {
1528
+                break;
1529
+            }
1530
+        }
1531
+        if(!array_key_exists('Location',$header)) {
1532
+            return false;
1510 1533
         }
1511
-        if(!array_key_exists('Location',$header)) return false;
1512 1534
 
1513 1535
         if($user!='') {
1514
-            if(!($tmp = parse_url($header['Location']))) return false;
1536
+            if(!($tmp = parse_url($header['Location']))) {
1537
+                return false;
1538
+            }
1515 1539
             $newUrl = $tmp['scheme'] . '://' . $user . ':' . $pass . '@' . $tmp['host'] . $tmp['path'];
1516
-            if($tmp['query']!='') $newUrl .= '?' . $tmp['query'];
1540
+            if($tmp['query']!='') {
1541
+                $newUrl .= '?' . $tmp['query'];
1542
+            }
1517 1543
         } else {
1518 1544
             $newUrl = $header['Location'];
1519 1545
         }
@@ -1942,7 +1968,7 @@  discard block
 block discarded – undo
1942 1968
             $configurations = $this->getUrlsForPageId($pageId);
1943 1969
             if(is_array($configurations)){
1944 1970
                 $configurationKeys = array_keys($configurations);
1945
-            }else{
1971
+            } else{
1946 1972
                 $configurationKeys = array();
1947 1973
             }
1948 1974
         }
@@ -2274,7 +2300,9 @@  discard block
 block discarded – undo
2274 2300
             return false;   //nothing to release
2275 2301
         }
2276 2302
 
2277
-        if(!$withinLock) $this->db->sql_query('BEGIN');
2303
+        if(!$withinLock) {
2304
+            $this->db->sql_query('BEGIN');
2305
+        }
2278 2306
 
2279 2307
             // some kind of 2nd chance algo - this way you need at least 2 processes to have a real cleanup
2280 2308
             // this ensures that a single process can't mess up the entire process table
@@ -2318,7 +2346,9 @@  discard block
 block discarded – undo
2318 2346
             )
2319 2347
         );
2320 2348
 
2321
-        if(!$withinLock) $this->db->sql_query('COMMIT');
2349
+        if(!$withinLock) {
2350
+            $this->db->sql_query('COMMIT');
2351
+        }
2322 2352
 
2323 2353
         return true;
2324 2354
     }
Please login to merge, or discard this patch.
Spacing   +286 added lines, -286 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 class tx_crawler_lib {
30 30
 
31 31
     var $setID = 0;
32
-    var $processID ='';
33
-    var $max_CLI_exec_time = 3600;    // One hour is max stalled time for the CLI (If the process has had the status "start" for 3600 seconds it will be regarded stalled and a new process is started.
32
+    var $processID = '';
33
+    var $max_CLI_exec_time = 3600; // One hour is max stalled time for the CLI (If the process has had the status "start" for 3600 seconds it will be regarded stalled and a new process is started.
34 34
 
35 35
     var $duplicateTrack = array();
36 36
     var $downloadUrls = array();
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
     var $queueEntries = array();
44 44
     var $urlList = array();
45 45
 
46
-    var $debugMode=FALSE;
46
+    var $debugMode = FALSE;
47 47
 
48
-    var $extensionSettings=array();
48
+    var $extensionSettings = array();
49 49
 
50 50
     var $MP = false; // mount point
51 51
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
     private $backendUser;
70 70
 
71 71
     const CLI_STATUS_NOTHING_PROCCESSED = 0;
72
-    const CLI_STATUS_REMAIN = 1;    //queue not empty
73
-    const CLI_STATUS_PROCESSED = 2;    //(some) queue items where processed
74
-    const CLI_STATUS_ABORTED = 4;    //instance didn't finish
72
+    const CLI_STATUS_REMAIN = 1; //queue not empty
73
+    const CLI_STATUS_PROCESSED = 2; //(some) queue items where processed
74
+    const CLI_STATUS_ABORTED = 4; //instance didn't finish
75 75
     const CLI_STATUS_POLLABLE_PROCESSED = 8;
76 76
 
77 77
     /**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             $this->extensionSettings['countInARun'] = 100;
163 163
         }
164 164
 
165
-        $this->extensionSettings['processLimit'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1);
165
+        $this->extensionSettings['processLimit'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'], 1, 99, 1);
166 166
     }
167 167
 
168 168
     /**
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         }
196 196
 
197 197
         if (!$skipPage) {
198
-            if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('3,4', $pageRow['doktype']) || $pageRow['doktype']>=199)    {
198
+            if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('3,4', $pageRow['doktype']) || $pageRow['doktype'] >= 199) {
199 199
                 $skipPage = true;
200 200
                 $skipMessage = 'Because doktype is not allowed';
201 201
             }
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
         if (!$skipPage) {
217 217
                 // veto hook
218 218
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pageVeto'])) {
219
-                foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pageVeto'] as $key => $func)    {
219
+                foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pageVeto'] as $key => $func) {
220 220
                     $params = array(
221 221
                         'pageRow' => $pageRow
222 222
                     );
223 223
                     // expects "false" if page is ok and "true" or a skipMessage if this page should _not_ be crawled
224 224
                     $veto = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($func, $params, $this);
225
-                    if ($veto !== false)    {
225
+                    if ($veto !== false) {
226 226
                         $skipPage = true;
227 227
                         if (is_string($veto)) {
228 228
                             $skipMessage = $veto;
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
      * @param  string $configurationHash
272 272
      * @return boolean
273 273
      */
274
-    protected function noUnprocessedQueueEntriesForPageWithConfigurationHashExist($uid,$configurationHash) {
275
-        $configurationHash = $this->db->fullQuoteStr($configurationHash,'tx_crawler_queue');
276
-        $res = $this->db->exec_SELECTquery('count(*) as anz','tx_crawler_queue',"page_id=".intval($uid)." AND configuration_hash=".$configurationHash." AND exec_time=0");
274
+    protected function noUnprocessedQueueEntriesForPageWithConfigurationHashExist($uid, $configurationHash) {
275
+        $configurationHash = $this->db->fullQuoteStr($configurationHash, 'tx_crawler_queue');
276
+        $res = $this->db->exec_SELECTquery('count(*) as anz', 'tx_crawler_queue', "page_id=".intval($uid)." AND configuration_hash=".$configurationHash." AND exec_time=0");
277 277
         $row = $this->db->sql_fetch_assoc($res);
278 278
 
279 279
         return ($row['anz'] == 0);
@@ -338,26 +338,26 @@  discard block
 block discarded – undo
338 338
             }
339 339
         }
340 340
 
341
-        if (is_array($vv['URLs']))    {
342
-            $configurationHash     =    md5(serialize($vv));
343
-            $skipInnerCheck     =    $this->noUnprocessedQueueEntriesForPageWithConfigurationHashExist($pageRow['uid'],$configurationHash);
341
+        if (is_array($vv['URLs'])) {
342
+            $configurationHash = md5(serialize($vv));
343
+            $skipInnerCheck = $this->noUnprocessedQueueEntriesForPageWithConfigurationHashExist($pageRow['uid'], $configurationHash);
344 344
 
345
-            foreach($vv['URLs'] as $urlQuery)    {
345
+            foreach ($vv['URLs'] as $urlQuery) {
346 346
 
347
-                if ($this->drawURLs_PIfilter($vv['subCfg']['procInstrFilter'], $incomingProcInstructions))    {
347
+                if ($this->drawURLs_PIfilter($vv['subCfg']['procInstrFilter'], $incomingProcInstructions)) {
348 348
 
349 349
                     // Calculate cHash:
350
-                    if ($vv['subCfg']['cHash'])    {
350
+                    if ($vv['subCfg']['cHash']) {
351 351
                         /* @var $cacheHash \TYPO3\CMS\Frontend\Page\CacheHashCalculator */
352 352
                         $cacheHash = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Frontend\Page\CacheHashCalculator');
353
-                        $urlQuery .= '&cHash=' . $cacheHash->generateForParameters($urlQuery);
353
+                        $urlQuery .= '&cHash='.$cacheHash->generateForParameters($urlQuery);
354 354
                     }
355 355
 
356 356
                     // Create key by which to determine unique-ness:
357 357
                     $uKey = $urlQuery.'|'.$vv['subCfg']['userGroups'].'|'.$vv['subCfg']['baseUrl'].'|'.$vv['subCfg']['procInstrFilter'];
358 358
 
359 359
                     // realurl support (thanks to Ingo Renner)
360
-                    $urlQuery = 'index.php' . $urlQuery;
360
+                    $urlQuery = 'index.php'.$urlQuery;
361 361
                     if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('realurl') && $vv['subCfg']['realurl']) {
362 362
                         $params = array(
363 363
                             'LD' => array(
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
                     }
371 371
 
372 372
                     // Scheduled time:
373
-                    $schTime = $scheduledTime + round(count($duplicateTrack)*(60/$reqMinute));
374
-                    $schTime = floor($schTime/60)*60;
373
+                    $schTime = $scheduledTime + round(count($duplicateTrack) * (60 / $reqMinute));
374
+                    $schTime = floor($schTime / 60) * 60;
375 375
 
376 376
                     if (isset($duplicateTrack[$uKey])) {
377 377
 
@@ -383,10 +383,10 @@  discard block
 block discarded – undo
383 383
                         $urlList = '['.date('d.m.y H:i', $schTime).'] '.htmlspecialchars($urlQuery);
384 384
                         $this->urlList[] = '['.date('d.m.y H:i', $schTime).'] '.$urlQuery;
385 385
 
386
-                        $theUrl = ($vv['subCfg']['baseUrl'] ? $vv['subCfg']['baseUrl'] : \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL')) . $urlQuery;
386
+                        $theUrl = ($vv['subCfg']['baseUrl'] ? $vv['subCfg']['baseUrl'] : \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL')).$urlQuery;
387 387
 
388 388
                         // Submit for crawling!
389
-                        if ($submitCrawlUrls)    {
389
+                        if ($submitCrawlUrls) {
390 390
                             $added = $this->addUrl(
391 391
                             $pageRow['uid'],
392 392
                             $theUrl,
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                             if ($added === false) {
399 399
                                 $urlList .= ' (Url already existed)';
400 400
                             }
401
-                        } elseif ($downloadCrawlUrls)    {
401
+                        } elseif ($downloadCrawlUrls) {
402 402
                             $downloadUrls[$theUrl] = $theUrl;
403 403
                         }
404 404
 
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
             return TRUE;
428 428
         }
429 429
 
430
-        foreach($incomingProcInstructions as $pi) {
430
+        foreach ($incomingProcInstructions as $pi) {
431 431
             if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($piString, $pi)) {
432 432
                 return TRUE;
433 433
             }
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
      * @return array
441 441
      */
442 442
     public function getPageTSconfigForId($id) {
443
-        if(!$this->MP){
443
+        if (!$this->MP) {
444 444
             $pageTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($id);
445 445
         } else {
446 446
             list(,$mountPointId) = explode('-', $this->MP);
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
      * @param  integer $id  Page ID
469 469
      * @return array        Configurations from pages and configuration records
470 470
      */
471
-    protected function getUrlsForPageId($id)    {
471
+    protected function getUrlsForPageId($id) {
472 472
 
473 473
         /**
474 474
          * Get configuration from tsConfig
@@ -479,24 +479,24 @@  discard block
 block discarded – undo
479 479
 
480 480
         $res = array();
481 481
 
482
-        if (is_array($pageTSconfig) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']))    {
482
+        if (is_array($pageTSconfig) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.'])) {
483 483
             $crawlerCfg = $pageTSconfig['tx_crawler.']['crawlerCfg.'];
484 484
 
485
-            if (is_array($crawlerCfg['paramSets.']))    {
486
-                foreach($crawlerCfg['paramSets.'] as $key => $values)    {
487
-                    if (!is_array($values))    {
485
+            if (is_array($crawlerCfg['paramSets.'])) {
486
+                foreach ($crawlerCfg['paramSets.'] as $key => $values) {
487
+                    if (!is_array($values)) {
488 488
 
489 489
                         // Sub configuration for a single configuration string:
490
-                        $subCfg = (array)$crawlerCfg['paramSets.'][$key.'.'];
490
+                        $subCfg = (array) $crawlerCfg['paramSets.'][$key.'.'];
491 491
                         $subCfg['key'] = $key;
492 492
 
493
-                        if (strcmp($subCfg['procInstrFilter'],''))    {
494
-                            $subCfg['procInstrFilter'] = implode(',',\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',',$subCfg['procInstrFilter']));
493
+                        if (strcmp($subCfg['procInstrFilter'], '')) {
494
+                            $subCfg['procInstrFilter'] = implode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $subCfg['procInstrFilter']));
495 495
                         }
496
-                        $pidOnlyList = implode(',',\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',',$subCfg['pidsOnly'],1));
496
+                        $pidOnlyList = implode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $subCfg['pidsOnly'], 1));
497 497
 
498 498
                             // process configuration if it is not page-specific or if the specific page is the current page:
499
-                        if (!strcmp($subCfg['pidsOnly'],'') || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($pidOnlyList,$id))    {
499
+                        if (!strcmp($subCfg['pidsOnly'], '') || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($pidOnlyList, $id)) {
500 500
 
501 501
                                 // add trailing slash if not present
502 502
                             if (!empty($subCfg['baseUrl']) && substr($subCfg['baseUrl'], -1) != '/') {
@@ -507,14 +507,14 @@  discard block
 block discarded – undo
507 507
                             $res[$key] = array();
508 508
                             $res[$key]['subCfg'] = $subCfg;
509 509
                             $res[$key]['paramParsed'] = $this->parseParams($values);
510
-                            $res[$key]['paramExpanded'] = $this->expandParameters($res[$key]['paramParsed'],$id);
510
+                            $res[$key]['paramExpanded'] = $this->expandParameters($res[$key]['paramParsed'], $id);
511 511
                             $res[$key]['origin'] = 'pagets';
512 512
 
513 513
                                 // recognize MP value
514
-                            if(!$this->MP){
515
-                                $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'],array('?id='.$id));
514
+                            if (!$this->MP) {
515
+                                $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], array('?id='.$id));
516 516
                             } else {
517
-                                $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'],array('?id='.$id.'&MP='.$this->MP));
517
+                                $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], array('?id='.$id.'&MP='.$this->MP));
518 518
                             }
519 519
                         }
520 520
                     }
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
                 'tx_crawler_configuration',
536 536
                 'pid',
537 537
                 intval($page['uid']),
538
-                \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_crawler_configuration') . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_crawler_configuration')
538
+                \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_crawler_configuration').\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_crawler_configuration')
539 539
             );
540 540
 
541 541
             if (is_array($configurationRecordsForCurrentPage)) {
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
                         // check access to the configuration record
545 545
                     if (empty($configurationRecord['begroups']) || $GLOBALS['BE_USER']->isAdmin() || $this->hasGroupAccess($GLOBALS['BE_USER']->user['usergroup_cached_list'], $configurationRecord['begroups'])) {
546 546
 
547
-                        $pidOnlyList = implode(',',\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',',$configurationRecord['pidsonly'],1));
547
+                        $pidOnlyList = implode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $configurationRecord['pidsonly'], 1));
548 548
 
549 549
                             // process configuration if it is not page-specific or if the specific page is the current page:
550
-                        if (!strcmp($configurationRecord['pidsonly'],'') || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($pidOnlyList,$id)) {
550
+                        if (!strcmp($configurationRecord['pidsonly'], '') || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($pidOnlyList, $id)) {
551 551
                             $key = $configurationRecord['name'];
552 552
 
553 553
                                 // don't overwrite previously defined paramSets
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
                                     $res[$key]['subCfg'] = $subCfg;
578 578
                                     $res[$key]['paramParsed'] = $this->parseParams($configurationRecord['configuration']);
579 579
                                     $res[$key]['paramExpanded'] = $this->expandParameters($res[$key]['paramParsed'], $id);
580
-                                    $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], array('?id=' . $id));
580
+                                    $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], array('?id='.$id));
581 581
                                     $res[$key]['origin'] = 'tx_crawler_configuration_'.$configurationRecord['uid'];
582 582
                                 }
583 583
                             }
@@ -587,8 +587,8 @@  discard block
 block discarded – undo
587 587
             }
588 588
         }
589 589
 
590
-        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['processUrls']))    {
591
-            foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['processUrls'] as $func)    {
590
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['processUrls'])) {
591
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['processUrls'] as $func) {
592 592
                 $params = array(
593 593
                     'res' => &$res,
594 594
                 );
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
             $res = $this->db->exec_SELECTquery(
614 614
                 '*',
615 615
                 'sys_domain',
616
-                'uid = '.$sysDomainUid .
617
-                \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('sys_domain') .
616
+                'uid = '.$sysDomainUid.
617
+                \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('sys_domain').
618 618
                 \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_domain')
619 619
             );
620 620
             $row = $this->db->sql_fetch_assoc($res);
@@ -638,24 +638,24 @@  discard block
 block discarded – undo
638 638
         $pageTSconfig = $this->getPageTSconfigForId($rootId);
639 639
         if (is_array($pageTSconfig) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.'])) {
640 640
             $sets = $pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.'];
641
-            if(is_array($sets)) {
642
-                foreach($sets as $key=>$value) {
643
-                    if(!is_array($value)) continue;
644
-                    $configurationsForBranch[] = substr($key,-1)=='.'?substr($key,0,-1):$key;
641
+            if (is_array($sets)) {
642
+                foreach ($sets as $key=>$value) {
643
+                    if (!is_array($value)) continue;
644
+                    $configurationsForBranch[] = substr($key, -1) == '.' ? substr($key, 0, -1) : $key;
645 645
                 }
646 646
             }
647 647
         }
648 648
         $pids = array();
649 649
         $rootLine = \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($rootId);
650
-        foreach($rootLine as $node) {
650
+        foreach ($rootLine as $node) {
651 651
             $pids[] = $node['uid'];
652 652
         }
653 653
         /* @var \TYPO3\CMS\Backend\Tree\View\PageTreeView */
654 654
         $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
655 655
         $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
656
-        $tree->init('AND ' . $perms_clause);
656
+        $tree->init('AND '.$perms_clause);
657 657
         $tree->getTree($rootId, $depth, '');
658
-        foreach($tree->tree as $node) {
658
+        foreach ($tree->tree as $node) {
659 659
             $pids[] = $node['row']['uid'];
660 660
         }
661 661
 
@@ -663,12 +663,12 @@  discard block
 block discarded – undo
663 663
             '*',
664 664
             'tx_crawler_configuration',
665 665
             'pid IN ('.implode(',', $pids).') '.
666
-            \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_crawler_configuration') .
666
+            \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_crawler_configuration').
667 667
             \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_crawler_configuration').' '.
668 668
             \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('tx_crawler_configuration').' '
669 669
         );
670 670
 
671
-        while($row = $this->db->sql_fetch_assoc($res)) {
671
+        while ($row = $this->db->sql_fetch_assoc($res)) {
672 672
             $configurationsForBranch[] = $row['name'];
673 673
         }
674 674
         $this->db->sql_free_result($res);
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
         if (empty($accessList)) {
691 691
             return true;
692 692
         }
693
-        foreach(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $groupList) as $groupUid) {
693
+        foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $groupList) as $groupUid) {
694 694
             if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($accessList, $groupUid)) {
695 695
                 return true;
696 696
             }
@@ -709,9 +709,9 @@  discard block
 block discarded – undo
709 709
         $paramKeyValues = array();
710 710
         $GETparams = explode('&', $inputQuery);
711 711
 
712
-        foreach($GETparams as $paramAndValue)    {
713
-            list($p,$v) = explode('=', $paramAndValue, 2);
714
-            if (strlen($p))        {
712
+        foreach ($GETparams as $paramAndValue) {
713
+            list($p, $v) = explode('=', $paramAndValue, 2);
714
+            if (strlen($p)) {
715 715
                 $paramKeyValues[rawurldecode($p)] = rawurldecode($v);
716 716
             }
717 717
         }
@@ -734,84 +734,84 @@  discard block
 block discarded – undo
734 734
      * @param    integer        Current page ID
735 735
      * @return    array        Array with key (GET var name) with the value being an array of all possible values for that key.
736 736
      */
737
-    protected function expandParameters($paramArray, $pid)    {
737
+    protected function expandParameters($paramArray, $pid) {
738 738
         global $TCA;
739 739
 
740 740
             // Traverse parameter names:
741
-        foreach($paramArray as $p => $v)    {
741
+        foreach ($paramArray as $p => $v) {
742 742
             $v = trim($v);
743 743
 
744 744
                 // If value is encapsulated in square brackets it means there are some ranges of values to find, otherwise the value is literal
745
-            if (substr($v,0,1)==='[' && substr($v,-1)===']')    {
745
+            if (substr($v, 0, 1) === '[' && substr($v, -1) === ']') {
746 746
                     // So, find the value inside brackets and reset the paramArray value as an array.
747
-                $v = substr($v,1,-1);
747
+                $v = substr($v, 1, -1);
748 748
                 $paramArray[$p] = array();
749 749
 
750 750
                     // Explode parts and traverse them:
751
-                $parts = explode('|',$v);
752
-                foreach($parts as $pV)    {
751
+                $parts = explode('|', $v);
752
+                foreach ($parts as $pV) {
753 753
 
754 754
                         // Look for integer range: (fx. 1-34 or -40--30 // reads minus 40 to minus 30)
755
-                    if (preg_match('/^(-?[0-9]+)\s*-\s*(-?[0-9]+)$/',trim($pV),$reg))    {    // Integer range:
755
+                    if (preg_match('/^(-?[0-9]+)\s*-\s*(-?[0-9]+)$/', trim($pV), $reg)) {    // Integer range:
756 756
 
757 757
                             // Swap if first is larger than last:
758
-                        if ($reg[1] > $reg[2])    {
758
+                        if ($reg[1] > $reg[2]) {
759 759
                             $temp = $reg[2];
760 760
                             $reg[2] = $reg[1];
761 761
                             $reg[1] = $temp;
762 762
                         }
763 763
 
764 764
                             // Traverse range, add values:
765
-                        $runAwayBrake = 1000;    // Limit to size of range!
766
-                        for($a=$reg[1]; $a<=$reg[2];$a++)    {
765
+                        $runAwayBrake = 1000; // Limit to size of range!
766
+                        for ($a = $reg[1]; $a <= $reg[2]; $a++) {
767 767
                             $paramArray[$p][] = $a;
768 768
                             $runAwayBrake--;
769
-                            if ($runAwayBrake<=0)    {
769
+                            if ($runAwayBrake <= 0) {
770 770
                                 break;
771 771
                             }
772 772
                         }
773
-                    } elseif (substr(trim($pV),0,7)=='_TABLE:')    {
773
+                    } elseif (substr(trim($pV), 0, 7) == '_TABLE:') {
774 774
 
775 775
                             // Parse parameters:
776
-                        $subparts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(';',$pV);
776
+                        $subparts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(';', $pV);
777 777
                         $subpartParams = array();
778
-                        foreach($subparts as $spV)    {
779
-                            list($pKey,$pVal) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':',$spV);
778
+                        foreach ($subparts as $spV) {
779
+                            list($pKey, $pVal) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $spV);
780 780
                             $subpartParams[$pKey] = $pVal;
781 781
                         }
782 782
 
783 783
                             // Table exists:
784
-                        if (isset($TCA[$subpartParams['_TABLE']]))    {
784
+                        if (isset($TCA[$subpartParams['_TABLE']])) {
785 785
                             $lookUpPid = isset($subpartParams['_PID']) ? intval($subpartParams['_PID']) : $pid;
786 786
                             $pidField = isset($subpartParams['_PIDFIELD']) ? trim($subpartParams['_PIDFIELD']) : 'pid';
787 787
                             $where = isset($subpartParams['_WHERE']) ? $subpartParams['_WHERE'] : '';
788 788
                             $addTable = isset($subpartParams['_ADDTABLE']) ? $subpartParams['_ADDTABLE'] : '';
789 789
 
790 790
                             $fieldName = $subpartParams['_FIELD'] ? $subpartParams['_FIELD'] : 'uid';
791
-                            if ($fieldName==='uid' || $TCA[$subpartParams['_TABLE']]['columns'][$fieldName]) {
791
+                            if ($fieldName === 'uid' || $TCA[$subpartParams['_TABLE']]['columns'][$fieldName]) {
792 792
 
793 793
                                 $andWhereLanguage = '';
794 794
                                 $transOrigPointerField = $TCA[$subpartParams['_TABLE']]['ctrl']['transOrigPointerField'];
795 795
 
796 796
                                 if ($subpartParams['_ENABLELANG'] && $transOrigPointerField) {
797
-                                    $andWhereLanguage = ' AND ' . $this->db->quoteStr($transOrigPointerField, $subpartParams['_TABLE']) .' <= 0 ';
797
+                                    $andWhereLanguage = ' AND '.$this->db->quoteStr($transOrigPointerField, $subpartParams['_TABLE']).' <= 0 ';
798 798
                                 }
799 799
 
800
-                                $where = $this->db->quoteStr($pidField, $subpartParams['_TABLE']) .'='.intval($lookUpPid) . ' ' .
801
-                                    $andWhereLanguage . $where;
800
+                                $where = $this->db->quoteStr($pidField, $subpartParams['_TABLE']).'='.intval($lookUpPid).' '.
801
+                                    $andWhereLanguage.$where;
802 802
 
803 803
                                 $rows = $this->db->exec_SELECTgetRows(
804 804
                                     $fieldName,
805
-                                    $subpartParams['_TABLE'] . $addTable,
806
-                                    $where . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($subpartParams['_TABLE']),
805
+                                    $subpartParams['_TABLE'].$addTable,
806
+                                    $where.\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($subpartParams['_TABLE']),
807 807
                                     '',
808 808
                                     '',
809 809
                                     '',
810 810
                                     $fieldName
811 811
                                 );
812 812
 
813
-                                if (is_array($rows))    {
814
-                                    $paramArray[$p] = array_merge($paramArray[$p],array_keys($rows));
813
+                                if (is_array($rows)) {
814
+                                    $paramArray[$p] = array_merge($paramArray[$p], array_keys($rows));
815 815
                                 }
816 816
                             }
817 817
                         }
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
                             'currentValue' => $pV,
828 828
                             'pid' => $pid
829 829
                         );
830
-                        foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/class.tx_crawler_lib.php']['expandParameters'] as $key => $_funcRef)    {
830
+                        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/class.tx_crawler_lib.php']['expandParameters'] as $key => $_funcRef) {
831 831
                             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this);
832 832
                         }
833 833
                     }
@@ -863,11 +863,11 @@  discard block
 block discarded – undo
863 863
 
864 864
                 // Traverse value set:
865 865
             $newUrls = array();
866
-            foreach($urls as $url) {
867
-                foreach($valueSet as $val) {
868
-                    $newUrls[] = $url.(strcmp($val,'') ? '&'.rawurlencode($varName).'='.rawurlencode($val) : '');
866
+            foreach ($urls as $url) {
867
+                foreach ($valueSet as $val) {
868
+                    $newUrls[] = $url.(strcmp($val, '') ? '&'.rawurlencode($varName).'='.rawurlencode($val) : '');
869 869
 
870
-                    if (count($newUrls) >  \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['maxCompileUrls'], 1, 1000000000, 10000)) {
870
+                    if (count($newUrls) > \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['maxCompileUrls'], 1, 1000000000, 10000)) {
871 871
                         break;
872 872
                     }
873 873
                 }
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
      */
898 898
     public function getLogEntriesForPageId($id, $filter = '', $doFlush = FALSE, $doFullFlush = FALSE, $itemsPerPage = 10) {
899 899
         // FIXME: Write Unit tests for Filters
900
-        switch($filter) {
900
+        switch ($filter) {
901 901
             case 'pending':
902 902
                 $addWhere = ' AND exec_time=0';
903 903
                 break;
@@ -911,13 +911,13 @@  discard block
 block discarded – undo
911 911
 
912 912
         // FIXME: Write unit test that ensures that the right records are deleted.
913 913
         if ($doFlush) {
914
-            $this->flushQueue( ($doFullFlush?'1=1':('page_id='.intval($id))) .$addWhere);
914
+            $this->flushQueue(($doFullFlush ? '1=1' : ('page_id='.intval($id))).$addWhere);
915 915
             return array();
916 916
         } else {
917 917
             return $this->db->exec_SELECTgetRows('*',
918 918
                 'tx_crawler_queue',
919
-                'page_id=' . intval($id) . $addWhere, '', 'scheduled DESC',
920
-                (intval($itemsPerPage)>0 ? intval($itemsPerPage) : ''));
919
+                'page_id='.intval($id).$addWhere, '', 'scheduled DESC',
920
+                (intval($itemsPerPage) > 0 ? intval($itemsPerPage) : ''));
921 921
         }
922 922
     }
923 923
 
@@ -930,9 +930,9 @@  discard block
 block discarded – undo
930 930
      * @param    integer        Limit the amount of entires per page default is 10
931 931
      * @return    array
932 932
      */
933
-    public function getLogEntriesForSetId($set_id,$filter='',$doFlush=FALSE, $doFullFlush=FALSE, $itemsPerPage=10)    {
933
+    public function getLogEntriesForSetId($set_id, $filter = '', $doFlush = FALSE, $doFullFlush = FALSE, $itemsPerPage = 10) {
934 934
         // FIXME: Write Unit tests for Filters
935
-        switch($filter)    {
935
+        switch ($filter) {
936 936
             case 'pending':
937 937
                 $addWhere = ' AND exec_time=0';
938 938
                 break;
@@ -944,14 +944,14 @@  discard block
 block discarded – undo
944 944
                 break;
945 945
         }
946 946
         // FIXME: Write unit test that ensures that the right records are deleted.
947
-        if ($doFlush)    {
948
-            $this->flushQueue($doFullFlush?'':('set_id='.intval($set_id).$addWhere));
947
+        if ($doFlush) {
948
+            $this->flushQueue($doFullFlush ? '' : ('set_id='.intval($set_id).$addWhere));
949 949
             return array();
950 950
         } else {
951 951
             return $this->db->exec_SELECTgetRows('*',
952 952
                 'tx_crawler_queue',
953
-                'set_id='.intval($set_id).$addWhere,'','scheduled DESC',
954
-                (intval($itemsPerPage)>0 ? intval($itemsPerPage) : ''));
953
+                'set_id='.intval($set_id).$addWhere, '', 'scheduled DESC',
954
+                (intval($itemsPerPage) > 0 ? intval($itemsPerPage) : ''));
955 955
         }
956 956
     }
957 957
 
@@ -961,14 +961,14 @@  discard block
 block discarded – undo
961 961
      * @param $where    SQL related filter for the entries which should be removed
962 962
      * @return void
963 963
      */
964
-    protected function flushQueue($where='') {
964
+    protected function flushQueue($where = '') {
965 965
 
966
-        $realWhere = strlen($where)>0?$where:'1=1';
966
+        $realWhere = strlen($where) > 0 ? $where : '1=1';
967 967
 
968
-        if(tx_crawler_domain_events_dispatcher::getInstance()->hasObserver('queueEntryFlush')) {
969
-            $groups = $this->db->exec_SELECTgetRows('DISTINCT set_id','tx_crawler_queue',$realWhere);
970
-            foreach($groups as $group) {
971
-                tx_crawler_domain_events_dispatcher::getInstance()->post('queueEntryFlush',$group['set_id'], $this->db->exec_SELECTgetRows('uid, set_id','tx_crawler_queue',$realWhere.' AND set_id="'.$group['set_id'].'"'));
968
+        if (tx_crawler_domain_events_dispatcher::getInstance()->hasObserver('queueEntryFlush')) {
969
+            $groups = $this->db->exec_SELECTgetRows('DISTINCT set_id', 'tx_crawler_queue', $realWhere);
970
+            foreach ($groups as $group) {
971
+                tx_crawler_domain_events_dispatcher::getInstance()->post('queueEntryFlush', $group['set_id'], $this->db->exec_SELECTgetRows('uid, set_id', 'tx_crawler_queue', $realWhere.' AND set_id="'.$group['set_id'].'"'));
972 972
             }
973 973
         }
974 974
 
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
      * @param    integer        Time at which to activate
986 986
      * @return    void
987 987
      */
988
-    public function addQueueEntry_callBack($setId,$params,$callBack,$page_id=0,$schedule=0) {
988
+    public function addQueueEntry_callBack($setId, $params, $callBack, $page_id = 0, $schedule = 0) {
989 989
 
990 990
         if (!is_array($params))    $params = array();
991 991
         $params['_CALLBACKOBJ'] = $callBack;
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
             'result_data' => '',
1001 1001
         );
1002 1002
 
1003
-        $this->db->exec_INSERTquery('tx_crawler_queue',$fieldArray);
1003
+        $this->db->exec_INSERTquery('tx_crawler_queue', $fieldArray);
1004 1004
     }
1005 1005
 
1006 1006
     /************************************
@@ -1020,13 +1020,13 @@  discard block
 block discarded – undo
1020 1020
      * @param     bool        (optional) skip inner duplication check
1021 1021
      * @return    bool        true if the url was added, false if it already existed
1022 1022
      */
1023
-    protected function addUrl (
1023
+    protected function addUrl(
1024 1024
         $id,
1025 1025
         $url,
1026 1026
         array $subCfg,
1027 1027
         $tstamp,
1028
-        $configurationHash='',
1029
-        $skipInnerDuplicationCheck=false
1028
+        $configurationHash = '',
1029
+        $skipInnerDuplicationCheck = false
1030 1030
     ) {
1031 1031
 
1032 1032
         $urlAdded = false;
@@ -1037,14 +1037,14 @@  discard block
 block discarded – undo
1037 1037
         );
1038 1038
 
1039 1039
             // fe user group simulation:
1040
-        $uGs = implode(',',array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',',$subCfg['userGroups'],1)));
1041
-        if ($uGs)    {
1040
+        $uGs = implode(',', array_unique(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $subCfg['userGroups'], 1)));
1041
+        if ($uGs) {
1042 1042
             $parameters['feUserGroupList'] = $uGs;
1043 1043
         }
1044 1044
 
1045 1045
             // Setting processing instructions
1046
-        $parameters['procInstructions'] = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',',$subCfg['procInstrFilter']);
1047
-        if (is_array($subCfg['procInstrParams.']))    {
1046
+        $parameters['procInstructions'] = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $subCfg['procInstrFilter']);
1047
+        if (is_array($subCfg['procInstrParams.'])) {
1048 1048
             $parameters['procInstrParams'] = $subCfg['procInstrParams.'];
1049 1049
         }
1050 1050
 
@@ -1063,14 +1063,14 @@  discard block
 block discarded – undo
1063 1063
             'configuration' => $subCfg['key'],
1064 1064
         );
1065 1065
 
1066
-        if ($this->registerQueueEntriesInternallyOnly)    {
1066
+        if ($this->registerQueueEntriesInternallyOnly) {
1067 1067
                 //the entries will only be registered and not stored to the database
1068 1068
             $this->queueEntries[] = $fieldArray;
1069 1069
         } else {
1070 1070
 
1071
-            if(!$skipInnerDuplicationCheck){
1071
+            if (!$skipInnerDuplicationCheck) {
1072 1072
                     // check if there is already an equal entry
1073
-                $rows = $this->getDuplicateRowsIfExist($tstamp,$fieldArray);
1073
+                $rows = $this->getDuplicateRowsIfExist($tstamp, $fieldArray);
1074 1074
             }
1075 1075
 
1076 1076
             if (count($rows) == 0) {
@@ -1078,9 +1078,9 @@  discard block
 block discarded – undo
1078 1078
                 $uid = $this->db->sql_insert_id();
1079 1079
                 $rows[] = $uid;
1080 1080
                 $urlAdded = true;
1081
-                tx_crawler_domain_events_dispatcher::getInstance()->post('urlAddedToQueue',$this->setID,array('uid' => $uid, 'fieldArray' => $fieldArray));
1082
-            }else{
1083
-                tx_crawler_domain_events_dispatcher::getInstance()->post('duplicateUrlInQueue',$this->setID,array('rows' => $rows, 'fieldArray' => $fieldArray));
1081
+                tx_crawler_domain_events_dispatcher::getInstance()->post('urlAddedToQueue', $this->setID, array('uid' => $uid, 'fieldArray' => $fieldArray));
1082
+            } else {
1083
+                tx_crawler_domain_events_dispatcher::getInstance()->post('duplicateUrlInQueue', $this->setID, array('rows' => $rows, 'fieldArray' => $fieldArray));
1084 1084
             }
1085 1085
         }
1086 1086
 
@@ -1097,34 +1097,34 @@  discard block
 block discarded – undo
1097 1097
      *
1098 1098
      * @return array;
1099 1099
      */
1100
-    protected function getDuplicateRowsIfExist($tstamp,$fieldArray){
1100
+    protected function getDuplicateRowsIfExist($tstamp, $fieldArray) {
1101 1101
         $rows = array();
1102 1102
 
1103 1103
         $currentTime = $this->getCurrentTime();
1104 1104
 
1105 1105
             //if this entry is scheduled with "now"
1106 1106
         if ($tstamp <= $currentTime) {
1107
-            if($this->extensionSettings['enableTimeslot']){
1107
+            if ($this->extensionSettings['enableTimeslot']) {
1108 1108
                 $timeBegin     = $currentTime - 100;
1109
-                $timeEnd     = $currentTime + 100;
1110
-                $where         = ' ((scheduled BETWEEN '.$timeBegin.' AND '.$timeEnd.' ) OR scheduled <= '. $currentTime.') ';
1111
-            }else{
1112
-                $where = 'scheduled <= ' . $currentTime;
1109
+                $timeEnd = $currentTime + 100;
1110
+                $where         = ' ((scheduled BETWEEN '.$timeBegin.' AND '.$timeEnd.' ) OR scheduled <= '.$currentTime.') ';
1111
+            } else {
1112
+                $where = 'scheduled <= '.$currentTime;
1113 1113
             }
1114 1114
         } elseif ($tstamp > $currentTime) {
1115 1115
                 //entry with a timestamp in the future need to have the same schedule time
1116
-            $where = 'scheduled = ' . $tstamp ;
1116
+            $where = 'scheduled = '.$tstamp;
1117 1117
         }
1118 1118
 
1119
-        if(!empty($where)){
1119
+        if (!empty($where)) {
1120 1120
             $result = $this->db->exec_SELECTgetRows(
1121 1121
                 'qid',
1122 1122
                 'tx_crawler_queue',
1123 1123
                 $where.
1124
-                ' AND NOT exec_time' .
1124
+                ' AND NOT exec_time'.
1125 1125
                 ' AND NOT process_id '.
1126 1126
                 ' AND page_id='.intval($fieldArray['page_id']).
1127
-                ' AND parameters_hash = ' . $this->db->fullQuoteStr($fieldArray['parameters_hash'], 'tx_crawler_queue')
1127
+                ' AND parameters_hash = '.$this->db->fullQuoteStr($fieldArray['parameters_hash'], 'tx_crawler_queue')
1128 1128
             );
1129 1129
 
1130 1130
             if (is_array($result)) {
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
      *
1146 1146
      * @codeCoverageIgnore
1147 1147
      */
1148
-    public function getCurrentTime(){
1148
+    public function getCurrentTime() {
1149 1149
         return time();
1150 1150
     }
1151 1151
 
@@ -1166,18 +1166,18 @@  discard block
 block discarded – undo
1166 1166
     public function readUrl($queueId, $force = FALSE) {
1167 1167
         $ret = 0;
1168 1168
         if ($this->debugMode) {
1169
-            \TYPO3\CMS\Core\Utility\GeneralUtility::devlog('crawler-readurl start ' . microtime(true), __FUNCTION__);
1169
+            \TYPO3\CMS\Core\Utility\GeneralUtility::devlog('crawler-readurl start '.microtime(true), __FUNCTION__);
1170 1170
         }
1171 1171
         // Get entry:
1172 1172
         list($queueRec) = $this->db->exec_SELECTgetRows('*', 'tx_crawler_queue',
1173
-            'qid=' . intval($queueId) . ($force ? '' : ' AND exec_time=0 AND process_scheduled > 0'));
1173
+            'qid='.intval($queueId).($force ? '' : ' AND exec_time=0 AND process_scheduled > 0'));
1174 1174
 
1175 1175
         if (!is_array($queueRec)) {
1176 1176
             return;
1177 1177
         }
1178 1178
 
1179
-        $pageUidRootTypoScript = \AOE\Crawler\Utility\TypoScriptUtility::getPageUidForTypoScriptRootTemplateInRootLine((int)$queueRec['page_id']);
1180
-        $this->initTSFE((int)$pageUidRootTypoScript);
1179
+        $pageUidRootTypoScript = \AOE\Crawler\Utility\TypoScriptUtility::getPageUidForTypoScriptRootTemplateInRootLine((int) $queueRec['page_id']);
1180
+        $this->initTSFE((int) $pageUidRootTypoScript);
1181 1181
 
1182 1182
         \AOE\Crawler\Utility\SignalSlotUtility::emitSignal(
1183 1183
             __CLASS__,
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
             //if mulitprocessing is used we need to store the id of the process which has handled this entry
1193 1193
             $field_array['process_id_completed'] = $this->processID;
1194 1194
         }
1195
-        $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid=' . intval($queueId), $field_array);
1195
+        $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid='.intval($queueId), $field_array);
1196 1196
 
1197 1197
         $result = $this->readUrl_exec($queueRec);
1198 1198
         $resultData = unserialize($result['content']);
@@ -1221,11 +1221,11 @@  discard block
 block discarded – undo
1221 1221
             array($queueId, &$field_array)
1222 1222
         );
1223 1223
 
1224
-        $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid=' . intval($queueId), $field_array);
1224
+        $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid='.intval($queueId), $field_array);
1225 1225
 
1226 1226
 
1227 1227
         if ($this->debugMode) {
1228
-            \TYPO3\CMS\Core\Utility\GeneralUtility::devlog('crawler-readurl stop ' . microtime(true), __FUNCTION__);
1228
+            \TYPO3\CMS\Core\Utility\GeneralUtility::devlog('crawler-readurl stop '.microtime(true), __FUNCTION__);
1229 1229
         }
1230 1230
 
1231 1231
         return $ret;
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
      *
1239 1239
      * @return string
1240 1240
      */
1241
-    protected function readUrlFromArray($field_array)    {
1241
+    protected function readUrlFromArray($field_array) {
1242 1242
 
1243 1243
             // Set exec_time to lock record:
1244 1244
         $field_array['exec_time'] = $this->getCurrentTime();
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
 
1250 1250
         // Set result in log which also denotes the end of the processing of this entry.
1251 1251
         $field_array = array('result_data' => serialize($result));
1252
-        $this->db->exec_UPDATEquery('tx_crawler_queue','qid='.intval($queueId), $field_array);
1252
+        $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid='.intval($queueId), $field_array);
1253 1253
 
1254 1254
         return $result;
1255 1255
     }
@@ -1260,17 +1260,17 @@  discard block
 block discarded – undo
1260 1260
      * @param array $queueRec Queue record
1261 1261
      * @return string Result output.
1262 1262
      */
1263
-    protected function readUrl_exec($queueRec)    {
1263
+    protected function readUrl_exec($queueRec) {
1264 1264
             // Decode parameters:
1265 1265
         $parameters = unserialize($queueRec['parameters']);
1266 1266
         $result = 'ERROR';
1267
-        if (is_array($parameters))    {
1268
-            if ($parameters['_CALLBACKOBJ'])    {    // Calling object:
1267
+        if (is_array($parameters)) {
1268
+            if ($parameters['_CALLBACKOBJ']) {    // Calling object:
1269 1269
                 $objRef = $parameters['_CALLBACKOBJ'];
1270 1270
                 $callBackObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
1271
-                if (is_object($callBackObj))    {
1271
+                if (is_object($callBackObj)) {
1272 1272
                     unset($parameters['_CALLBACKOBJ']);
1273
-                    $result = array('content' => serialize($callBackObj->crawler_execute($parameters,$this)));
1273
+                    $result = array('content' => serialize($callBackObj->crawler_execute($parameters, $this)));
1274 1274
                 } else {
1275 1275
                     $result = array('content' => 'No object: '.$objRef);
1276 1276
                 }
@@ -1280,9 +1280,9 @@  discard block
 block discarded – undo
1280 1280
                 $crawlerId = $queueRec['qid'].':'.md5($queueRec['qid'].'|'.$queueRec['set_id'].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']);
1281 1281
 
1282 1282
                     // Get result:
1283
-                $result = $this->requestUrl($parameters['url'],$crawlerId);
1283
+                $result = $this->requestUrl($parameters['url'], $crawlerId);
1284 1284
 
1285
-                tx_crawler_domain_events_dispatcher::getInstance()->post('urlCrawled',$queueRec['set_id'],array('url' => $parameters['url'], 'result' => $result));
1285
+                tx_crawler_domain_events_dispatcher::getInstance()->post('urlCrawled', $queueRec['set_id'], array('url' => $parameters['url'], 'result' => $result));
1286 1286
             }
1287 1287
         }
1288 1288
 
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
      * @param  integer  $recursion      Recursion limiter for 302 redirects
1300 1300
      * @return array                    Array with content
1301 1301
      */
1302
-    public function requestUrl($originalUrl, $crawlerId, $timeout=2, $recursion=10) {
1302
+    public function requestUrl($originalUrl, $crawlerId, $timeout = 2, $recursion = 10) {
1303 1303
 
1304 1304
         if (!$recursion) return false;
1305 1305
 
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
             return FALSE;
1312 1312
         }
1313 1313
 
1314
-        if (!in_array($url['scheme'], array('','http','https'))) {
1314
+        if (!in_array($url['scheme'], array('', 'http', 'https'))) {
1315 1315
             if (TYPO3_DLOG) \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Scheme does not match for url "%s"', $url), 'crawler', 4, array('crawlerId' => $crawlerId));
1316 1316
             return FALSE;
1317 1317
         }
@@ -1329,14 +1329,14 @@  discard block
 block discarded – undo
1329 1329
 
1330 1330
         if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse'] && $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']) {
1331 1331
             $rurl = parse_url($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']);
1332
-            $url['path'] = $url['scheme'] . '://' . $url['host'] . ($url['port'] > 0 ? ':' . $url['port'] : '') . $url['path'];
1332
+            $url['path'] = $url['scheme'].'://'.$url['host'].($url['port'] > 0 ? ':'.$url['port'] : '').$url['path'];
1333 1333
             $reqHeaders = $this->buildRequestHeaderArray($url, $crawlerId);
1334 1334
         }
1335 1335
 
1336 1336
         $host = $rurl['host'];
1337 1337
 
1338 1338
         if ($url['scheme'] == 'https') {
1339
-            $host = 'ssl://' . $host;
1339
+            $host = 'ssl://'.$host;
1340 1340
             $port = ($rurl['port'] > 0) ? $rurl['port'] : 443;
1341 1341
         } else {
1342 1342
             $port = ($rurl['port'] > 0) ? $rurl['port'] : 80;
@@ -1350,24 +1350,24 @@  discard block
 block discarded – undo
1350 1350
             return FALSE;
1351 1351
         } else {
1352 1352
                 // Request message:
1353
-            $msg = implode("\r\n",$reqHeaders)."\r\n\r\n";
1354
-            fputs ($fp, $msg);
1353
+            $msg = implode("\r\n", $reqHeaders)."\r\n\r\n";
1354
+            fputs($fp, $msg);
1355 1355
 
1356 1356
                 // Read response:
1357 1357
             $d = $this->getHttpResponseFromStream($fp);
1358
-            fclose ($fp);
1358
+            fclose($fp);
1359 1359
 
1360 1360
             $time = microtime(true) - $startTime;
1361
-            $this->log($originalUrl .' '.$time);
1361
+            $this->log($originalUrl.' '.$time);
1362 1362
 
1363 1363
                 // Implode content and headers:
1364 1364
             $result = array(
1365 1365
                 'request' => $msg,
1366 1366
                 'headers' => implode('', $d['headers']),
1367
-                'content' => implode('', (array)$d['content'])
1367
+                'content' => implode('', (array) $d['content'])
1368 1368
             );
1369 1369
 
1370
-            if (($this->extensionSettings['follow30x']) && ($newUrl = $this->getRequestUrlFrom302Header($d['headers'],$url['user'],$url['pass']))) {
1370
+            if (($this->extensionSettings['follow30x']) && ($newUrl = $this->getRequestUrlFrom302Header($d['headers'], $url['user'], $url['pass']))) {
1371 1371
                 $result = array_merge(array('parentRequest'=>$result), $this->requestUrl($newUrl, $crawlerId, $recursion--));
1372 1372
                 $newRequestUrl = $this->requestUrl($newUrl, $crawlerId, $timeout, --$recursion);
1373 1373
 
@@ -1406,8 +1406,8 @@  discard block
 block discarded – undo
1406 1406
 
1407 1407
         // Base path must be '/<pathSegements>/':
1408 1408
         if ($frontendBasePath != '/') {
1409
-            $frontendBasePath = '/' . ltrim($frontendBasePath, '/');
1410
-            $frontendBasePath = rtrim($frontendBasePath, '/') . '/';
1409
+            $frontendBasePath = '/'.ltrim($frontendBasePath, '/');
1410
+            $frontendBasePath = rtrim($frontendBasePath, '/').'/';
1411 1411
         }
1412 1412
 
1413 1413
         return $frontendBasePath;
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 
1441 1441
         if (is_resource($streamPointer)) {
1442 1442
                 // read headers
1443
-            while($line = fgets($streamPointer, '2048')) {
1443
+            while ($line = fgets($streamPointer, '2048')) {
1444 1444
                 $line = trim($line);
1445 1445
                 if ($line !== '') {
1446 1446
                     $response['headers'][] = $line;
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
             }
1451 1451
 
1452 1452
                 // read content
1453
-            while($line = fgets($streamPointer, '2048')) {
1453
+            while ($line = fgets($streamPointer, '2048')) {
1454 1454
                 $response['content'][] = $line;
1455 1455
             }
1456 1456
         }
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
      */
1464 1464
     protected function log($message) {
1465 1465
         if (!empty($this->extensionSettings['logFileName'])) {
1466
-            @file_put_contents($this->extensionSettings['logFileName'], date('Ymd His') . $message . "\n", FILE_APPEND);
1466
+            @file_put_contents($this->extensionSettings['logFileName'], date('Ymd His').$message."\n", FILE_APPEND);
1467 1467
         }
1468 1468
     }
1469 1469
 
@@ -1479,12 +1479,12 @@  discard block
 block discarded – undo
1479 1479
         $reqHeaders = array();
1480 1480
         $reqHeaders[] = 'GET '.$url['path'].($url['query'] ? '?'.$url['query'] : '').' HTTP/1.0';
1481 1481
         $reqHeaders[] = 'Host: '.$url['host'];
1482
-        if (stristr($url['query'],'ADMCMD_previewWS')) {
1482
+        if (stristr($url['query'], 'ADMCMD_previewWS')) {
1483 1483
             $reqHeaders[] = 'Cookie: $Version="1"; be_typo_user="1"; $Path=/';
1484 1484
         }
1485 1485
         $reqHeaders[] = 'Connection: close';
1486
-        if ($url['user']!='') {
1487
-            $reqHeaders[] = 'Authorization: Basic '. base64_encode($url['user'].':'.$url['pass']);
1486
+        if ($url['user'] != '') {
1487
+            $reqHeaders[] = 'Authorization: Basic '.base64_encode($url['user'].':'.$url['pass']);
1488 1488
         }
1489 1489
         $reqHeaders[] = 'X-T3crawler: '.$crawlerId;
1490 1490
         $reqHeaders[] = 'User-Agent: TYPO3 crawler';
@@ -1499,21 +1499,21 @@  discard block
 block discarded – undo
1499 1499
      * @param    string        HTTP Auth. Password
1500 1500
      * @return    string        URL from redirection
1501 1501
      */
1502
-    protected function getRequestUrlFrom302Header($headers,$user='',$pass='') {
1503
-        if(!is_array($headers)) return false;
1504
-        if(!(stristr($headers[0],'301 Moved') || stristr($headers[0],'302 Found') || stristr($headers[0],'302 Moved'))) return false;
1502
+    protected function getRequestUrlFrom302Header($headers, $user = '', $pass = '') {
1503
+        if (!is_array($headers)) return false;
1504
+        if (!(stristr($headers[0], '301 Moved') || stristr($headers[0], '302 Found') || stristr($headers[0], '302 Moved'))) return false;
1505 1505
 
1506
-        foreach($headers as $hl) {
1507
-            $tmp = explode(": ",$hl);
1506
+        foreach ($headers as $hl) {
1507
+            $tmp = explode(": ", $hl);
1508 1508
             $header[trim($tmp[0])] = trim($tmp[1]);
1509
-            if(trim($tmp[0])=='Location') break;
1509
+            if (trim($tmp[0]) == 'Location') break;
1510 1510
         }
1511
-        if(!array_key_exists('Location',$header)) return false;
1511
+        if (!array_key_exists('Location', $header)) return false;
1512 1512
 
1513
-        if($user!='') {
1514
-            if(!($tmp = parse_url($header['Location']))) return false;
1515
-            $newUrl = $tmp['scheme'] . '://' . $user . ':' . $pass . '@' . $tmp['host'] . $tmp['path'];
1516
-            if($tmp['query']!='') $newUrl .= '?' . $tmp['query'];
1513
+        if ($user != '') {
1514
+            if (!($tmp = parse_url($header['Location']))) return false;
1515
+            $newUrl = $tmp['scheme'].'://'.$user.':'.$pass.'@'.$tmp['host'].$tmp['path'];
1516
+            if ($tmp['query'] != '') $newUrl .= '?'.$tmp['query'];
1517 1517
         } else {
1518 1518
             $newUrl = $header['Location'];
1519 1519
         }
@@ -1534,15 +1534,15 @@  discard block
 block discarded – undo
1534 1534
      * @param    object        TSFE object (reference under PHP5)
1535 1535
      * @return    void
1536 1536
      */
1537
-    function fe_init(&$params, $ref)    {
1537
+    function fe_init(&$params, $ref) {
1538 1538
 
1539 1539
             // Authenticate crawler request:
1540
-        if (isset($_SERVER['HTTP_X_T3CRAWLER']))    {
1541
-            list($queueId,$hash) = explode(':', $_SERVER['HTTP_X_T3CRAWLER']);
1542
-            list($queueRec) = $this->db->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval($queueId));
1540
+        if (isset($_SERVER['HTTP_X_T3CRAWLER'])) {
1541
+            list($queueId, $hash) = explode(':', $_SERVER['HTTP_X_T3CRAWLER']);
1542
+            list($queueRec) = $this->db->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid='.intval($queueId));
1543 1543
 
1544 1544
                 // If a crawler record was found and hash was matching, set it up:
1545
-            if (is_array($queueRec) && $hash === md5($queueRec['qid'].'|'.$queueRec['set_id'].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']))    {
1545
+            if (is_array($queueRec) && $hash === md5($queueRec['qid'].'|'.$queueRec['set_id'].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
1546 1546
                 $params['pObj']->applicationData['tx_crawler']['running'] = TRUE;
1547 1547
                 $params['pObj']->applicationData['tx_crawler']['parameters'] = unserialize($queueRec['parameters']);
1548 1548
                 $params['pObj']->applicationData['tx_crawler']['log'] = array();
@@ -1600,7 +1600,7 @@  discard block
 block discarded – undo
1600 1600
             /* @var $tree \TYPO3\CMS\Backend\Tree\View\PageTreeView */
1601 1601
         $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
1602 1602
         $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
1603
-        $tree->init('AND ' . $perms_clause);
1603
+        $tree->init('AND '.$perms_clause);
1604 1604
 
1605 1605
         $pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($id, $perms_clause);
1606 1606
 
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
         );
1612 1612
 
1613 1613
             // Get branch beneath:
1614
-        if ($depth)    {
1614
+        if ($depth) {
1615 1615
             $tree->getTree($id, $depth, '');
1616 1616
         }
1617 1617
 
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
             $this->MP = false;
1624 1624
 
1625 1625
                 // recognize mount points
1626
-            if($data['row']['doktype'] == 7){
1626
+            if ($data['row']['doktype'] == 7) {
1627 1627
                 $mountpage = $this->db->exec_SELECTgetRows('*', 'pages', 'uid = '.$data['row']['uid']);
1628 1628
 
1629 1629
                     // fetch mounted pages
@@ -1633,15 +1633,15 @@  discard block
 block discarded – undo
1633 1633
                 $mountTree->init('AND '.$perms_clause);
1634 1634
                 $mountTree->getTree($mountpage[0]['mount_pid'], $depth, '');
1635 1635
 
1636
-                foreach($mountTree->tree as $mountData)    {
1636
+                foreach ($mountTree->tree as $mountData) {
1637 1637
                     $code .= $this->drawURLs_addRowsForPage(
1638 1638
                         $mountData['row'],
1639
-                        $mountData['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$mountData['row'],TRUE)
1639
+                        $mountData['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $mountData['row'], TRUE)
1640 1640
                     );
1641 1641
                 }
1642 1642
 
1643 1643
                     // replace page when mount_pid_ol is enabled
1644
-                if($mountpage[0]['mount_pid_ol']){
1644
+                if ($mountpage[0]['mount_pid_ol']) {
1645 1645
                     $data['row']['uid'] = $mountpage[0]['mount_pid'];
1646 1646
                 } else {
1647 1647
                         // if the mount_pid_ol is not set the MP must not be used for the mountpoint page
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
 
1652 1652
             $code .= $this->drawURLs_addRowsForPage(
1653 1653
                 $data['row'],
1654
-                $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], TRUE)
1654
+                $data['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], TRUE)
1655 1655
             );
1656 1656
         }
1657 1657
 
@@ -1675,7 +1675,7 @@  discard block
 block discarded – undo
1675 1675
             if (!empty($excludeString)) {
1676 1676
                 /* @var $tree \TYPO3\CMS\Backend\Tree\View\PageTreeView */
1677 1677
                 $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView');
1678
-                $tree->init('AND ' . $this->backendUser->getPagePermsClause(1));
1678
+                $tree->init('AND '.$this->backendUser->getPagePermsClause(1));
1679 1679
 
1680 1680
                 $excludeParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $excludeString);
1681 1681
 
@@ -1684,7 +1684,7 @@  discard block
 block discarded – undo
1684 1684
 
1685 1685
                         // default is "page only" = "depth=0"
1686 1686
                     if (empty($depth)) {
1687
-                        $depth = ( stristr($excludePart,'+')) ? 99 : 0;
1687
+                        $depth = (stristr($excludePart, '+')) ? 99 : 0;
1688 1688
                     }
1689 1689
 
1690 1690
                     $pidList[] = $pid;
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
      * @param    string        Page icon and title for row
1718 1718
      * @return    string        HTML <tr> content (one or more)
1719 1719
      */
1720
-    public function drawURLs_addRowsForPage(array $pageRow, $pageTitleAndIcon)    {
1720
+    public function drawURLs_addRowsForPage(array $pageRow, $pageTitleAndIcon) {
1721 1721
 
1722 1722
         $skipMessage = '';
1723 1723
 
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
         $cc = 0;
1739 1739
         $content = '';
1740 1740
         if (count($configurations)) {
1741
-            foreach($configurations as $confKey => $confArray)    {
1741
+            foreach ($configurations as $confKey => $confArray) {
1742 1742
 
1743 1743
                     // Title column:
1744 1744
                 if (!$c) {
@@ -1767,47 +1767,47 @@  discard block
 block discarded – undo
1767 1767
                     $paramExpanded = '';
1768 1768
                     $calcAccu = array();
1769 1769
                     $calcRes = 1;
1770
-                    foreach($confArray['paramExpanded'] as $gVar => $gVal)    {
1771
-                        $paramExpanded.= '
1770
+                    foreach ($confArray['paramExpanded'] as $gVar => $gVal) {
1771
+                        $paramExpanded .= '
1772 1772
                             <tr>
1773 1773
                                 <td class="bgColor4-20">'.htmlspecialchars('&'.$gVar.'=').'<br/>'.
1774 1774
                                                 '('.count($gVal).')'.
1775 1775
                                                 '</td>
1776
-                                <td class="bgColor4" nowrap="nowrap">'.nl2br(htmlspecialchars(implode(chr(10),$gVal))).'</td>
1776
+                                <td class="bgColor4" nowrap="nowrap">'.nl2br(htmlspecialchars(implode(chr(10), $gVal))).'</td>
1777 1777
                             </tr>
1778 1778
                         ';
1779
-                        $calcRes*= count($gVal);
1779
+                        $calcRes *= count($gVal);
1780 1780
                         $calcAccu[] = count($gVal);
1781 1781
                     }
1782 1782
                     $paramExpanded = '<table class="lrPadding c-list param-expanded">'.$paramExpanded.'</table>';
1783
-                    $paramExpanded.= 'Comb: '.implode('*',$calcAccu).'='.$calcRes;
1783
+                    $paramExpanded .= 'Comb: '.implode('*', $calcAccu).'='.$calcRes;
1784 1784
 
1785 1785
                         // Options
1786 1786
                     $optionValues = '';
1787
-                    if ($confArray['subCfg']['userGroups'])    {
1788
-                        $optionValues.='User Groups: '.$confArray['subCfg']['userGroups'].'<br/>';
1787
+                    if ($confArray['subCfg']['userGroups']) {
1788
+                        $optionValues .= 'User Groups: '.$confArray['subCfg']['userGroups'].'<br/>';
1789 1789
                     }
1790
-                    if ($confArray['subCfg']['baseUrl'])    {
1791
-                        $optionValues.='Base Url: '.$confArray['subCfg']['baseUrl'].'<br/>';
1790
+                    if ($confArray['subCfg']['baseUrl']) {
1791
+                        $optionValues .= 'Base Url: '.$confArray['subCfg']['baseUrl'].'<br/>';
1792 1792
                     }
1793
-                    if ($confArray['subCfg']['procInstrFilter'])    {
1794
-                        $optionValues.='ProcInstr: '.$confArray['subCfg']['procInstrFilter'].'<br/>';
1793
+                    if ($confArray['subCfg']['procInstrFilter']) {
1794
+                        $optionValues .= 'ProcInstr: '.$confArray['subCfg']['procInstrFilter'].'<br/>';
1795 1795
                     }
1796 1796
 
1797 1797
                         // Compile row:
1798 1798
                     $content .= '
1799
-                        <tr class="bgColor' . ($c%2 ? '-20':'-10') . '">
1800
-                            ' . $titleClm . '
1801
-                            <td>' . htmlspecialchars($confKey) . '</td>
1802
-                            <td>' . nl2br(htmlspecialchars(rawurldecode(trim(str_replace('&', chr(10) . '&', \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $confArray['paramParsed'])))))) . '</td>
1799
+                        <tr class="bgColor' . ($c % 2 ? '-20' : '-10').'">
1800
+                            ' . $titleClm.'
1801
+                            <td>' . htmlspecialchars($confKey).'</td>
1802
+                            <td>' . nl2br(htmlspecialchars(rawurldecode(trim(str_replace('&', chr(10).'&', \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $confArray['paramParsed'])))))).'</td>
1803 1803
                             <td>'.$paramExpanded.'</td>
1804
-                            <td nowrap="nowrap">' . $urlList . '</td>
1805
-                            <td nowrap="nowrap">' . $optionValues . '</td>
1806
-                            <td nowrap="nowrap">' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($confArray['subCfg']['procInstrParams.']) . '</td>
1804
+                            <td nowrap="nowrap">' . $urlList.'</td>
1805
+                            <td nowrap="nowrap">' . $optionValues.'</td>
1806
+                            <td nowrap="nowrap">' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($confArray['subCfg']['procInstrParams.']).'</td>
1807 1807
                         </tr>';
1808 1808
                 } else {
1809 1809
 
1810
-                    $content .= '<tr class="bgColor'.($c%2 ? '-20':'-10') . '">
1810
+                    $content .= '<tr class="bgColor'.($c % 2 ? '-20' : '-10').'">
1811 1811
                             '.$titleClm.'
1812 1812
                             <td>'.htmlspecialchars($confKey).'</td>
1813 1813
                             <td colspan="5"><em>No entries</em> (Page is excluded in this configuration)</td>
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
             $message = !empty($skipMessage) ? ' ('.$skipMessage.')' : '';
1823 1823
 
1824 1824
                 // Compile row:
1825
-            $content.= '
1825
+            $content .= '
1826 1826
                 <tr class="bgColor-20" style="border-bottom: 1px solid black;">
1827 1827
                     <td>'.$pageTitleAndIcon.'</td>
1828 1828
                     <td colspan="6"><em>No entries</em>'.$message.'</td>
@@ -1883,7 +1883,7 @@  discard block
 block discarded – undo
1883 1883
                     // Run process:
1884 1884
                 $result = $this->CLI_run($countInARun, $sleepTime, $sleepAfterFinish);
1885 1885
             } catch (Exception $e) {
1886
-                $this->CLI_debug(get_class($e) . ': ' . $e->getMessage());
1886
+                $this->CLI_debug(get_class($e).': '.$e->getMessage());
1887 1887
                 $result = self::CLI_STATUS_ABORTED;
1888 1888
             }
1889 1889
 
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
             $releaseStatus = $this->CLI_releaseProcesses($this->CLI_buildProcessId());
1895 1895
 
1896 1896
             $this->CLI_debug("Unprocessed Items remaining:".$this->getUnprocessedItemsCount()." (".$this->CLI_buildProcessId().")");
1897
-            $result |= ( $this->getUnprocessedItemsCount() > 0 ? self::CLI_STATUS_REMAIN : self::CLI_STATUS_NOTHING_PROCCESSED );
1897
+            $result |= ($this->getUnprocessedItemsCount() > 0 ? self::CLI_STATUS_REMAIN : self::CLI_STATUS_NOTHING_PROCCESSED);
1898 1898
         } else {
1899 1899
             $result |= self::CLI_STATUS_ABORTED;
1900 1900
         }
@@ -1907,7 +1907,7 @@  discard block
 block discarded – undo
1907 1907
      *
1908 1908
      * @return    void
1909 1909
      */
1910
-    function CLI_main_im()    {
1910
+    function CLI_main_im() {
1911 1911
         $this->setAccessMode('cli_im');
1912 1912
 
1913 1913
         $cliObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_cli_im');
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
         $this->backendUser->setWorkspace(0);
1918 1918
 
1919 1919
             // Print help
1920
-        if (!isset($cliObj->cli_args['_DEFAULT'][1]))    {
1920
+        if (!isset($cliObj->cli_args['_DEFAULT'][1])) {
1921 1921
             $cliObj->cli_validateArgs();
1922 1922
             $cliObj->cli_help();
1923 1923
             exit;
@@ -1925,8 +1925,8 @@  discard block
 block discarded – undo
1925 1925
 
1926 1926
         $cliObj->cli_validateArgs();
1927 1927
 
1928
-        if ($cliObj->cli_argValue('-o')==='exec')    {
1929
-            $this->registerQueueEntriesInternallyOnly=TRUE;
1928
+        if ($cliObj->cli_argValue('-o') === 'exec') {
1929
+            $this->registerQueueEntriesInternallyOnly = TRUE;
1930 1930
         }
1931 1931
 
1932 1932
         if (isset($cliObj->cli_args['_DEFAULT'][2])) {
@@ -1939,16 +1939,16 @@  discard block
 block discarded – undo
1939 1939
 
1940 1940
         $configurationKeys  = $this->getConfigurationKeys($cliObj);
1941 1941
 
1942
-        if(!is_array($configurationKeys)){
1942
+        if (!is_array($configurationKeys)) {
1943 1943
             $configurations = $this->getUrlsForPageId($pageId);
1944
-            if(is_array($configurations)){
1944
+            if (is_array($configurations)) {
1945 1945
                 $configurationKeys = array_keys($configurations);
1946
-            }else{
1946
+            } else {
1947 1947
                 $configurationKeys = array();
1948 1948
             }
1949 1949
         }
1950 1950
 
1951
-        if($cliObj->cli_argValue('-o')==='queue' || $cliObj->cli_argValue('-o')==='exec'){
1951
+        if ($cliObj->cli_argValue('-o') === 'queue' || $cliObj->cli_argValue('-o') === 'exec') {
1952 1952
 
1953 1953
             $reason = new tx_crawler_domain_reason();
1954 1954
             $reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT);
@@ -1956,7 +1956,7 @@  discard block
 block discarded – undo
1956 1956
             tx_crawler_domain_events_dispatcher::getInstance()->post(
1957 1957
                 'invokeQueueChange',
1958 1958
                 $this->setID,
1959
-                array(    'reason' => $reason )
1959
+                array('reason' => $reason)
1960 1960
             );
1961 1961
         }
1962 1962
 
@@ -1967,42 +1967,42 @@  discard block
 block discarded – undo
1967 1967
         $this->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime());
1968 1968
         $this->getPageTreeAndUrls(
1969 1969
             $pageId,
1970
-            \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($cliObj->cli_argValue('-d'),0,99),
1970
+            \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($cliObj->cli_argValue('-d'), 0, 99),
1971 1971
             $this->getCurrentTime(),
1972
-            \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($cliObj->cli_isArg('-n') ? $cliObj->cli_argValue('-n') : 30,1,1000),
1973
-            $cliObj->cli_argValue('-o')==='queue' || $cliObj->cli_argValue('-o')==='exec',
1974
-            $cliObj->cli_argValue('-o')==='url',
1975
-            \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',',$cliObj->cli_argValue('-proc'),1),
1972
+            \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($cliObj->cli_isArg('-n') ? $cliObj->cli_argValue('-n') : 30, 1, 1000),
1973
+            $cliObj->cli_argValue('-o') === 'queue' || $cliObj->cli_argValue('-o') === 'exec',
1974
+            $cliObj->cli_argValue('-o') === 'url',
1975
+            \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $cliObj->cli_argValue('-proc'), 1),
1976 1976
             $configurationKeys
1977 1977
         );
1978 1978
 
1979
-        if ($cliObj->cli_argValue('-o')==='url') {
1980
-            $cliObj->cli_echo(implode(chr(10),$this->downloadUrls).chr(10),1);
1981
-        } elseif ($cliObj->cli_argValue('-o')==='exec')    {
1979
+        if ($cliObj->cli_argValue('-o') === 'url') {
1980
+            $cliObj->cli_echo(implode(chr(10), $this->downloadUrls).chr(10), 1);
1981
+        } elseif ($cliObj->cli_argValue('-o') === 'exec') {
1982 1982
             $cliObj->cli_echo("Executing ".count($this->urlList)." requests right away:\n\n");
1983
-            $cliObj->cli_echo(implode(chr(10),$this->urlList).chr(10));
1983
+            $cliObj->cli_echo(implode(chr(10), $this->urlList).chr(10));
1984 1984
             $cliObj->cli_echo("\nProcessing:\n");
1985 1985
 
1986
-            foreach($this->queueEntries as $queueRec)    {
1986
+            foreach ($this->queueEntries as $queueRec) {
1987 1987
                 $p = unserialize($queueRec['parameters']);
1988
-                $cliObj->cli_echo($p['url'].' ('.implode(',',$p['procInstructions']).') => ');
1988
+                $cliObj->cli_echo($p['url'].' ('.implode(',', $p['procInstructions']).') => ');
1989 1989
 
1990 1990
                 $result = $this->readUrlFromArray($queueRec);
1991 1991
 
1992 1992
                 $requestResult = unserialize($result['content']);
1993
-                if (is_array($requestResult))    {
1994
-                    $resLog = is_array($requestResult['log']) ?  chr(10).chr(9).chr(9).implode(chr(10).chr(9).chr(9),$requestResult['log']) : '';
1993
+                if (is_array($requestResult)) {
1994
+                    $resLog = is_array($requestResult['log']) ? chr(10).chr(9).chr(9).implode(chr(10).chr(9).chr(9), $requestResult['log']) : '';
1995 1995
                     $cliObj->cli_echo('OK: '.$resLog.chr(10));
1996 1996
                 } else {
1997
-                    $cliObj->cli_echo('Error checking Crawler Result: '.substr(preg_replace('/\s+/',' ',strip_tags($result['content'])),0,30000).'...'.chr(10));
1997
+                    $cliObj->cli_echo('Error checking Crawler Result: '.substr(preg_replace('/\s+/', ' ', strip_tags($result['content'])), 0, 30000).'...'.chr(10));
1998 1998
                 }
1999 1999
             }
2000
-        } elseif ($cliObj->cli_argValue('-o')==='queue')    {
2000
+        } elseif ($cliObj->cli_argValue('-o') === 'queue') {
2001 2001
             $cliObj->cli_echo("Putting ".count($this->urlList)." entries in queue:\n\n");
2002
-            $cliObj->cli_echo(implode(chr(10),$this->urlList).chr(10));
2002
+            $cliObj->cli_echo(implode(chr(10), $this->urlList).chr(10));
2003 2003
         } else {
2004
-            $cliObj->cli_echo(count($this->urlList)." entries found for processing. (Use -o to decide action):\n\n",1);
2005
-            $cliObj->cli_echo(implode(chr(10),$this->urlList).chr(10),1);
2004
+            $cliObj->cli_echo(count($this->urlList)." entries found for processing. (Use -o to decide action):\n\n", 1);
2005
+            $cliObj->cli_echo(implode(chr(10), $this->urlList).chr(10), 1);
2006 2006
         }
2007 2007
     }
2008 2008
 
@@ -2027,12 +2027,12 @@  discard block
 block discarded – undo
2027 2027
         }
2028 2028
 
2029 2029
         $cliObj->cli_validateArgs();
2030
-        $pageId = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($cliObj->cli_args['_DEFAULT'][1],0);
2030
+        $pageId = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($cliObj->cli_args['_DEFAULT'][1], 0);
2031 2031
         $fullFlush = ($pageId == 0);
2032 2032
 
2033 2033
         $mode = $cliObj->cli_argValue('-o');
2034 2034
 
2035
-        switch($mode) {
2035
+        switch ($mode) {
2036 2036
             case 'all':
2037 2037
                 $result = $this->getLogEntriesForPageId($pageId, '', true, $fullFlush);
2038 2038
                 break;
@@ -2055,7 +2055,7 @@  discard block
 block discarded – undo
2055 2055
      * @param  tx_crawler_cli_im $cliObj    Command line object
2056 2056
      * @return mixed                        Array of keys or null if no keys found
2057 2057
      */
2058
-    protected function getConfigurationKeys(tx_crawler_cli_im &$cliObj) {
2058
+    protected function getConfigurationKeys(tx_crawler_cli_im & $cliObj) {
2059 2059
         $parameter = trim($cliObj->cli_argValue('-conf'));
2060 2060
         return ($parameter != '' ? \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $parameter) : array());
2061 2061
     }
@@ -2080,7 +2080,7 @@  discard block
 block discarded – undo
2080 2080
             $purgeDate = $this->getCurrentTime() - 24 * 60 * 60 * intval($this->extensionSettings['purgeQueueDays']);
2081 2081
             $del = $this->db->exec_DELETEquery(
2082 2082
                 'tx_crawler_queue',
2083
-                'exec_time!=0 AND exec_time<' . $purgeDate
2083
+                'exec_time!=0 AND exec_time<'.$purgeDate
2084 2084
             );
2085 2085
         }
2086 2086
 
@@ -2097,10 +2097,10 @@  discard block
 block discarded – undo
2097 2097
         intval($countInARun)
2098 2098
         );
2099 2099
 
2100
-        if (count($rows)>0) {
2100
+        if (count($rows) > 0) {
2101 2101
             $quidList = array();
2102 2102
 
2103
-            foreach($rows as $r) {
2103
+            foreach ($rows as $r) {
2104 2104
                 $quidList[] = $r['qid'];
2105 2105
             }
2106 2106
 
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
                 //TODO make sure we're not taking assigned queue-entires
2112 2112
             $this->db->exec_UPDATEquery(
2113 2113
                 'tx_crawler_queue',
2114
-                'qid IN ('.implode(',',$quidList).')',
2114
+                'qid IN ('.implode(',', $quidList).')',
2115 2115
                 array(
2116 2116
                     'process_scheduled' => intval($this->getCurrentTime()),
2117 2117
                     'process_id' => $processId
@@ -2122,32 +2122,32 @@  discard block
 block discarded – undo
2122 2122
             $numberOfAffectedRows = $this->db->sql_affected_rows();
2123 2123
             $this->db->exec_UPDATEquery(
2124 2124
                 'tx_crawler_process',
2125
-                "process_id = '".$processId."'" ,
2125
+                "process_id = '".$processId."'",
2126 2126
                 array(
2127 2127
                     'assigned_items_count' => intval($numberOfAffectedRows)
2128 2128
                 )
2129 2129
             );
2130 2130
 
2131
-            if($numberOfAffectedRows == count($quidList)) {
2131
+            if ($numberOfAffectedRows == count($quidList)) {
2132 2132
                 $this->db->sql_query('COMMIT');
2133
-            } else  {
2133
+            } else {
2134 2134
                 $this->db->sql_query('ROLLBACK');
2135 2135
                 $this->CLI_debug("Nothing processed due to multi-process collision (".$this->CLI_buildProcessId().")");
2136
-                return ( $result | self::CLI_STATUS_ABORTED );
2136
+                return ($result | self::CLI_STATUS_ABORTED);
2137 2137
             }
2138 2138
 
2139 2139
 
2140 2140
 
2141
-            foreach($rows as $r)    {
2141
+            foreach ($rows as $r) {
2142 2142
                 $result |= $this->readUrl($r['qid']);
2143 2143
 
2144 2144
                 $counter++;
2145
-                usleep(intval($sleepTime));    // Just to relax the system
2145
+                usleep(intval($sleepTime)); // Just to relax the system
2146 2146
 
2147 2147
                     // if during the start and the current read url the cli has been disable we need to return from the function
2148 2148
                     // mark the process NOT as ended.
2149 2149
                 if ($this->getDisabled()) {
2150
-                    return ( $result | self::CLI_STATUS_ABORTED );
2150
+                    return ($result | self::CLI_STATUS_ABORTED);
2151 2151
                 }
2152 2152
 
2153 2153
                 if (!$this->CLI_checkIfProcessIsActive($this->CLI_buildProcessId())) {
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
 
2156 2156
                         //TODO might need an additional returncode
2157 2157
                     $result |= self::CLI_STATUS_ABORTED;
2158
-                    break;        //possible timeout
2158
+                    break; //possible timeout
2159 2159
                 }
2160 2160
             }
2161 2161
 
@@ -2168,7 +2168,7 @@  discard block
 block discarded – undo
2168 2168
             $this->CLI_debug("Nothing within queue which needs to be processed (".$this->CLI_buildProcessId().")");
2169 2169
         }
2170 2170
 
2171
-        if($counter > 0) {
2171
+        if ($counter > 0) {
2172 2172
             $result |= self::CLI_STATUS_PROCESSED;
2173 2173
         }
2174 2174
 
@@ -2180,12 +2180,12 @@  discard block
 block discarded – undo
2180 2180
      *
2181 2181
      * @return    void
2182 2182
      */
2183
-    function CLI_runHooks()    {
2183
+    function CLI_runHooks() {
2184 2184
         global $TYPO3_CONF_VARS;
2185
-        if (is_array($TYPO3_CONF_VARS['EXTCONF']['crawler']['cli_hooks']))    {
2186
-            foreach($TYPO3_CONF_VARS['EXTCONF']['crawler']['cli_hooks'] as $objRef)    {
2185
+        if (is_array($TYPO3_CONF_VARS['EXTCONF']['crawler']['cli_hooks'])) {
2186
+            foreach ($TYPO3_CONF_VARS['EXTCONF']['crawler']['cli_hooks'] as $objRef) {
2187 2187
                 $hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
2188
-                if (is_object($hookObj))    {
2188
+                if (is_object($hookObj)) {
2189 2189
                     $hookObj->crawler_init($this);
2190 2190
                 }
2191 2191
             }
@@ -2222,7 +2222,7 @@  discard block
 block discarded – undo
2222 2222
 
2223 2223
             $currentTime = $this->getCurrentTime();
2224 2224
 
2225
-            while($row = $this->db->sql_fetch_assoc($res))    {
2225
+            while ($row = $this->db->sql_fetch_assoc($res)) {
2226 2226
                 if ($row['ttl'] < $currentTime) {
2227 2227
                     $orphanProcesses[] = $row['process_id'];
2228 2228
                 } else {
@@ -2232,7 +2232,7 @@  discard block
 block discarded – undo
2232 2232
 
2233 2233
                 // if there are less than allowed active processes then add a new one
2234 2234
             if ($processCount < intval($this->extensionSettings['processLimit'])) {
2235
-                $this->CLI_debug("add process ".$this->CLI_buildProcessId()." (".($processCount+1)."/".intval($this->extensionSettings['processLimit']).")");
2235
+                $this->CLI_debug("add process ".$this->CLI_buildProcessId()." (".($processCount + 1)."/".intval($this->extensionSettings['processLimit']).")");
2236 2236
 
2237 2237
                     // create new process record
2238 2238
                 $this->db->exec_INSERTquery(
@@ -2265,17 +2265,17 @@  discard block
 block discarded – undo
2265 2265
      * @param  boolean  $withinLock   show whether the DB-actions are included within an existing lock
2266 2266
      * @return boolean
2267 2267
      */
2268
-    function CLI_releaseProcesses($releaseIds, $withinLock=false) {
2268
+    function CLI_releaseProcesses($releaseIds, $withinLock = false) {
2269 2269
 
2270 2270
         if (!is_array($releaseIds)) {
2271 2271
             $releaseIds = array($releaseIds);
2272 2272
         }
2273 2273
 
2274 2274
         if (!count($releaseIds) > 0) {
2275
-            return false;   //nothing to release
2275
+            return false; //nothing to release
2276 2276
         }
2277 2277
 
2278
-        if(!$withinLock) $this->db->sql_query('BEGIN');
2278
+        if (!$withinLock) $this->db->sql_query('BEGIN');
2279 2279
 
2280 2280
             // some kind of 2nd chance algo - this way you need at least 2 processes to have a real cleanup
2281 2281
             // this ensures that a single process can't mess up the entire process table
@@ -2305,21 +2305,21 @@  discard block
 block discarded – undo
2305 2305
                 // mark all requested processes as non-active
2306 2306
         $this->db->exec_UPDATEquery(
2307 2307
             'tx_crawler_process',
2308
-            'process_id IN (\''.implode('\',\'',$releaseIds).'\') AND deleted=0',
2308
+            'process_id IN (\''.implode('\',\'', $releaseIds).'\') AND deleted=0',
2309 2309
             array(
2310 2310
                 'active'=>'0'
2311 2311
             )
2312 2312
         );
2313 2313
         $this->db->exec_UPDATEquery(
2314 2314
             'tx_crawler_queue',
2315
-            'exec_time=0 AND process_id IN ("'.implode('","',$releaseIds).'")',
2315
+            'exec_time=0 AND process_id IN ("'.implode('","', $releaseIds).'")',
2316 2316
             array(
2317 2317
                 'process_scheduled'=>0,
2318 2318
                 'process_id'=>''
2319 2319
             )
2320 2320
         );
2321 2321
 
2322
-        if(!$withinLock) $this->db->sql_query('COMMIT');
2322
+        if (!$withinLock) $this->db->sql_query('COMMIT');
2323 2323
 
2324 2324
         return true;
2325 2325
     }
@@ -2347,13 +2347,13 @@  discard block
 block discarded – undo
2347 2347
         $this->db->sql_query('BEGIN');
2348 2348
         $res = $this->db->exec_SELECTquery(
2349 2349
             'process_id,active,ttl',
2350
-            'tx_crawler_process','process_id = \''.$pid.'\'  AND deleted=0',
2350
+            'tx_crawler_process', 'process_id = \''.$pid.'\'  AND deleted=0',
2351 2351
             '',
2352 2352
             'ttl',
2353 2353
             '0,1'
2354 2354
         );
2355
-        if($row = $this->db->sql_fetch_assoc($res))    {
2356
-            $ret = intVal($row['active'])==1;
2355
+        if ($row = $this->db->sql_fetch_assoc($res)) {
2356
+            $ret = intVal($row['active']) == 1;
2357 2357
         }
2358 2358
         $this->db->sql_query('COMMIT');
2359 2359
 
@@ -2366,8 +2366,8 @@  discard block
 block discarded – undo
2366 2366
      * @return string  the ID
2367 2367
      */
2368 2368
     protected function CLI_buildProcessId() {
2369
-        if(!$this->processID) {
2370
-            $this->processID= \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5($this->microtime(true));
2369
+        if (!$this->processID) {
2370
+            $this->processID = \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5($this->microtime(true));
2371 2371
         }
2372 2372
         return $this->processID;
2373 2373
     }
@@ -2379,7 +2379,7 @@  discard block
 block discarded – undo
2379 2379
      *
2380 2380
      * @codeCoverageIgnore
2381 2381
      */
2382
-    protected function microtime($get_as_float = false )
2382
+    protected function microtime($get_as_float = false)
2383 2383
     {
2384 2384
         return microtime($get_as_float);
2385 2385
     }
@@ -2392,7 +2392,7 @@  discard block
 block discarded – undo
2392 2392
      * @codeCoverageIgnore
2393 2393
      */
2394 2394
     function CLI_debug($msg) {
2395
-        if(intval($this->extensionSettings['processDebug'])) {
2395
+        if (intval($this->extensionSettings['processDebug'])) {
2396 2396
             echo $msg."\n"; flush();
2397 2397
         }
2398 2398
     }
@@ -2411,7 +2411,7 @@  discard block
 block discarded – undo
2411 2411
 
2412 2412
         $cmd  = escapeshellcmd($this->extensionSettings['phpPath']);
2413 2413
         $cmd .= ' ';
2414
-        $cmd .= escapeshellarg(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler') . 'cli/bootstrap.php');
2414
+        $cmd .= escapeshellarg(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler').'cli/bootstrap.php');
2415 2415
         $cmd .= ' ';
2416 2416
         $cmd .= escapeshellarg($this->getFrontendBasePath());
2417 2417
         $cmd .= ' ';
@@ -2421,10 +2421,10 @@  discard block
 block discarded – undo
2421 2421
 
2422 2422
         $startTime = microtime(true);
2423 2423
         $content = $this->executeShellCommand($cmd);
2424
-        $this->log($url . (microtime(true) - $startTime));
2424
+        $this->log($url.(microtime(true) - $startTime));
2425 2425
 
2426 2426
         $result = array(
2427
-            'request' => implode("\r\n", $requestHeaders) . "\r\n\r\n",
2427
+            'request' => implode("\r\n", $requestHeaders)."\r\n\r\n",
2428 2428
             'headers' => '',
2429 2429
             'content' => $content
2430 2430
         );
@@ -2444,7 +2444,7 @@  discard block
 block discarded – undo
2444 2444
         $scheduledAgeInSeconds = $this->extensionSettings['cleanUpScheduledAge'] * 86400;
2445 2445
 
2446 2446
         $now = time();
2447
-        $condition = '(exec_time<>0 AND exec_time<' . ($now - $processedAgeInSeconds) . ') OR scheduled<=' . ($now - $scheduledAgeInSeconds);
2447
+        $condition = '(exec_time<>0 AND exec_time<'.($now - $processedAgeInSeconds).') OR scheduled<='.($now - $scheduledAgeInSeconds);
2448 2448
         $this->flushQueue($condition);
2449 2449
     }
2450 2450
 
@@ -2465,7 +2465,7 @@  discard block
 block discarded – undo
2465 2465
             $GLOBALS['TT']->start();
2466 2466
         }
2467 2467
 
2468
-        $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController',  $GLOBALS['TYPO3_CONF_VARS'], $id, $typeNum);
2468
+        $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $id, $typeNum);
2469 2469
         $GLOBALS['TSFE']->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
2470 2470
         $GLOBALS['TSFE']->sys_page->init(TRUE);
2471 2471
         $GLOBALS['TSFE']->connectToDB();
@@ -2478,6 +2478,6 @@  discard block
 block discarded – undo
2478 2478
     }
2479 2479
 }
2480 2480
 
2481
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/class.tx_crawler_lib.php'])    {
2481
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/class.tx_crawler_lib.php']) {
2482 2482
     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/class.tx_crawler_lib.php']);
2483 2483
 }
Please login to merge, or discard this patch.
modfunc1/class.tx_crawler_modfunc1.php 3 patches
Indentation   +919 added lines, -919 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;
38
+        // Internal, dynamic:
39
+    var $duplicateTrack = array();
40
+    var $submitCrawlUrls = FALSE;
41
+    var $downloadCrawlUrls = FALSE;
42 42
 
43
-	var $scheduledTime = 0;
44
-	var $reqMinute = 0;
43
+    var $scheduledTime = 0;
44
+    var $reqMinute = 0;
45 45
 
46
-	/**
47
-	 * @var array holds the selection of configuration from the configuration selector box
48
-	 */
49
-	var $incomingConfigurationSelection = array();
46
+    /**
47
+     * @var array holds the selection of configuration from the configuration selector box
48
+     */
49
+    var $incomingConfigurationSelection = array();
50 50
 
51
-	/**
52
-	 * @var tx_crawler_lib
53
-	 */
54
-	var $crawlerObj;
51
+    /**
52
+     * @var tx_crawler_lib
53
+     */
54
+    var $crawlerObj;
55 55
 
56
-	var $CSVaccu = array();
56
+    var $CSVaccu = array();
57 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();
58
+    /**
59
+     * If true the user requested a CSV export of the queue
60
+     *
61
+     * @var boolean
62
+     */
63
+    var $CSVExport = FALSE;
66 64
 
67
-	/**
68
-	 * Holds the configuration from ext_conf_template loaded by loadExtensionSettings()
69
-	 *
70
-	 * @var array
71
-	 */
72
-	protected $extensionSettings = array();
65
+    var $downloadUrls = array();
73 66
 
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
-	}
67
+    /**
68
+     * Holds the configuration from ext_conf_template loaded by loadExtensionSettings()
69
+     *
70
+     * @var array
71
+     */
72
+    protected $extensionSettings = array();
126 73
 
127
-	/**
128
-	 * Load extension settings
129
-	 *
130
-	 * @param void
131
-	 * @return void
132
-	 */
133
-	protected function loadExtensionSettings() {
134
-		$this->extensionSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['crawler']);
135
-	}
136
-
137
-	/**
138
-	 * Main function
139
-	 *
140
-	 * @return	string		HTML output
141
-	 */
142
-	function main() {
143
-		global $LANG, $BACK_PATH;
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
+        $this->extensionSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['crawler']);
135
+    }
136
+
137
+    /**
138
+     * Main function
139
+     *
140
+     * @return	string		HTML output
141
+     */
142
+    function main() {
143
+        global $LANG, $BACK_PATH;
144 144
 
145
-		$this->incLocalLang();
145
+        $this->incLocalLang();
146 146
 
147
-		$this->loadExtensionSettings();
148
-		if (empty($this->pObj->MOD_SETTINGS['processListMode'])) {
149
-			$this->pObj->MOD_SETTINGS['processListMode'] = 'simple';
150
-		}
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
-		}
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
+        }
386 371
 
387
-			// Return output:
388
-		return 	$output;
389
-	}
372
+            // Download Urls to crawl:
373
+        if ($this->downloadCrawlUrls)	{
390 374
 
391
-	/**
392
-	 * Draws the configuration selectors for compiling URLs:
393
-	 *
394
-	 * @return	string		HTML table
395
-	 */
396
-	function drawURLs_cfgSelectors()	{
375
+                // Creating output header:
376
+            $mimeType = 'application/octet-stream';
377
+            Header('Content-Type: '.$mimeType);
378
+            Header('Content-Disposition: attachment; filename=CrawlerUrls.txt');
397 379
 
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 );
380
+                // Printing the content of the CSV lines:
381
+            echo implode(chr(13).chr(10),$this->downloadUrls);
413 382
 
414
-			// Configurations
415
-		$cell[] = $this->selectorBox(
416
-			empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations),
417
-			'configurationSelection',
418
-			$this->incomingConfigurationSelection,
419
-			1
420
-		);
383
+                // Exits:
384
+            exit;
385
+        }
421 386
 
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
-		);
387
+            // Return output:
388
+        return 	$output;
389
+    }
433 390
 
434
-		// TODO: check relevance
435
-		/*
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,110 +501,110 @@  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 = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $this->pObj->pageinfo);
574
-					$HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $this->pObj->pageinfo);
575
-					$tree->tree[] = Array(
576
-						'row' => $this->pObj->pageinfo,
577
-						'HTML' => $HTML
578
-					);
579
-
580
-						// Get branch beneath:
581
-					if ($this->pObj->MOD_SETTINGS['depth'])	{
582
-						$tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
583
-					}
584
-
585
-						// Traverse page tree:
586
-					$code = ''; $count = 0;
587
-					foreach($tree->tree as $data)	{
588
-						$code .= $this->drawLog_addRows(
589
-									$data['row'],
590
-									$data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE),
591
-									intval($this->pObj->MOD_SETTINGS['itemsPerPage'])
592
-								);
593
-						if (++$count == 1000) {
594
-							break;
595
-						}
596
-					}
597
-				} else {
598
-					$code = '';
599
-					$code.= $this->drawLog_addRows(
600
-								$showSetId,
601
-								'Set ID: '.$showSetId
602
-							);
603
-				}
604
-
605
-				if ($code)	{
606
-
607
-					$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 = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $this->pObj->pageinfo);
574
+                    $HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('pages', $this->pObj->pageinfo);
575
+                    $tree->tree[] = Array(
576
+                        'row' => $this->pObj->pageinfo,
577
+                        'HTML' => $HTML
578
+                    );
579
+
580
+                        // Get branch beneath:
581
+                    if ($this->pObj->MOD_SETTINGS['depth'])	{
582
+                        $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
583
+                    }
584
+
585
+                        // Traverse page tree:
586
+                    $code = ''; $count = 0;
587
+                    foreach($tree->tree as $data)	{
588
+                        $code .= $this->drawLog_addRows(
589
+                                    $data['row'],
590
+                                    $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE),
591
+                                    intval($this->pObj->MOD_SETTINGS['itemsPerPage'])
592
+                                );
593
+                        if (++$count == 1000) {
594
+                            break;
595
+                        }
596
+                    }
597
+                } else {
598
+                    $code = '';
599
+                    $code.= $this->drawLog_addRows(
600
+                                $showSetId,
601
+                                'Set ID: '.$showSetId
602
+                            );
603
+                }
604
+
605
+                if ($code)	{
606
+
607
+                    $output .= '
608 608
 						<br /><br />
609 609
 						<input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.reloadlist').'" name="_reload" />
610 610
 						<input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.downloadcsv').'" name="_csv" />
@@ -618,20 +618,20 @@  discard block
 block discarded – undo
618 618
 
619 619
 
620 620
 						<table class="lrPadding c-list crawlerlog">'.
621
-							$this->drawLog_printTableHeader().
622
-							$code.
623
-						'</table>';
624
-				}
625
-			} else {	// Otherwise show available sets:
626
-				$setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
627
-								'set_id, count(*) as count_value, scheduled',
628
-								'tx_crawler_queue',
629
-								'',
630
-								'set_id, scheduled',
631
-								'scheduled DESC'
632
-							);
633
-
634
-				$code = '
621
+                            $this->drawLog_printTableHeader().
622
+                            $code.
623
+                        '</table>';
624
+                }
625
+            } else {	// Otherwise show available sets:
626
+                $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
627
+                                'set_id, count(*) as count_value, scheduled',
628
+                                'tx_crawler_queue',
629
+                                '',
630
+                                'set_id, scheduled',
631
+                                'scheduled DESC'
632
+                            );
633
+
634
+                $code = '
635 635
 					<tr class="bgColor5 tableheader">
636 636
 						<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid').':</td>
637 637
 						<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').'t:</td>
@@ -639,9 +639,9 @@  discard block
 block discarded – undo
639 639
 					</tr>
640 640
 				';
641 641
 
642
-				$cc=0;
643
-				foreach($setList as $set)	{
644
-					$code.= '
642
+                $cc=0;
643
+                foreach($setList as $set)	{
644
+                    $code.= '
645 645
 						<tr class="bgColor'.($cc%2 ? '-20':'-10').'">
646 646
 							<td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td>
647 647
 							<td>'.$set['count_value'].'</td>
@@ -649,218 +649,218 @@  discard block
 block discarded – undo
649 649
 						</tr>
650 650
 					';
651 651
 
652
-					$cc++;
653
-				}
652
+                    $cc++;
653
+                }
654 654
 
655
-				$output .= '
655
+                $output .= '
656 656
 					<br /><br />
657 657
 					<table class="lrPadding c-list">'.
658
-						$code.
659
-					'</table>';
660
-			}
661
-		}
658
+                        $code.
659
+                    '</table>';
660
+            }
661
+        }
662 662
 
663
-		if($this->CSVExport) {
664
-			$this->outputCsvFile();
665
-		}
663
+        if($this->CSVExport) {
664
+            $this->outputCsvFile();
665
+        }
666 666
 
667
-			// Return output
668
-		return 	$output;
669
-	}
667
+            // Return output
668
+        return 	$output;
669
+    }
670 670
 
671
-	/**
672
-	 * Outputs the CSV file and sets the correct headers
673
-	 */
674
-	protected function outputCsvFile() {
671
+    /**
672
+     * Outputs the CSV file and sets the correct headers
673
+     */
674
+    protected function outputCsvFile() {
675 675
 
676
-		if (!count($this->CSVaccu)) {
677
-			$this->addWarningMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.canNotExportEmptyQueueToCsvText'));
678
-			return;
679
-		}
676
+        if (!count($this->CSVaccu)) {
677
+            $this->addWarningMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.canNotExportEmptyQueueToCsvText'));
678
+            return;
679
+        }
680 680
 
681
-		$csvLines = array();
681
+        $csvLines = array();
682 682
 
683
-			// Field names:
684
-		reset($this->CSVaccu);
685
-		$fieldNames = array_keys(current($this->CSVaccu));
686
-		$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames);
683
+            // Field names:
684
+        reset($this->CSVaccu);
685
+        $fieldNames = array_keys(current($this->CSVaccu));
686
+        $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames);
687 687
 
688
-			// Data:
689
-		foreach($this->CSVaccu as $row)	{
690
-			$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row);
691
-		}
688
+            // Data:
689
+        foreach($this->CSVaccu as $row)	{
690
+            $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row);
691
+        }
692 692
 
693
-			// Creating output header:
694
-		$mimeType = 'application/octet-stream';
695
-		Header('Content-Type: '.$mimeType);
696
-		Header('Content-Disposition: attachment; filename=CrawlerLog.csv');
693
+            // Creating output header:
694
+        $mimeType = 'application/octet-stream';
695
+        Header('Content-Type: '.$mimeType);
696
+        Header('Content-Disposition: attachment; filename=CrawlerLog.csv');
697 697
 
698
-			// Printing the content of the CSV lines:
699
-		echo implode(chr(13).chr(10),$csvLines);
698
+            // Printing the content of the CSV lines:
699
+        echo implode(chr(13).chr(10),$csvLines);
700 700
 
701
-			// Exits:
702
-		exit;
703
-	}
701
+            // Exits:
702
+        exit;
703
+    }
704 704
 
705
-	/**
706
-	 * Create the rows for display of the page tree
707
-	 * For each page a number of rows are shown displaying GET variable configuration
708
-	 *
709
-	 * @param array $pageRow_setId Page row or set-id
710
-	 * @param string $titleString Title string
711
-	 * @param int $itemsPerPage Items per Page setting
705
+    /**
706
+     * Create the rows for display of the page tree
707
+     * For each page a number of rows are shown displaying GET variable configuration
712 708
      *
713
-	 * @return string HTML <tr> content (one or more)
714
-	 */
715
-	function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) {
716
-
717
-			// If Flush button is pressed, flush tables instead of selecting entries:
718
-
719
-		if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
720
-			$doFlush = true;
721
-			$doFullFlush = false;
722
-		} elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
723
-			$doFlush = true;
724
-			$doFullFlush = true;
725
-		} else {
726
-			$doFlush = false;
727
-			$doFullFlush = false;
728
-		}
709
+     * @param array $pageRow_setId Page row or set-id
710
+     * @param string $titleString Title string
711
+     * @param int $itemsPerPage Items per Page setting
712
+     *
713
+     * @return string HTML <tr> content (one or more)
714
+     */
715
+    function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) {
716
+
717
+            // If Flush button is pressed, flush tables instead of selecting entries:
718
+
719
+        if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
720
+            $doFlush = true;
721
+            $doFullFlush = false;
722
+        } elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
723
+            $doFlush = true;
724
+            $doFullFlush = true;
725
+        } else {
726
+            $doFlush = false;
727
+            $doFullFlush = false;
728
+        }
729 729
 
730
-			// Get result:
731
-		if (is_array($pageRow_setId))	{
732
-			$res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
733
-		} else {
734
-			$res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
735
-		}
730
+            // Get result:
731
+        if (is_array($pageRow_setId))	{
732
+            $res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
733
+        } else {
734
+            $res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
735
+        }
736 736
 
737
-			// Init var:
738
-		$colSpan = 9
739
-				+ ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0)
740
-				+ ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
741
-
742
-		if (count($res))	{
743
-				// Traverse parameter combinations:
744
-			$c = 0;
745
-			$content='';
746
-			foreach($res as $kk => $vv)	{
747
-
748
-					// Title column:
749
-				if (!$c)	{
750
-					$titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>';
751
-				} else {
752
-					$titleClm = '';
753
-				}
754
-
755
-					// Result:
756
-				$resLog = $this->getResultLog($vv);
757
-
758
-				$resStatus = $this->getResStatus($vv);
759
-				$resFeVars = $this->getResFeVars($vv);
760
-
761
-					// Compile row:
762
-				$parameters = unserialize($vv['parameters']);
763
-
764
-					// Put data into array:
765
-				$rowData = array();
766
-				if ($this->pObj->MOD_SETTINGS['log_resultLog'])	{
767
-					$rowData['result_log'] = $resLog;
768
-				} else {
769
-					$rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
770
-					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
771
-				}
772
-				$rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50);
773
-				$rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>';
774
-				$rowData['feUserGroupList'] = $parameters['feUserGroupList'];
775
-				$rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : '';
776
-				$rowData['set_id'] = $vv['set_id'];
777
-
778
-				if ($this->pObj->MOD_SETTINGS['log_feVars']) {
779
-					$rowData['tsfe_id'] = $resFeVars['id'];
780
-					$rowData['tsfe_gr_list'] = $resFeVars['gr_list'];
781
-					$rowData['tsfe_no_cache'] = $resFeVars['no_cache'];
782
-				}
783
-
784
-				$setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
785
-
786
-				$refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
787
-				if (version_compare(TYPO3_version,'7.0','>=')) {
788
-					$refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
789
-				}
790
-
791
-					// Put rows together:
792
-				$content.= '
737
+            // Init var:
738
+        $colSpan = 9
739
+                + ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0)
740
+                + ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
741
+
742
+        if (count($res))	{
743
+                // Traverse parameter combinations:
744
+            $c = 0;
745
+            $content='';
746
+            foreach($res as $kk => $vv)	{
747
+
748
+                    // Title column:
749
+                if (!$c)	{
750
+                    $titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>';
751
+                } else {
752
+                    $titleClm = '';
753
+                }
754
+
755
+                    // Result:
756
+                $resLog = $this->getResultLog($vv);
757
+
758
+                $resStatus = $this->getResStatus($vv);
759
+                $resFeVars = $this->getResFeVars($vv);
760
+
761
+                    // Compile row:
762
+                $parameters = unserialize($vv['parameters']);
763
+
764
+                    // Put data into array:
765
+                $rowData = array();
766
+                if ($this->pObj->MOD_SETTINGS['log_resultLog'])	{
767
+                    $rowData['result_log'] = $resLog;
768
+                } else {
769
+                    $rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
770
+                    $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
771
+                }
772
+                $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50);
773
+                $rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>';
774
+                $rowData['feUserGroupList'] = $parameters['feUserGroupList'];
775
+                $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : '';
776
+                $rowData['set_id'] = $vv['set_id'];
777
+
778
+                if ($this->pObj->MOD_SETTINGS['log_feVars']) {
779
+                    $rowData['tsfe_id'] = $resFeVars['id'];
780
+                    $rowData['tsfe_gr_list'] = $resFeVars['gr_list'];
781
+                    $rowData['tsfe_no_cache'] = $resFeVars['no_cache'];
782
+                }
783
+
784
+                $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
785
+
786
+                $refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
787
+                if (version_compare(TYPO3_version,'7.0','>=')) {
788
+                    $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
789
+                }
790
+
791
+                    // Put rows together:
792
+                $content.= '
793 793
 					<tr class="bgColor'.($c%2 ? '-20':'-10').'">
794 794
 						'.$titleClm.'
795 795
 						<td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)) . '">'.htmlspecialchars($vv['qid']).'</a></td>
796 796
 						<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>';
797
-				foreach($rowData as $fKey => $value) {
797
+                foreach($rowData as $fKey => $value) {
798 798
 
799
-					if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey))	{
800
-						$content.= '
799
+                    if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey))	{
800
+                        $content.= '
801 801
 						<td>'.$value.'</td>';
802
-					} else {
803
-						$content.= '
802
+                    } else {
803
+                        $content.= '
804 804
 						<td>'.nl2br(htmlspecialchars($value)).'</td>';
805
-					}
806
-				}
807
-				$content.= '
805
+                    }
806
+                }
807
+                $content.= '
808 808
 					</tr>';
809
-				$c++;
810
-
811
-				if ($this->CSVExport)	{
812
-						// Only for CSV (adding qid and scheduled/exec_time if needed):
813
-					$rowData['result_log'] = implode('// ',explode(chr(10),$resLog));
814
-					$rowData['qid'] = $vv['qid'];
815
-					$rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
816
-					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
817
-					$this->CSVaccu[] = $rowData;
818
-				}
819
-			}
820
-		} else {
809
+                $c++;
810
+
811
+                if ($this->CSVExport)	{
812
+                        // Only for CSV (adding qid and scheduled/exec_time if needed):
813
+                    $rowData['result_log'] = implode('// ',explode(chr(10),$resLog));
814
+                    $rowData['qid'] = $vv['qid'];
815
+                    $rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
816
+                    $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
817
+                    $this->CSVaccu[] = $rowData;
818
+                }
819
+            }
820
+        } else {
821 821
 
822
-				// Compile row:
823
-			$content = '
822
+                // Compile row:
823
+            $content = '
824 824
 				<tr class="bgColor-20">
825 825
 					<td>'.$titleString.'</td>
826 826
 					<td colspan="'.$colSpan.'"><em>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noentries').'</em></td>
827 827
 				</tr>';
828
-		}
828
+        }
829 829
 
830
-		return $content;
831
-	}
830
+        return $content;
831
+    }
832 832
 
833
-	/**
834
-	 * Find Fe vars
835
-	 *
836
-	 * @param array $row
837
-	 * @return array
838
-	 */
839
-	function getResFeVars($row) {
840
-		$feVars = array();
841
-
842
-		if ($row['result_data']) {
843
-			$resultData = unserialize($row['result_data']);
844
-			$requestResult = unserialize($resultData['content']);
845
-			$feVars = $requestResult['vars'];
846
-		}
833
+    /**
834
+     * Find Fe vars
835
+     *
836
+     * @param array $row
837
+     * @return array
838
+     */
839
+    function getResFeVars($row) {
840
+        $feVars = array();
841
+
842
+        if ($row['result_data']) {
843
+            $resultData = unserialize($row['result_data']);
844
+            $requestResult = unserialize($resultData['content']);
845
+            $feVars = $requestResult['vars'];
846
+        }
847 847
 
848
-		return $feVars;
849
-	}
848
+        return $feVars;
849
+    }
850 850
 
851
-	/**
852
-	 * Create Table header row (log)
853
-	 *
854
-	 * @return	string		Table header
855
-	 */
856
-	function drawLog_printTableHeader()	{
851
+    /**
852
+     * Create Table header row (log)
853
+     *
854
+     * @return	string		Table header
855
+     */
856
+    function drawLog_printTableHeader()	{
857 857
 
858
-		$content = '
858
+        $content = '
859 859
 			<tr class="bgColor5 tableheader">
860 860
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pagetitle').':</td>
861 861
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.qid').':</td>
862 862
 				<td>&nbsp;</td>'.
863
-				($this->pObj->MOD_SETTINGS['log_resultLog'] ? '
863
+                ($this->pObj->MOD_SETTINGS['log_resultLog'] ? '
864 864
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.resultlog').':</td>' : '
865 865
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.scheduledtime').':</td>
866 866
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.runtime').':</td>').'
@@ -869,14 +869,14 @@  discard block
 block discarded – undo
869 869
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.groups').':</td>
870 870
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.procinstr').':</td>
871 871
 				<td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid').':</td>'.
872
-				($this->pObj->MOD_SETTINGS['log_feVars'] ? '
872
+                ($this->pObj->MOD_SETTINGS['log_feVars'] ? '
873 873
 				<td>'.htmlspecialchars('TSFE->id').'</td>
874 874
 				<td>'.htmlspecialchars('TSFE->gr_list').'</td>
875 875
 				<td>'.htmlspecialchars('TSFE->no_cache').'</td>' : '').'
876 876
 			</tr>';
877 877
 
878
-		return $content;
879
-	}
878
+        return $content;
879
+    }
880 880
 
881 881
         /**
882 882
          * Extract the log information from the current row and retrive it as formatted string.
@@ -903,25 +903,25 @@  discard block
 block discarded – undo
903 903
                 return $content;
904 904
         }
905 905
 
906
-	function getResStatus($vv) {
907
-		if ($vv['result_data'])	{
908
-			$requestContent = unserialize($vv['result_data']);
909
-			$requestResult = unserialize($requestContent['content']);
910
-			if (is_array($requestResult)) {
911
-				if (empty($requestResult['errorlog'])) {
912
-					$resStatus = 'OK';
913
-				} else {
914
-					$resStatus = implode("\n", $requestResult['errorlog']);
915
-				}
916
-				$resLog = is_array($requestResult['log']) ?  implode(chr(10),$requestResult['log']) : '';
917
-			} else {
918
-				$resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...';
919
-			}
920
-		} else {
921
-			$resStatus = '-';
922
-		}
923
-		return $resStatus;
924
-	}
906
+    function getResStatus($vv) {
907
+        if ($vv['result_data'])	{
908
+            $requestContent = unserialize($vv['result_data']);
909
+            $requestResult = unserialize($requestContent['content']);
910
+            if (is_array($requestResult)) {
911
+                if (empty($requestResult['errorlog'])) {
912
+                    $resStatus = 'OK';
913
+                } else {
914
+                    $resStatus = implode("\n", $requestResult['errorlog']);
915
+                }
916
+                $resLog = is_array($requestResult['log']) ?  implode(chr(10),$requestResult['log']) : '';
917
+            } else {
918
+                $resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...';
919
+            }
920
+        } else {
921
+            $resStatus = '-';
922
+        }
923
+        return $resStatus;
924
+    }
925 925
 
926 926
 
927 927
 
@@ -930,344 +930,344 @@  discard block
 block discarded – undo
930 930
 
931 931
 
932 932
 
933
-	/*****************************
933
+    /*****************************
934 934
 	 *
935 935
 	 * CLI status display
936 936
 	 *
937 937
 	 *****************************/
938 938
 
939
-	/**
940
-	 * This method is used to show an overview about the active an the finished crawling processes
941
-	 *
942
-	 * @author Timo Schmidt
943
-	 * @param void
944
-	 * @return string
945
-	 */
946
-	protected function drawProcessOverviewAction(){
947
-
948
-		$this->runRefreshHooks();
949
-
950
-		global $BACK_PATH;
951
-		$this->makeCrawlerProcessableChecks();
952
-
953
-		$crawler = $this->findCrawler();
954
-		try {
955
-			$this->handleProcessOverviewActions();
956
-		} catch (Exception $e) {
957
-			$this->addErrorMessage($e->getMessage());
958
-		}
939
+    /**
940
+     * This method is used to show an overview about the active an the finished crawling processes
941
+     *
942
+     * @author Timo Schmidt
943
+     * @param void
944
+     * @return string
945
+     */
946
+    protected function drawProcessOverviewAction(){
947
+
948
+        $this->runRefreshHooks();
949
+
950
+        global $BACK_PATH;
951
+        $this->makeCrawlerProcessableChecks();
952
+
953
+        $crawler = $this->findCrawler();
954
+        try {
955
+            $this->handleProcessOverviewActions();
956
+        } catch (Exception $e) {
957
+            $this->addErrorMessage($e->getMessage());
958
+        }
959 959
 
960
-		$offset 	= intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
961
-		$perpage 	= 20;
960
+        $offset 	= intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
961
+        $perpage 	= 20;
962 962
 
963
-		$processRepository	= new tx_crawler_domain_process_repository();
964
-		$queueRepository	= new tx_crawler_domain_queue_repository();
963
+        $processRepository	= new tx_crawler_domain_process_repository();
964
+        $queueRepository	= new tx_crawler_domain_queue_repository();
965 965
 
966
-		$mode = $this->pObj->MOD_SETTINGS['processListMode'];
967
-		if ($mode == 'detail') {
968
-			$where = '';
969
-		} elseif($mode == 'simple') {
970
-			$where = 'active = 1';
971
-		}
966
+        $mode = $this->pObj->MOD_SETTINGS['processListMode'];
967
+        if ($mode == 'detail') {
968
+            $where = '';
969
+        } elseif($mode == 'simple') {
970
+            $where = 'active = 1';
971
+        }
972 972
 
973
-		$allProcesses 		= $processRepository->findAll('ttl','DESC', $perpage, $offset,$where);
974
-		$allCount			= $processRepository->countAll($where);
975
-
976
-		$listView			= new tx_crawler_view_process_list();
977
-		$listView->setPageId($this->pObj->id);
978
-		$listView->setIconPath($BACK_PATH.'../typo3conf/ext/crawler/template/process/res/img/');
979
-		$listView->setProcessCollection($allProcesses);
980
-		$listView->setCliPath($this->processManager->getCrawlerCliPath());
981
-		$listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected);
982
-		$listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems());
983
-		$listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems());
984
-		$listView->setActiveProcessCount($processRepository->countActive());
985
-		$listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1));
986
-		$listView->setMode($mode);
987
-
988
-		$paginationView		= new tx_crawler_view_pagination();
989
-		$paginationView->setCurrentOffset($offset);
990
-		$paginationView->setPerPage($perpage);
991
-		$paginationView->setTotalItemCount($allCount);
992
-
993
-		$output = $listView->render();
994
-
995
-		if ($paginationView->getTotalPagesCount() > 1) {
996
-			$output .= ' <br />'.$paginationView->render();
997
-		}
973
+        $allProcesses 		= $processRepository->findAll('ttl','DESC', $perpage, $offset,$where);
974
+        $allCount			= $processRepository->countAll($where);
975
+
976
+        $listView			= new tx_crawler_view_process_list();
977
+        $listView->setPageId($this->pObj->id);
978
+        $listView->setIconPath($BACK_PATH.'../typo3conf/ext/crawler/template/process/res/img/');
979
+        $listView->setProcessCollection($allProcesses);
980
+        $listView->setCliPath($this->processManager->getCrawlerCliPath());
981
+        $listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected);
982
+        $listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems());
983
+        $listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems());
984
+        $listView->setActiveProcessCount($processRepository->countActive());
985
+        $listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1));
986
+        $listView->setMode($mode);
987
+
988
+        $paginationView		= new tx_crawler_view_pagination();
989
+        $paginationView->setCurrentOffset($offset);
990
+        $paginationView->setPerPage($perpage);
991
+        $paginationView->setTotalItemCount($allCount);
992
+
993
+        $output = $listView->render();
994
+
995
+        if ($paginationView->getTotalPagesCount() > 1) {
996
+            $output .= ' <br />'.$paginationView->render();
997
+        }
998 998
 
999
-		return $output;
1000
-	}
999
+        return $output;
1000
+    }
1001 1001
 
1002
-	/**
1003
-	 * Verify that the crawler is exectuable.
1004
-	 *
1005
-	 * @access protected
1006
-	 * @return void
1007
-	 *
1008
-	 * @author Michael Klapper <[email protected]>
1009
-	 */
1010
-	protected function makeCrawlerProcessableChecks() {
1011
-		global $LANG;
1012
-
1013
-		if ($this->isCrawlerUserAvailable() === false) {
1014
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noBeUserAvailable'));
1015
-		} elseif ($this->isCrawlerUserNotAdmin() === false) {
1016
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.beUserIsAdmin'));
1017
-		}
1002
+    /**
1003
+     * Verify that the crawler is exectuable.
1004
+     *
1005
+     * @access protected
1006
+     * @return void
1007
+     *
1008
+     * @author Michael Klapper <[email protected]>
1009
+     */
1010
+    protected function makeCrawlerProcessableChecks() {
1011
+        global $LANG;
1012
+
1013
+        if ($this->isCrawlerUserAvailable() === false) {
1014
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noBeUserAvailable'));
1015
+        } elseif ($this->isCrawlerUserNotAdmin() === false) {
1016
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.beUserIsAdmin'));
1017
+        }
1018 1018
 
1019
-		if ($this->isPhpForkAvailable() === false) {
1020
-			$this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noPhpForkAvailable'));
1021
-		}
1019
+        if ($this->isPhpForkAvailable() === false) {
1020
+            $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noPhpForkAvailable'));
1021
+        }
1022 1022
 
1023
-		$exitCode = 0;
1024
-		$out = array();
1025
-		exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode);
1026
-		if ($exitCode > 0) {
1027
-			$this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath'])));
1028
-		}
1029
-	}
1023
+        $exitCode = 0;
1024
+        $out = array();
1025
+        exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode);
1026
+        if ($exitCode > 0) {
1027
+            $this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath'])));
1028
+        }
1029
+    }
1030 1030
 
1031
-	/**
1032
-	 * Indicate that the required PHP method "popen" is
1033
-	 * available in the system.
1034
-	 *
1035
-	 * @access protected
1036
-	 * @return boolean
1037
-	 *
1038
-	 * @author Michael Klapper <[email protected]>
1039
-	 */
1040
-	protected function isPhpForkAvailable() {
1041
-		return function_exists('popen');
1042
-	}
1043
-
1044
-	/**
1045
-	 * Indicate that the required be_user "_cli_crawler" is
1046
-	 * global available in the system.
1047
-	 *
1048
-	 * @access protected
1049
-	 * @return boolean
1050
-	 *
1051
-	 * @author Michael Klapper <[email protected]>
1052
-	 */
1053
-	protected function isCrawlerUserAvailable() {
1054
-		$isAvailable = false;
1055
-		$userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1031
+    /**
1032
+     * Indicate that the required PHP method "popen" is
1033
+     * available in the system.
1034
+     *
1035
+     * @access protected
1036
+     * @return boolean
1037
+     *
1038
+     * @author Michael Klapper <[email protected]>
1039
+     */
1040
+    protected function isPhpForkAvailable() {
1041
+        return function_exists('popen');
1042
+    }
1043
+
1044
+    /**
1045
+     * Indicate that the required be_user "_cli_crawler" is
1046
+     * global available in the system.
1047
+     *
1048
+     * @access protected
1049
+     * @return boolean
1050
+     *
1051
+     * @author Michael Klapper <[email protected]>
1052
+     */
1053
+    protected function isCrawlerUserAvailable() {
1054
+        $isAvailable = false;
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
-		return $isAvailable;
1061
-	}
1060
+        return $isAvailable;
1061
+    }
1062 1062
 
1063
-	/**
1064
-	 * Indicate that the required be_user "_cli_crawler" is
1065
-	 * has no admin rights.
1066
-	 *
1067
-	 * @access protected
1068
-	 * @return boolean
1069
-	 *
1070
-	 * @author Michael Klapper <[email protected]>
1071
-	 */
1072
-	protected function isCrawlerUserNotAdmin() {
1073
-		$isAvailable = false;
1074
-		$userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1063
+    /**
1064
+     * Indicate that the required be_user "_cli_crawler" is
1065
+     * has no admin rights.
1066
+     *
1067
+     * @access protected
1068
+     * @return boolean
1069
+     *
1070
+     * @author Michael Klapper <[email protected]>
1071
+     */
1072
+    protected function isCrawlerUserNotAdmin() {
1073
+        $isAvailable = false;
1074
+        $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler');
1075 1075
 
1076
-		if (is_array($userArray) && $userArray[0]['admin'] == 0)
1077
-			$isAvailable = true;
1076
+        if (is_array($userArray) && $userArray[0]['admin'] == 0)
1077
+            $isAvailable = true;
1078 1078
 
1079
-		return $isAvailable;
1080
-	}
1079
+        return $isAvailable;
1080
+    }
1081 1081
 
1082
-	/**
1083
-	 * Method to handle incomming actions of the process overview
1084
-	 *
1085
-	 * @param void
1086
-	 * @return void
1087
-	 */
1088
-	protected function handleProcessOverviewActions(){
1089
-
1090
-		$crawler = $this->findCrawler();
1091
-
1092
-		switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) {
1093
-			case 'stopCrawling' :
1094
-				//set the cli status to disable (all processes will be terminated)
1095
-				$crawler->setDisabled(true);
1096
-				break;
1097
-			case 'resumeCrawling' :
1098
-				//set the cli status to end (all processes will be terminated)
1099
-				$crawler->setDisabled(false);
1100
-				break;
1101
-			case 'addProcess' :
1102
-				$handle = $this->processManager->startProcess();
1103
-				if ($handle === false) {
1104
-					throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocesserror'));
1105
-				}
1106
-				$this->addNoticeMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocess'));
1107
-				break;
1108
-		}
1109
-	}
1082
+    /**
1083
+     * Method to handle incomming actions of the process overview
1084
+     *
1085
+     * @param void
1086
+     * @return void
1087
+     */
1088
+    protected function handleProcessOverviewActions(){
1089
+
1090
+        $crawler = $this->findCrawler();
1091
+
1092
+        switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) {
1093
+            case 'stopCrawling' :
1094
+                //set the cli status to disable (all processes will be terminated)
1095
+                $crawler->setDisabled(true);
1096
+                break;
1097
+            case 'resumeCrawling' :
1098
+                //set the cli status to end (all processes will be terminated)
1099
+                $crawler->setDisabled(false);
1100
+                break;
1101
+            case 'addProcess' :
1102
+                $handle = $this->processManager->startProcess();
1103
+                if ($handle === false) {
1104
+                    throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocesserror'));
1105
+                }
1106
+                $this->addNoticeMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocess'));
1107
+                break;
1108
+        }
1109
+    }
1110 1110
 
1111 1111
 
1112 1112
 
1113 1113
 
1114
-	/**
1115
-	 * Returns the singleton instance of the crawler.
1116
-	 *
1117
-	 * @param void
1118
-	 * @return tx_crawler_lib crawler object
1119
-	 * @author Timo Schmidt <[email protected]>
1120
-	 */
1121
-	protected function findCrawler(){
1122
-		if(!$this->crawlerObj instanceof tx_crawler_lib){
1123
-			$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1124
-		}
1125
-		return $this->crawlerObj;
1126
-	}
1114
+    /**
1115
+     * Returns the singleton instance of the crawler.
1116
+     *
1117
+     * @param void
1118
+     * @return tx_crawler_lib crawler object
1119
+     * @author Timo Schmidt <[email protected]>
1120
+     */
1121
+    protected function findCrawler(){
1122
+        if(!$this->crawlerObj instanceof tx_crawler_lib){
1123
+            $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1124
+        }
1125
+        return $this->crawlerObj;
1126
+    }
1127 1127
 
1128 1128
 
1129 1129
 
1130
-	/*****************************
1130
+    /*****************************
1131 1131
 	 *
1132 1132
 	 * General Helper Functions
1133 1133
 	 *
1134 1134
 	 *****************************/
1135 1135
 
1136
-	/**
1137
-	 * This method is used to add a message to the internal queue
1138
-	 *
1139
-	 * NOTE:
1140
-	 * This method is basesd on TYPO3 4.3 or higher!
1141
-	 *
1142
-	 * @param  string  the message itself
1143
-	 * @param  integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error)
1144
-	 *
1145
-	 * @access private
1146
-	 * @return void
1147
-	 */
1148
-	private function addMessage($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) {
1149
-		$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1150
-			'TYPO3\CMS\Core\Messaging\FlashMessage',
1151
-			$message,
1152
-			'',
1153
-			$severity
1154
-		);
1155
-
1156
-		// TODO:
1157
-		/** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
1158
-		$flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
1159
-		$flashMessageService->getMessageQueueByIdentifier()->addMessage($message);
1160
-	}
1161
-
1162
-	/**
1163
-	 * Add notice message to the user interface.
1164
-	 *
1165
-	 * NOTE:
1166
-	 * This method is basesd on TYPO3 4.3 or higher!
1167
-	 *
1168
-	 * @param string The message
1169
-	 *
1170
-	 * @access protected
1171
-	 * @return void
1172
-	 *
1173
-	 * @author Michael Klapper <[email protected]>
1174
-	 */
1175
-	protected function addNoticeMessage($message) {
1176
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
1177
-	}
1178
-
1179
-	/**
1180
-	 * Add error message to the user interface.
1181
-	 *
1182
-	 * NOTE:
1183
-	 * This method is basesd on TYPO3 4.3 or higher!
1184
-	 *
1185
-	 * @param string The message
1186
-	 *
1187
-	 * @access protected
1188
-	 * @return void
1189
-	 *
1190
-	 * @author Michael Klapper <[email protected]>
1191
-	 */
1192
-	protected function addErrorMessage($message) {
1193
-		$this->isErrorDetected = TRUE;
1194
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
1195
-	}
1196
-
1197
-	/**
1198
-	 * Add error message to the user interface.
1199
-	 *
1200
-	 * NOTE:
1201
-	 * This method is basesd on TYPO3 4.3 or higher!
1202
-	 *
1203
-	 * @param string The message
1204
-	 *
1205
-	 * @access protected
1206
-	 * @return void
1207
-	 *
1208
-	 * @author Michael Klapper <[email protected]>
1209
-	 */
1210
-	protected function addWarningMessage($message) {
1211
-		$this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
1212
-	}
1213
-
1214
-	/**
1215
-	 * Create selector box
1216
-	 *
1217
-	 * @param	array		$optArray Options key(value) => label pairs
1218
-	 * @param	string		$name Selector box name
1219
-	 * @param	string		$value Selector box value (array for multiple...)
1220
-	 * @param	boolean		$multiple If set, will draw multiple box.
1136
+    /**
1137
+     * This method is used to add a message to the internal queue
1138
+     *
1139
+     * NOTE:
1140
+     * This method is basesd on TYPO3 4.3 or higher!
1221 1141
      *
1222
-	 * @return	string		HTML select element
1223
-	 */
1224
-	function selectorBox($optArray, $name, $value, $multiple)	{
1142
+     * @param  string  the message itself
1143
+     * @param  integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error)
1144
+     *
1145
+     * @access private
1146
+     * @return void
1147
+     */
1148
+    private function addMessage($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) {
1149
+        $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
1150
+            'TYPO3\CMS\Core\Messaging\FlashMessage',
1151
+            $message,
1152
+            '',
1153
+            $severity
1154
+        );
1155
+
1156
+        // TODO:
1157
+        /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
1158
+        $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
1159
+        $flashMessageService->getMessageQueueByIdentifier()->addMessage($message);
1160
+    }
1161
+
1162
+    /**
1163
+     * Add notice message to the user interface.
1164
+     *
1165
+     * NOTE:
1166
+     * This method is basesd on TYPO3 4.3 or higher!
1167
+     *
1168
+     * @param string The message
1169
+     *
1170
+     * @access protected
1171
+     * @return void
1172
+     *
1173
+     * @author Michael Klapper <[email protected]>
1174
+     */
1175
+    protected function addNoticeMessage($message) {
1176
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
1177
+    }
1178
+
1179
+    /**
1180
+     * Add error message to the user interface.
1181
+     *
1182
+     * NOTE:
1183
+     * This method is basesd on TYPO3 4.3 or higher!
1184
+     *
1185
+     * @param string The message
1186
+     *
1187
+     * @access protected
1188
+     * @return void
1189
+     *
1190
+     * @author Michael Klapper <[email protected]>
1191
+     */
1192
+    protected function addErrorMessage($message) {
1193
+        $this->isErrorDetected = TRUE;
1194
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
1195
+    }
1196
+
1197
+    /**
1198
+     * Add error message to the user interface.
1199
+     *
1200
+     * NOTE:
1201
+     * This method is basesd on TYPO3 4.3 or higher!
1202
+     *
1203
+     * @param string The message
1204
+     *
1205
+     * @access protected
1206
+     * @return void
1207
+     *
1208
+     * @author Michael Klapper <[email protected]>
1209
+     */
1210
+    protected function addWarningMessage($message) {
1211
+        $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
1212
+    }
1213
+
1214
+    /**
1215
+     * Create selector box
1216
+     *
1217
+     * @param	array		$optArray Options key(value) => label pairs
1218
+     * @param	string		$name Selector box name
1219
+     * @param	string		$value Selector box value (array for multiple...)
1220
+     * @param	boolean		$multiple If set, will draw multiple box.
1221
+     *
1222
+     * @return	string		HTML select element
1223
+     */
1224
+    function selectorBox($optArray, $name, $value, $multiple)	{
1225 1225
 
1226
-		$options = array();
1227
-		foreach($optArray as $key => $val)	{
1228
-			$options[] = '
1226
+        $options = array();
1227
+        foreach($optArray as $key => $val)	{
1228
+            $options[] = '
1229 1229
 				<option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value,$key)) || ($multiple && in_array($key,(array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>';
1230
-		}
1230
+        }
1231 1231
 
1232
-		$output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>';
1232
+        $output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>';
1233 1233
 
1234
-		return $output;
1235
-	}
1234
+        return $output;
1235
+    }
1236 1236
 
1237
-	/**
1238
-	 * Activate hooks
1239
-	 *
1240
-	 * @return	void
1241
-	 */
1242
-	function runRefreshHooks() {
1243
-		$crawlerLib = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1244
-		if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'])) {
1245
-			foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'] as $objRef) {
1246
-				$hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
1247
-				if (is_object($hookObj)) {
1248
-					$hookObj->crawler_init($crawlerLib);
1249
-				}
1250
-			}
1251
-		}
1237
+    /**
1238
+     * Activate hooks
1239
+     *
1240
+     * @return	void
1241
+     */
1242
+    function runRefreshHooks() {
1243
+        $crawlerLib = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1244
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'])) {
1245
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'] as $objRef) {
1246
+                $hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef);
1247
+                if (is_object($hookObj)) {
1248
+                    $hookObj->crawler_init($crawlerLib);
1249
+                }
1250
+            }
1251
+        }
1252 1252
 
1253
-	}
1253
+    }
1254 1254
 
1255
-	/**
1256
-	 * Returns the URL to the current module, including $_GET['id'].
1257
-	 *
1258
-	 * @param array $urlParameters optional parameters to add to the URL
1259
-	 * @return string
1260
-	 */
1261
-	protected function getModuleUrl(array $urlParameters = array()) {
1262
-	    if ($this->pObj->id) {
1263
-	        $urlParameters = array_merge($urlParameters, array(
1255
+    /**
1256
+     * Returns the URL to the current module, including $_GET['id'].
1257
+     *
1258
+     * @param array $urlParameters optional parameters to add to the URL
1259
+     * @return string
1260
+     */
1261
+    protected function getModuleUrl(array $urlParameters = array()) {
1262
+        if ($this->pObj->id) {
1263
+            $urlParameters = array_merge($urlParameters, array(
1264 1264
                 'id' => $this->pObj->id
1265 1265
             ));
1266
-	    }
1266
+        }
1267 1267
         return \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('M'), $urlParameters);
1268
-	}
1268
+    }
1269 1269
 }
1270 1270
 
1271 1271
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php'])	{
1272
-	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']);
1272
+    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']);
1273 1273
 }
1274 1274
\ No newline at end of file
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);
@@ -578,16 +578,16 @@  discard block
 block discarded – undo
578 578
 					);
579 579
 
580 580
 						// Get branch beneath:
581
-					if ($this->pObj->MOD_SETTINGS['depth'])	{
581
+					if ($this->pObj->MOD_SETTINGS['depth']) {
582 582
 						$tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], '');
583 583
 					}
584 584
 
585 585
 						// Traverse page tree:
586 586
 					$code = ''; $count = 0;
587
-					foreach($tree->tree as $data)	{
587
+					foreach ($tree->tree as $data) {
588 588
 						$code .= $this->drawLog_addRows(
589 589
 									$data['row'],
590
-									$data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE),
590
+									$data['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], TRUE),
591 591
 									intval($this->pObj->MOD_SETTINGS['itemsPerPage'])
592 592
 								);
593 593
 						if (++$count == 1000) {
@@ -596,13 +596,13 @@  discard block
 block discarded – undo
596 596
 					}
597 597
 				} else {
598 598
 					$code = '';
599
-					$code.= $this->drawLog_addRows(
599
+					$code .= $this->drawLog_addRows(
600 600
 								$showSetId,
601 601
 								'Set ID: '.$showSetId
602 602
 							);
603 603
 				}
604 604
 
605
-				if ($code)	{
605
+				if ($code) {
606 606
 
607 607
 					$output .= '
608 608
 						<br /><br />
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 						<input type="hidden" value="'.$this->pObj->id.'" name="id" />
614 614
 						<input type="hidden" value="'.$showSetId.'" name="setID" />
615 615
 						<br />
616
-						'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'
616
+						'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s', time()).'
617 617
 						<br /><br />
618 618
 
619 619
 
@@ -639,10 +639,10 @@  discard block
 block discarded – undo
639 639
 					</tr>
640 640
 				';
641 641
 
642
-				$cc=0;
643
-				foreach($setList as $set)	{
644
-					$code.= '
645
-						<tr class="bgColor'.($cc%2 ? '-20':'-10').'">
642
+				$cc = 0;
643
+				foreach ($setList as $set) {
644
+					$code .= '
645
+						<tr class="bgColor'.($cc % 2 ? '-20' : '-10').'">
646 646
 							<td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td>
647 647
 							<td>'.$set['count_value'].'</td>
648 648
 							<td>'.\TYPO3\CMS\Backend\Utility\BackendUtility::dateTimeAge($set['scheduled']).'</td>
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 			}
661 661
 		}
662 662
 
663
-		if($this->CSVExport) {
663
+		if ($this->CSVExport) {
664 664
 			$this->outputCsvFile();
665 665
 		}
666 666
 
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 		$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames);
687 687
 
688 688
 			// Data:
689
-		foreach($this->CSVaccu as $row)	{
689
+		foreach ($this->CSVaccu as $row) {
690 690
 			$csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row);
691 691
 		}
692 692
 
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 		Header('Content-Disposition: attachment; filename=CrawlerLog.csv');
697 697
 
698 698
 			// Printing the content of the CSV lines:
699
-		echo implode(chr(13).chr(10),$csvLines);
699
+		echo implode(chr(13).chr(10), $csvLines);
700 700
 
701 701
 			// Exits:
702 702
 		exit;
@@ -712,14 +712,14 @@  discard block
 block discarded – undo
712 712
      *
713 713
 	 * @return string HTML <tr> content (one or more)
714 714
 	 */
715
-	function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) {
715
+	function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage = 10) {
716 716
 
717 717
 			// If Flush button is pressed, flush tables instead of selecting entries:
718 718
 
719
-		if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
719
+		if (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) {
720 720
 			$doFlush = true;
721 721
 			$doFullFlush = false;
722
-		} elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
722
+		} elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) {
723 723
 			$doFlush = true;
724 724
 			$doFullFlush = true;
725 725
 		} else {
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 		}
729 729
 
730 730
 			// Get result:
731
-		if (is_array($pageRow_setId))	{
731
+		if (is_array($pageRow_setId)) {
732 732
 			$res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
733 733
 		} else {
734 734
 			$res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage));
@@ -739,14 +739,14 @@  discard block
 block discarded – undo
739 739
 				+ ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0)
740 740
 				+ ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0);
741 741
 
742
-		if (count($res))	{
742
+		if (count($res)) {
743 743
 				// Traverse parameter combinations:
744 744
 			$c = 0;
745
-			$content='';
746
-			foreach($res as $kk => $vv)	{
745
+			$content = '';
746
+			foreach ($res as $kk => $vv) {
747 747
 
748 748
 					// Title column:
749
-				if (!$c)	{
749
+				if (!$c) {
750 750
 					$titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>';
751 751
 				} else {
752 752
 					$titleClm = '';
@@ -763,16 +763,16 @@  discard block
 block discarded – undo
763 763
 
764 764
 					// Put data into array:
765 765
 				$rowData = array();
766
-				if ($this->pObj->MOD_SETTINGS['log_resultLog'])	{
766
+				if ($this->pObj->MOD_SETTINGS['log_resultLog']) {
767 767
 					$rowData['result_log'] = $resLog;
768 768
 				} else {
769
-					$rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
769
+					$rowData['scheduled'] = ($vv['scheduled'] > 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate');
770 770
 					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
771 771
 				}
772
-				$rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50);
772
+				$rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus, 50);
773 773
 				$rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>';
774 774
 				$rowData['feUserGroupList'] = $parameters['feUserGroupList'];
775
-				$rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : '';
775
+				$rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ', $parameters['procInstructions']) : '';
776 776
 				$rowData['set_id'] = $vv['set_id'];
777 777
 
778 778
 				if ($this->pObj->MOD_SETTINGS['log_feVars']) {
@@ -783,34 +783,34 @@  discard block
 block discarded – undo
783 783
 
784 784
 				$setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID'));
785 785
 
786
-				$refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif';
787
-				if (version_compare(TYPO3_version,'7.0','>=')) {
788
-					$refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif';
786
+				$refreshIcon = $GLOBALS['BACK_PATH'].'gfx/refresh_n.gif';
787
+				if (version_compare(TYPO3_version, '7.0', '>=')) {
788
+					$refreshIcon = $GLOBALS['BACK_PATH'].'sysext/t3skin/extjs/images/grid/refresh.gif';
789 789
 				}
790 790
 
791 791
 					// Put rows together:
792
-				$content.= '
793
-					<tr class="bgColor'.($c%2 ? '-20':'-10').'">
792
+				$content .= '
793
+					<tr class="bgColor'.($c % 2 ? '-20' : '-10').'">
794 794
 						'.$titleClm.'
795
-						<td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)) . '">'.htmlspecialchars($vv['qid']).'</a></td>
796
-						<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>';
797
-				foreach($rowData as $fKey => $value) {
795
+						<td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)).'">'.htmlspecialchars($vv['qid']).'</a></td>
796
+						<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>';
797
+				foreach ($rowData as $fKey => $value) {
798 798
 
799
-					if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey))	{
800
-						$content.= '
799
+					if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url', $fKey)) {
800
+						$content .= '
801 801
 						<td>'.$value.'</td>';
802 802
 					} else {
803
-						$content.= '
803
+						$content .= '
804 804
 						<td>'.nl2br(htmlspecialchars($value)).'</td>';
805 805
 					}
806 806
 				}
807
-				$content.= '
807
+				$content .= '
808 808
 					</tr>';
809 809
 				$c++;
810 810
 
811
-				if ($this->CSVExport)	{
811
+				if ($this->CSVExport) {
812 812
 						// Only for CSV (adding qid and scheduled/exec_time if needed):
813
-					$rowData['result_log'] = implode('// ',explode(chr(10),$resLog));
813
+					$rowData['result_log'] = implode('// ', explode(chr(10), $resLog));
814 814
 					$rowData['qid'] = $vv['qid'];
815 815
 					$rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']);
816 816
 					$rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-';
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 	 *
854 854
 	 * @return	string		Table header
855 855
 	 */
856
-	function drawLog_printTableHeader()	{
856
+	function drawLog_printTableHeader() {
857 857
 
858 858
 		$content = '
859 859
 			<tr class="bgColor5 tableheader">
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
         }
905 905
 
906 906
 	function getResStatus($vv) {
907
-		if ($vv['result_data'])	{
907
+		if ($vv['result_data']) {
908 908
 			$requestContent = unserialize($vv['result_data']);
909 909
 			$requestResult = unserialize($requestContent['content']);
910 910
 			if (is_array($requestResult)) {
@@ -913,9 +913,9 @@  discard block
 block discarded – undo
913 913
 				} else {
914 914
 					$resStatus = implode("\n", $requestResult['errorlog']);
915 915
 				}
916
-				$resLog = is_array($requestResult['log']) ?  implode(chr(10),$requestResult['log']) : '';
916
+				$resLog = is_array($requestResult['log']) ? implode(chr(10), $requestResult['log']) : '';
917 917
 			} else {
918
-				$resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...';
918
+				$resStatus = 'Error: '.substr(preg_replace('/\s+/', ' ', strip_tags($requestContent['content'])), 0, 10000).'...';
919 919
 			}
920 920
 		} else {
921 921
 			$resStatus = '-';
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 	 * @param void
944 944
 	 * @return string
945 945
 	 */
946
-	protected function drawProcessOverviewAction(){
946
+	protected function drawProcessOverviewAction() {
947 947
 
948 948
 		$this->runRefreshHooks();
949 949
 
@@ -957,20 +957,20 @@  discard block
 block discarded – undo
957 957
 			$this->addErrorMessage($e->getMessage());
958 958
 		}
959 959
 
960
-		$offset 	= intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
961
-		$perpage 	= 20;
960
+		$offset = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset'));
961
+		$perpage = 20;
962 962
 
963
-		$processRepository	= new tx_crawler_domain_process_repository();
964
-		$queueRepository	= new tx_crawler_domain_queue_repository();
963
+		$processRepository = new tx_crawler_domain_process_repository();
964
+		$queueRepository = new tx_crawler_domain_queue_repository();
965 965
 
966 966
 		$mode = $this->pObj->MOD_SETTINGS['processListMode'];
967 967
 		if ($mode == 'detail') {
968 968
 			$where = '';
969
-		} elseif($mode == 'simple') {
969
+		} elseif ($mode == 'simple') {
970 970
 			$where = 'active = 1';
971 971
 		}
972 972
 
973
-		$allProcesses 		= $processRepository->findAll('ttl','DESC', $perpage, $offset,$where);
973
+		$allProcesses = $processRepository->findAll('ttl', 'DESC', $perpage, $offset, $where);
974 974
 		$allCount			= $processRepository->countAll($where);
975 975
 
976 976
 		$listView			= new tx_crawler_view_process_list();
@@ -982,10 +982,10 @@  discard block
 block discarded – undo
982 982
 		$listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems());
983 983
 		$listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems());
984 984
 		$listView->setActiveProcessCount($processRepository->countActive());
985
-		$listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1));
985
+		$listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'], 1, 99, 1));
986 986
 		$listView->setMode($mode);
987 987
 
988
-		$paginationView		= new tx_crawler_view_pagination();
988
+		$paginationView = new tx_crawler_view_pagination();
989 989
 		$paginationView->setCurrentOffset($offset);
990 990
 		$paginationView->setPerPage($perpage);
991 991
 		$paginationView->setTotalItemCount($allCount);
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
 
1023 1023
 		$exitCode = 0;
1024 1024
 		$out = array();
1025
-		exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode);
1025
+		exec(escapeshellcmd($this->extensionSettings['phpPath'].' -v'), $out, $exitCode);
1026 1026
 		if ($exitCode > 0) {
1027 1027
 			$this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath'])));
1028 1028
 		}
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 	 * @param void
1086 1086
 	 * @return void
1087 1087
 	 */
1088
-	protected function handleProcessOverviewActions(){
1088
+	protected function handleProcessOverviewActions() {
1089 1089
 
1090 1090
 		$crawler = $this->findCrawler();
1091 1091
 
@@ -1118,8 +1118,8 @@  discard block
 block discarded – undo
1118 1118
 	 * @return tx_crawler_lib crawler object
1119 1119
 	 * @author Timo Schmidt <[email protected]>
1120 1120
 	 */
1121
-	protected function findCrawler(){
1122
-		if(!$this->crawlerObj instanceof tx_crawler_lib){
1121
+	protected function findCrawler() {
1122
+		if (!$this->crawlerObj instanceof tx_crawler_lib) {
1123 1123
 			$this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib');
1124 1124
 		}
1125 1125
 		return $this->crawlerObj;
@@ -1221,15 +1221,15 @@  discard block
 block discarded – undo
1221 1221
      *
1222 1222
 	 * @return	string		HTML select element
1223 1223
 	 */
1224
-	function selectorBox($optArray, $name, $value, $multiple)	{
1224
+	function selectorBox($optArray, $name, $value, $multiple) {
1225 1225
 
1226 1226
 		$options = array();
1227
-		foreach($optArray as $key => $val)	{
1227
+		foreach ($optArray as $key => $val) {
1228 1228
 			$options[] = '
1229
-				<option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value,$key)) || ($multiple && in_array($key,(array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>';
1229
+				<option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value, $key)) || ($multiple && in_array($key, (array) $value)) ? ' selected="selected"' : '').'>'.htmlspecialchars($val).'</option>';
1230 1230
 		}
1231 1231
 
1232
-		$output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>';
1232
+		$output = '<select name="'.htmlspecialchars($name.($multiple ? '[]' : '')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('', $options).'</select>';
1233 1233
 
1234 1234
 		return $output;
1235 1235
 	}
@@ -1268,6 +1268,6 @@  discard block
 block discarded – undo
1268 1268
 	}
1269 1269
 }
1270 1270
 
1271
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php'])	{
1271
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']) {
1272 1272
 	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']);
1273 1273
 }
1274 1274
\ No newline at end of file
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.
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.
ext_autoload.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,24 +1,24 @@
 block discarded – undo
1 1
 <?php
2 2
 $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler');
3 3
 return array(
4
-	'tx_crawler_lib' => $extensionPath . 'class.tx_crawler_lib.php',
5
-	'tx_crawler_cli_flush' => $extensionPath . 'cli/class.tx_crawler_cli_flush.php',
6
-	'tx_crawler_cli' => $extensionPath . 'cli/class.tx_crawler_cli.php',
7
-	'tx_crawler_cli_im' => $extensionPath . 'cli/class.tx_crawler_cli_im.php',
8
-	'tx_crawler_domain_events_dispatcher' => $extensionPath . 'domain/events/class.tx_crawler_domain_events_dispatcher.php',
9
-	'tx_crawler_domain_events_observer' => $extensionPath . 'domain/events/interface.tx_crawler_domain_events_observer.php',
10
-	'tx_crawler_domain_lib_abstract_dbobject' => $extensionPath . 'domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php',
11
-	'tx_crawler_domain_process_manager' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_manager.php',
12
-	'tx_crawler_domain_process' => $extensionPath . 'domain/process/class.tx_crawler_domain_process.php',
13
-	'tx_crawler_domain_process_collection' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_collection.php',
14
-	'tx_crawler_domain_process_repository' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_repository.php',
15
-	'tx_crawler_domain_queue_entry' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_entry.php',
16
-	'tx_crawler_domain_queue_repository' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_repository.php',
17
-	'tx_crawler_domain_reason' => $extensionPath . 'domain/reason/class.tx_crawler_domain_reason.php',
18
-	'tx_crawler_hooks_tsfe' => $extensionPath . 'hooks/class.tx_crawler_hooks_tsfe.php',
19
-	'tx_crawler_hooks_staticFileCacheCreateUri' => $extensionPath . 'hooks/class.tx_crawler_hooks_staticFileCacheCreateUri.php',
20
-	'tx_crawler_hooks_processCleanUp' => $extensionPath . 'hooks/class.tx_crawler_hooks_processCleanUp.php',
21
-	'tx_crawler_modfunc1' => $extensionPath . 'modfunc1/class.tx_crawler_modfunc1.php',
22
-	'tx_crawler_view_pagination' => $extensionPath . 'view/class.tx_crawler_view_pagination.php',
23
-	'tx_crawler_view_process_list' => $extensionPath . 'view/process/class.tx_crawler_view_process_list.php',
4
+    'tx_crawler_lib' => $extensionPath . 'class.tx_crawler_lib.php',
5
+    'tx_crawler_cli_flush' => $extensionPath . 'cli/class.tx_crawler_cli_flush.php',
6
+    'tx_crawler_cli' => $extensionPath . 'cli/class.tx_crawler_cli.php',
7
+    'tx_crawler_cli_im' => $extensionPath . 'cli/class.tx_crawler_cli_im.php',
8
+    'tx_crawler_domain_events_dispatcher' => $extensionPath . 'domain/events/class.tx_crawler_domain_events_dispatcher.php',
9
+    'tx_crawler_domain_events_observer' => $extensionPath . 'domain/events/interface.tx_crawler_domain_events_observer.php',
10
+    'tx_crawler_domain_lib_abstract_dbobject' => $extensionPath . 'domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php',
11
+    'tx_crawler_domain_process_manager' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_manager.php',
12
+    'tx_crawler_domain_process' => $extensionPath . 'domain/process/class.tx_crawler_domain_process.php',
13
+    'tx_crawler_domain_process_collection' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_collection.php',
14
+    'tx_crawler_domain_process_repository' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_repository.php',
15
+    'tx_crawler_domain_queue_entry' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_entry.php',
16
+    'tx_crawler_domain_queue_repository' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_repository.php',
17
+    'tx_crawler_domain_reason' => $extensionPath . 'domain/reason/class.tx_crawler_domain_reason.php',
18
+    'tx_crawler_hooks_tsfe' => $extensionPath . 'hooks/class.tx_crawler_hooks_tsfe.php',
19
+    'tx_crawler_hooks_staticFileCacheCreateUri' => $extensionPath . 'hooks/class.tx_crawler_hooks_staticFileCacheCreateUri.php',
20
+    'tx_crawler_hooks_processCleanUp' => $extensionPath . 'hooks/class.tx_crawler_hooks_processCleanUp.php',
21
+    'tx_crawler_modfunc1' => $extensionPath . 'modfunc1/class.tx_crawler_modfunc1.php',
22
+    'tx_crawler_view_pagination' => $extensionPath . 'view/class.tx_crawler_view_pagination.php',
23
+    'tx_crawler_view_process_list' => $extensionPath . 'view/process/class.tx_crawler_view_process_list.php',
24 24
 );
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,24 +1,24 @@
 block discarded – undo
1 1
 <?php
2 2
 $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler');
3 3
 return array(
4
-	'tx_crawler_lib' => $extensionPath . 'class.tx_crawler_lib.php',
5
-	'tx_crawler_cli_flush' => $extensionPath . 'cli/class.tx_crawler_cli_flush.php',
6
-	'tx_crawler_cli' => $extensionPath . 'cli/class.tx_crawler_cli.php',
7
-	'tx_crawler_cli_im' => $extensionPath . 'cli/class.tx_crawler_cli_im.php',
8
-	'tx_crawler_domain_events_dispatcher' => $extensionPath . 'domain/events/class.tx_crawler_domain_events_dispatcher.php',
9
-	'tx_crawler_domain_events_observer' => $extensionPath . 'domain/events/interface.tx_crawler_domain_events_observer.php',
10
-	'tx_crawler_domain_lib_abstract_dbobject' => $extensionPath . 'domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php',
11
-	'tx_crawler_domain_process_manager' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_manager.php',
12
-	'tx_crawler_domain_process' => $extensionPath . 'domain/process/class.tx_crawler_domain_process.php',
13
-	'tx_crawler_domain_process_collection' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_collection.php',
14
-	'tx_crawler_domain_process_repository' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_repository.php',
15
-	'tx_crawler_domain_queue_entry' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_entry.php',
16
-	'tx_crawler_domain_queue_repository' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_repository.php',
17
-	'tx_crawler_domain_reason' => $extensionPath . 'domain/reason/class.tx_crawler_domain_reason.php',
18
-	'tx_crawler_hooks_tsfe' => $extensionPath . 'hooks/class.tx_crawler_hooks_tsfe.php',
19
-	'tx_crawler_hooks_staticFileCacheCreateUri' => $extensionPath . 'hooks/class.tx_crawler_hooks_staticFileCacheCreateUri.php',
20
-	'tx_crawler_hooks_processCleanUp' => $extensionPath . 'hooks/class.tx_crawler_hooks_processCleanUp.php',
21
-	'tx_crawler_modfunc1' => $extensionPath . 'modfunc1/class.tx_crawler_modfunc1.php',
22
-	'tx_crawler_view_pagination' => $extensionPath . 'view/class.tx_crawler_view_pagination.php',
23
-	'tx_crawler_view_process_list' => $extensionPath . 'view/process/class.tx_crawler_view_process_list.php',
4
+	'tx_crawler_lib' => $extensionPath.'class.tx_crawler_lib.php',
5
+	'tx_crawler_cli_flush' => $extensionPath.'cli/class.tx_crawler_cli_flush.php',
6
+	'tx_crawler_cli' => $extensionPath.'cli/class.tx_crawler_cli.php',
7
+	'tx_crawler_cli_im' => $extensionPath.'cli/class.tx_crawler_cli_im.php',
8
+	'tx_crawler_domain_events_dispatcher' => $extensionPath.'domain/events/class.tx_crawler_domain_events_dispatcher.php',
9
+	'tx_crawler_domain_events_observer' => $extensionPath.'domain/events/interface.tx_crawler_domain_events_observer.php',
10
+	'tx_crawler_domain_lib_abstract_dbobject' => $extensionPath.'domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php',
11
+	'tx_crawler_domain_process_manager' => $extensionPath.'domain/process/class.tx_crawler_domain_process_manager.php',
12
+	'tx_crawler_domain_process' => $extensionPath.'domain/process/class.tx_crawler_domain_process.php',
13
+	'tx_crawler_domain_process_collection' => $extensionPath.'domain/process/class.tx_crawler_domain_process_collection.php',
14
+	'tx_crawler_domain_process_repository' => $extensionPath.'domain/process/class.tx_crawler_domain_process_repository.php',
15
+	'tx_crawler_domain_queue_entry' => $extensionPath.'domain/queue/class.tx_crawler_domain_queue_entry.php',
16
+	'tx_crawler_domain_queue_repository' => $extensionPath.'domain/queue/class.tx_crawler_domain_queue_repository.php',
17
+	'tx_crawler_domain_reason' => $extensionPath.'domain/reason/class.tx_crawler_domain_reason.php',
18
+	'tx_crawler_hooks_tsfe' => $extensionPath.'hooks/class.tx_crawler_hooks_tsfe.php',
19
+	'tx_crawler_hooks_staticFileCacheCreateUri' => $extensionPath.'hooks/class.tx_crawler_hooks_staticFileCacheCreateUri.php',
20
+	'tx_crawler_hooks_processCleanUp' => $extensionPath.'hooks/class.tx_crawler_hooks_processCleanUp.php',
21
+	'tx_crawler_modfunc1' => $extensionPath.'modfunc1/class.tx_crawler_modfunc1.php',
22
+	'tx_crawler_view_pagination' => $extensionPath.'view/class.tx_crawler_view_pagination.php',
23
+	'tx_crawler_view_process_list' => $extensionPath.'view/process/class.tx_crawler_view_process_list.php',
24 24
 );
Please login to merge, or discard this patch.
cli/crawler_multiprocess.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 if (!defined('TYPO3_cliMode')) {
3
-	die('You cannot run this script directly!');
3
+    die('You cannot run this script directly!');
4 4
 }
5 5
 
6 6
 $processManager = new tx_crawler_domain_process_manager();
7 7
 $timeout = isset($_SERVER['argv'][1] ) ? intval($_SERVER['argv'][1]) : 10000;
8 8
 
9 9
 try {
10
-	$processManager->multiProcess($timeout);
10
+    $processManager->multiProcess($timeout);
11 11
 } catch (Exception $e) {
12
-	echo PHP_EOL . $e->getMessage();
12
+    echo PHP_EOL . $e->getMessage();
13 13
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 $processManager = new tx_crawler_domain_process_manager();
7
-$timeout = isset($_SERVER['argv'][1] ) ? intval($_SERVER['argv'][1]) : 10000;
7
+$timeout = isset($_SERVER['argv'][1]) ? intval($_SERVER['argv'][1]) : 10000;
8 8
 
9 9
 try {
10 10
 	$processManager->multiProcess($timeout);
11 11
 } catch (Exception $e) {
12
-	echo PHP_EOL . $e->getMessage();
12
+	echo PHP_EOL.$e->getMessage();
13 13
 }
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.