@@ -209,7 +209,7 @@ |
||
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 |
@@ -91,7 +91,7 @@ discard block |
||
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 |
||
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 | } |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | //if the same page is scheduled for the same time and has not be executed? |
192 | 192 | if ($schedule_timestamp == 0) { |
193 | 193 | //untimed elements need an exec_time with 0 because they can occure multiple times |
194 | - $where = 'page_id=' . $page_uid . ' AND exec_time = 0 AND scheduled=' . $schedule_timestamp; |
|
194 | + $where = 'page_id='.$page_uid.' AND exec_time = 0 AND scheduled='.$schedule_timestamp; |
|
195 | 195 | } else { |
196 | 196 | //timed elementes have got a fixed schedule time, if a record with this time |
197 | 197 | //exists it is maybe queued for the future, or is has been queue for the past and therefore |
198 | 198 | //also been processed. |
199 | - $where = 'page_id=' . $page_uid . ' AND scheduled=' . $schedule_timestamp; |
|
199 | + $where = 'page_id='.$page_uid.' AND scheduled='.$schedule_timestamp; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($GLOBALS['TYPO3_DB']->exec_SELECTquery( |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | $isPageInQueue = false; |
228 | 228 | |
229 | - $whereClause = 'page_id = ' . (integer)$uid; |
|
229 | + $whereClause = 'page_id = '.(integer) $uid; |
|
230 | 230 | |
231 | 231 | if (false !== $unprocessed_only) { |
232 | 232 | $whereClause .= ' AND exec_time = 0'; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | if (false !== $timestamp) { |
240 | - $whereClause .= ' AND scheduled = ' . (integer)$timestamp; |
|
240 | + $whereClause .= ' AND scheduled = '.(integer) $timestamp; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows( |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | { |
267 | 267 | $uid = intval($uid); |
268 | 268 | $query = 'max(scheduled) as latest'; |
269 | - $where = ' page_id = ' . $uid; |
|
269 | + $where = ' page_id = '.$uid; |
|
270 | 270 | |
271 | 271 | if ($future_crawldates_only) { |
272 | - $where .= ' AND scheduled > ' . time(); |
|
272 | + $where .= ' AND scheduled > '.time(); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | if ($unprocessed_only) { |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $limit = $GLOBALS['TYPO3_DB']->fullQuoteStr($limit, 'tx_crawler_queue'); |
303 | 303 | |
304 | 304 | $query = 'scheduled, exec_time, set_id'; |
305 | - $where = ' page_id = ' . $uid; |
|
305 | + $where = ' page_id = '.$uid; |
|
306 | 306 | |
307 | 307 | $limit_query = ($limit) ? $limit : null; |
308 | 308 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | { |
380 | 380 | $qid = intval($qid); |
381 | 381 | $table = 'tx_crawler_queue'; |
382 | - $where = ' qid=' . $qid; |
|
382 | + $where = ' qid='.$qid; |
|
383 | 383 | $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where); |
384 | 384 | } |
385 | 385 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | */ |
408 | 408 | protected function getQueueRepository() |
409 | 409 | { |
410 | - if (! $this->queueRepository instanceof \tx_crawler_domain_queue_repository) { |
|
410 | + if (!$this->queueRepository instanceof \tx_crawler_domain_queue_repository) { |
|
411 | 411 | $this->queueRepository = new \tx_crawler_domain_queue_repository(); |
412 | 412 | } |
413 | 413 |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | /** |
312 | 312 | * Returns a tag for the refresh icon |
313 | 313 | * |
314 | - * @return string |
|
314 | + * @return AOE\Crawler\Utility\ButtonUtility |
|
315 | 315 | */ |
316 | 316 | protected function getRefreshLink() |
317 | 317 | { |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | /** |
326 | 326 | * Returns a link for the panel to enable or disable the crawler |
327 | 327 | * |
328 | - * @return string |
|
328 | + * @return AOE\Crawler\Utility\ButtonUtility |
|
329 | 329 | */ |
330 | 330 | protected function getEnableDisableLink() |
331 | 331 | { |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * |
352 | 352 | * @param void |
353 | 353 | * |
354 | - * @return string a-tag |
|
354 | + * @return AOE\Crawler\Utility\ButtonUtility|null a-tag |
|
355 | 355 | */ |
356 | 356 | protected function getModeLink() |
357 | 357 | { |
@@ -318,7 +318,7 @@ |
||
318 | 318 | return \AOE\Crawler\Utility\ButtonUtility::getLinkButton( |
319 | 319 | 'actions-refresh', |
320 | 320 | $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.refresh'), |
321 | - 'window.location=\'' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_info') . '&SET[crawlaction]=multiprocess&id=' . $this->pageId . '\';' |
|
321 | + 'window.location=\''.\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_info').'&SET[crawlaction]=multiprocess&id='.$this->pageId.'\';' |
|
322 | 322 | ); |
323 | 323 | } |
324 | 324 |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * |
423 | 423 | * @param string $piString PI to test |
424 | 424 | * @param array $incomingProcInstructions Processing instructions |
425 | - * @return boolean TRUE if found |
|
425 | + * @return boolean|null TRUE if found |
|
426 | 426 | */ |
427 | 427 | public function drawURLs_PIfilter($piString, array $incomingProcInstructions) |
428 | 428 | { |
@@ -632,6 +632,9 @@ discard block |
||
632 | 632 | return $baseUrl; |
633 | 633 | } |
634 | 634 | |
635 | + /** |
|
636 | + * @param integer $rootid |
|
637 | + */ |
|
635 | 638 | public function getConfigurationsForBranch($rootid, $depth) |
636 | 639 | { |
637 | 640 | $configurationsForBranch = []; |
@@ -735,6 +738,7 @@ discard block |
||
735 | 738 | * |
736 | 739 | * @param array Array with key (GET var name) and values (value of GET var which is configuration for expansion) |
737 | 740 | * @param integer Current page ID |
741 | + * @param integer $pid |
|
738 | 742 | * @return array Array with key (GET var name) with the value being an array of all possible values for that key. |
739 | 743 | */ |
740 | 744 | public function expandParameters($paramArray, $pid) |
@@ -853,7 +857,7 @@ discard block |
||
853 | 857 | * The number of URLs will be the multiplication of the number of parameter values for each key |
854 | 858 | * |
855 | 859 | * @param array $paramArray Output of expandParameters(): Array with keys (GET var names) and for each an array of values |
856 | - * @param array $urls URLs accumulated in this array (for recursion) |
|
860 | + * @param string[] $urls URLs accumulated in this array (for recursion) |
|
857 | 861 | * @return array URLs accumulated, if number of urls exceed 'maxCompileUrls' it will return false as an error! |
858 | 862 | */ |
859 | 863 | public function compileUrls($paramArray, $urls = []) |
@@ -1033,6 +1037,8 @@ discard block |
||
1033 | 1037 | * @param integer Scheduled-time |
1034 | 1038 | * @param string (optional) configuration hash |
1035 | 1039 | * @param bool (optional) skip inner duplication check |
1040 | + * @param string $url |
|
1041 | + * @param double $tstamp |
|
1036 | 1042 | * @return bool true if the url was added, false if it already existed |
1037 | 1043 | */ |
1038 | 1044 | public function addUrl( |
@@ -1503,6 +1509,7 @@ discard block |
||
1503 | 1509 | |
1504 | 1510 | /** |
1505 | 1511 | * @param message |
1512 | + * @param string $message |
|
1506 | 1513 | */ |
1507 | 1514 | protected function log($message) |
1508 | 1515 | { |
@@ -1517,7 +1524,7 @@ discard block |
||
1517 | 1524 | * @param array $url |
1518 | 1525 | * @param string $crawlerId |
1519 | 1526 | * |
1520 | - * @return array |
|
1527 | + * @return string[] |
|
1521 | 1528 | */ |
1522 | 1529 | protected function buildRequestHeaderArray(array $url, $crawlerId) |
1523 | 1530 | { |
@@ -1626,6 +1633,12 @@ discard block |
||
1626 | 1633 | * @param boolean If set (and submitcrawlUrls is false) will fill $downloadUrls with entries) |
1627 | 1634 | * @param array Array of processing instructions |
1628 | 1635 | * @param array Array of configuration keys |
1636 | + * @param integer $id |
|
1637 | + * @param integer $depth |
|
1638 | + * @param integer $scheduledTime |
|
1639 | + * @param integer $reqMinute |
|
1640 | + * @param boolean $submitCrawlUrls |
|
1641 | + * @param boolean $downloadCrawlUrls |
|
1629 | 1642 | * @return string HTML code |
1630 | 1643 | */ |
1631 | 1644 | public function getPageTreeAndUrls( |
@@ -1773,6 +1786,7 @@ discard block |
||
1773 | 1786 | * |
1774 | 1787 | * @param array Page row |
1775 | 1788 | * @param string Page icon and title for row |
1789 | + * @param string $pageTitleAndIcon |
|
1776 | 1790 | * @return string HTML <tr> content (one or more) |
1777 | 1791 | */ |
1778 | 1792 | public function drawURLs_addRowsForPage(array $pageRow, $pageTitleAndIcon) |
@@ -2064,7 +2078,7 @@ discard block |
||
2064 | 2078 | /** |
2065 | 2079 | * Function executed by crawler_im.php cli script. |
2066 | 2080 | * |
2067 | - * @return bool |
|
2081 | + * @return null|boolean |
|
2068 | 2082 | */ |
2069 | 2083 | public function CLI_main_flush() |
2070 | 2084 | { |
@@ -2123,7 +2137,7 @@ discard block |
||
2123 | 2137 | * @param int $countInARun |
2124 | 2138 | * @param int $sleepTime |
2125 | 2139 | * @param int $sleepAfterFinish |
2126 | - * @return string Status message |
|
2140 | + * @return integer Status message |
|
2127 | 2141 | */ |
2128 | 2142 | public function CLI_run($countInARun, $sleepTime, $sleepAfterFinish) |
2129 | 2143 | { |
@@ -2398,6 +2412,7 @@ discard block |
||
2398 | 2412 | * Used to determine timeouts and to ensure a proper cleanup if there's a timeout |
2399 | 2413 | * |
2400 | 2414 | * @param string identification string for the process |
2415 | + * @param string $pid |
|
2401 | 2416 | * @return boolean determines if the process is still active / has resources |
2402 | 2417 | * |
2403 | 2418 | * FIXME: Please remove Transaction, not needed as only a select query. |
@@ -2438,7 +2453,7 @@ discard block |
||
2438 | 2453 | /** |
2439 | 2454 | * @param bool $get_as_float |
2440 | 2455 | * |
2441 | - * @return mixed |
|
2456 | + * @return string |
|
2442 | 2457 | */ |
2443 | 2458 | protected function microtime($get_as_float = false) |
2444 | 2459 | { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | public $setID = 0; |
33 | 33 | public $processID = ''; |
34 | - public $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 | + public $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. |
|
35 | 35 | |
36 | 36 | public $duplicateTrack = []; |
37 | 37 | public $downloadUrls = []; |
@@ -69,9 +69,9 @@ discard block |
||
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 | /** |
@@ -355,14 +355,14 @@ discard block |
||
355 | 355 | if ($vv['subCfg']['cHash']) { |
356 | 356 | /* @var $cacheHash \TYPO3\CMS\Frontend\Page\CacheHashCalculator */ |
357 | 357 | $cacheHash = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Frontend\Page\CacheHashCalculator'); |
358 | - $urlQuery .= '&cHash=' . $cacheHash->generateForParameters($urlQuery); |
|
358 | + $urlQuery .= '&cHash='.$cacheHash->generateForParameters($urlQuery); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | // Create key by which to determine unique-ness: |
362 | 362 | $uKey = $urlQuery.'|'.$vv['subCfg']['userGroups'].'|'.$vv['subCfg']['baseUrl'].'|'.$vv['subCfg']['procInstrFilter']; |
363 | 363 | |
364 | 364 | // realurl support (thanks to Ingo Renner) |
365 | - $urlQuery = 'index.php' . $urlQuery; |
|
365 | + $urlQuery = 'index.php'.$urlQuery; |
|
366 | 366 | if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('realurl') && $vv['subCfg']['realurl']) { |
367 | 367 | $params = [ |
368 | 368 | 'LD' => [ |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $urlList = '['.date('d.m.y H:i', $schTime).'] '.htmlspecialchars($urlQuery); |
387 | 387 | $this->urlList[] = '['.date('d.m.y H:i', $schTime).'] '.$urlQuery; |
388 | 388 | |
389 | - $theUrl = ($vv['subCfg']['baseUrl'] ? $vv['subCfg']['baseUrl'] : \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL')) . $urlQuery; |
|
389 | + $theUrl = ($vv['subCfg']['baseUrl'] ? $vv['subCfg']['baseUrl'] : \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL')).$urlQuery; |
|
390 | 390 | |
391 | 391 | // Submit for crawling! |
392 | 392 | if ($submitCrawlUrls) { |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | if (!is_array($values)) { |
489 | 489 | |
490 | 490 | // Sub configuration for a single configuration string: |
491 | - $subCfg = (array)$crawlerCfg['paramSets.'][$key.'.']; |
|
491 | + $subCfg = (array) $crawlerCfg['paramSets.'][$key.'.']; |
|
492 | 492 | $subCfg['key'] = $key; |
493 | 493 | |
494 | 494 | if (strcmp($subCfg['procInstrFilter'], '')) { |
@@ -535,7 +535,7 @@ discard block |
||
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)) { |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | $res[$key]['subCfg'] = $subCfg; |
582 | 582 | $res[$key]['paramParsed'] = $this->parseParams($configurationRecord['configuration']); |
583 | 583 | $res[$key]['paramExpanded'] = $this->expandParameters($res[$key]['paramParsed'], $id); |
584 | - $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], ['?id=' . $id]); |
|
584 | + $res[$key]['URLs'] = $this->compileUrls($res[$key]['paramExpanded'], ['?id='.$id]); |
|
585 | 585 | $res[$key]['origin'] = 'tx_crawler_configuration_'.$configurationRecord['uid']; |
586 | 586 | } |
587 | 587 | } |
@@ -620,13 +620,13 @@ discard block |
||
620 | 620 | $res = $this->db->exec_SELECTquery( |
621 | 621 | '*', |
622 | 622 | 'sys_domain', |
623 | - 'uid = '.$sysDomainUid . |
|
624 | - \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('sys_domain') . |
|
623 | + 'uid = '.$sysDomainUid. |
|
624 | + \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('sys_domain'). |
|
625 | 625 | \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_domain') |
626 | 626 | ); |
627 | 627 | $row = $this->db->sql_fetch_assoc($res); |
628 | 628 | if ($row['domainName'] != '') { |
629 | - return $urlScheme . '://' . $row['domainName']; |
|
629 | + return $urlScheme.'://'.$row['domainName']; |
|
630 | 630 | } |
631 | 631 | } |
632 | 632 | return $baseUrl; |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | if (!is_array($value)) { |
645 | 645 | continue; |
646 | 646 | } |
647 | - $configurationsForBranch[] = substr($key, -1) == '.'?substr($key, 0, -1):$key; |
|
647 | + $configurationsForBranch[] = substr($key, -1) == '.' ?substr($key, 0, -1) : $key; |
|
648 | 648 | } |
649 | 649 | } |
650 | 650 | } |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | /* @var \TYPO3\CMS\Backend\Tree\View\PageTreeView */ |
657 | 657 | $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView'); |
658 | 658 | $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); |
659 | - $tree->init('AND ' . $perms_clause); |
|
659 | + $tree->init('AND '.$perms_clause); |
|
660 | 660 | $tree->getTree($rootid, $depth, ''); |
661 | 661 | foreach ($tree->tree as $node) { |
662 | 662 | $pids[] = $node['row']['uid']; |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | '*', |
667 | 667 | 'tx_crawler_configuration', |
668 | 668 | 'pid IN ('.implode(',', $pids).') '. |
669 | - \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_crawler_configuration') . |
|
669 | + \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_crawler_configuration'). |
|
670 | 670 | \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_crawler_configuration').' '. |
671 | 671 | \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('tx_crawler_configuration').' ' |
672 | 672 | ); |
@@ -766,8 +766,8 @@ discard block |
||
766 | 766 | } |
767 | 767 | |
768 | 768 | // Traverse range, add values: |
769 | - $runAwayBrake = 1000; // Limit to size of range! |
|
770 | - for ($a = $reg[1]; $a <= $reg[2];$a++) { |
|
769 | + $runAwayBrake = 1000; // Limit to size of range! |
|
770 | + for ($a = $reg[1]; $a <= $reg[2]; $a++) { |
|
771 | 771 | $paramArray[$p][] = $a; |
772 | 772 | $runAwayBrake--; |
773 | 773 | if ($runAwayBrake <= 0) { |
@@ -797,16 +797,16 @@ discard block |
||
797 | 797 | $transOrigPointerField = $TCA[$subpartParams['_TABLE']]['ctrl']['transOrigPointerField']; |
798 | 798 | |
799 | 799 | if ($subpartParams['_ENABLELANG'] && $transOrigPointerField) { |
800 | - $andWhereLanguage = ' AND ' . $this->db->quoteStr($transOrigPointerField, $subpartParams['_TABLE']) .' <= 0 '; |
|
800 | + $andWhereLanguage = ' AND '.$this->db->quoteStr($transOrigPointerField, $subpartParams['_TABLE']).' <= 0 '; |
|
801 | 801 | } |
802 | 802 | |
803 | - $where = $this->db->quoteStr($pidField, $subpartParams['_TABLE']) .'='.intval($lookUpPid) . ' ' . |
|
804 | - $andWhereLanguage . $where; |
|
803 | + $where = $this->db->quoteStr($pidField, $subpartParams['_TABLE']).'='.intval($lookUpPid).' '. |
|
804 | + $andWhereLanguage.$where; |
|
805 | 805 | |
806 | 806 | $rows = $this->db->exec_SELECTgetRows( |
807 | 807 | $fieldName, |
808 | - $subpartParams['_TABLE'] . $addTable, |
|
809 | - $where . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($subpartParams['_TABLE']), |
|
808 | + $subpartParams['_TABLE'].$addTable, |
|
809 | + $where.\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($subpartParams['_TABLE']), |
|
810 | 810 | '', |
811 | 811 | '', |
812 | 812 | '', |
@@ -915,13 +915,13 @@ discard block |
||
915 | 915 | |
916 | 916 | // FIXME: Write unit test that ensures that the right records are deleted. |
917 | 917 | if ($doFlush) { |
918 | - $this->flushQueue(($doFullFlush?'1=1':('page_id='.intval($id))) .$addWhere); |
|
918 | + $this->flushQueue(($doFullFlush ? '1=1' : ('page_id='.intval($id))).$addWhere); |
|
919 | 919 | return []; |
920 | 920 | } else { |
921 | 921 | return $this->db->exec_SELECTgetRows( |
922 | 922 | '*', |
923 | 923 | 'tx_crawler_queue', |
924 | - 'page_id=' . intval($id) . $addWhere, |
|
924 | + 'page_id='.intval($id).$addWhere, |
|
925 | 925 | '', |
926 | 926 | 'scheduled DESC', |
927 | 927 | (intval($itemsPerPage) > 0 ? intval($itemsPerPage) : '') |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | } |
955 | 955 | // FIXME: Write unit test that ensures that the right records are deleted. |
956 | 956 | if ($doFlush) { |
957 | - $this->flushQueue($doFullFlush?'':('set_id='.intval($set_id).$addWhere)); |
|
957 | + $this->flushQueue($doFullFlush ? '' : ('set_id='.intval($set_id).$addWhere)); |
|
958 | 958 | return []; |
959 | 959 | } else { |
960 | 960 | return $this->db->exec_SELECTgetRows( |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | */ |
977 | 977 | protected function flushQueue($where = '') |
978 | 978 | { |
979 | - $realWhere = strlen($where) > 0?$where:'1=1'; |
|
979 | + $realWhere = strlen($where) > 0 ? $where : '1=1'; |
|
980 | 980 | |
981 | 981 | if (tx_crawler_domain_events_dispatcher::getInstance()->hasObserver('queueEntryFlush')) { |
982 | 982 | $groups = $this->db->exec_SELECTgetRows('DISTINCT set_id', 'tx_crawler_queue', $realWhere); |
@@ -1123,13 +1123,13 @@ discard block |
||
1123 | 1123 | if ($this->extensionSettings['enableTimeslot']) { |
1124 | 1124 | $timeBegin = $currentTime - 100; |
1125 | 1125 | $timeEnd = $currentTime + 100; |
1126 | - $where = ' ((scheduled BETWEEN '.$timeBegin.' AND '.$timeEnd.' ) OR scheduled <= '. $currentTime.') '; |
|
1126 | + $where = ' ((scheduled BETWEEN '.$timeBegin.' AND '.$timeEnd.' ) OR scheduled <= '.$currentTime.') '; |
|
1127 | 1127 | } else { |
1128 | - $where = 'scheduled <= ' . $currentTime; |
|
1128 | + $where = 'scheduled <= '.$currentTime; |
|
1129 | 1129 | } |
1130 | 1130 | } elseif ($tstamp > $currentTime) { |
1131 | 1131 | //entry with a timestamp in the future need to have the same schedule time |
1132 | - $where = 'scheduled = ' . $tstamp ; |
|
1132 | + $where = 'scheduled = '.$tstamp; |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | if (!empty($where)) { |
@@ -1137,10 +1137,10 @@ discard block |
||
1137 | 1137 | 'qid', |
1138 | 1138 | 'tx_crawler_queue', |
1139 | 1139 | $where. |
1140 | - ' AND NOT exec_time' . |
|
1140 | + ' AND NOT exec_time'. |
|
1141 | 1141 | ' AND NOT process_id '. |
1142 | 1142 | ' AND page_id='.intval($fieldArray['page_id']). |
1143 | - ' AND parameters_hash = ' . $this->db->fullQuoteStr($fieldArray['parameters_hash'], 'tx_crawler_queue') |
|
1143 | + ' AND parameters_hash = '.$this->db->fullQuoteStr($fieldArray['parameters_hash'], 'tx_crawler_queue') |
|
1144 | 1144 | ); |
1145 | 1145 | |
1146 | 1146 | if (is_array($result)) { |
@@ -1180,13 +1180,13 @@ discard block |
||
1180 | 1180 | { |
1181 | 1181 | $ret = 0; |
1182 | 1182 | if ($this->debugMode) { |
1183 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devlog('crawler-readurl start ' . microtime(true), __FUNCTION__); |
|
1183 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devlog('crawler-readurl start '.microtime(true), __FUNCTION__); |
|
1184 | 1184 | } |
1185 | 1185 | // Get entry: |
1186 | 1186 | list($queueRec) = $this->db->exec_SELECTgetRows( |
1187 | 1187 | '*', |
1188 | 1188 | 'tx_crawler_queue', |
1189 | - 'qid=' . intval($queueId) . ($force ? '' : ' AND exec_time=0 AND process_scheduled > 0') |
|
1189 | + 'qid='.intval($queueId).($force ? '' : ' AND exec_time=0 AND process_scheduled > 0') |
|
1190 | 1190 | ); |
1191 | 1191 | |
1192 | 1192 | if (!is_array($queueRec)) { |
@@ -1195,10 +1195,10 @@ discard block |
||
1195 | 1195 | |
1196 | 1196 | $parameters = unserialize($queueRec['parameters']); |
1197 | 1197 | if ($parameters['rootTemplatePid']) { |
1198 | - $this->initTSFE((int)$parameters['rootTemplatePid']); |
|
1198 | + $this->initTSFE((int) $parameters['rootTemplatePid']); |
|
1199 | 1199 | } else { |
1200 | 1200 | \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog( |
1201 | - 'Page with (' . $queueRec['page_id'] . ') could not be crawled, please check your crawler configuration. Perhaps no Root Template Pid is set', |
|
1201 | + 'Page with ('.$queueRec['page_id'].') could not be crawled, please check your crawler configuration. Perhaps no Root Template Pid is set', |
|
1202 | 1202 | 'crawler', |
1203 | 1203 | \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_WARNING |
1204 | 1204 | ); |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | //if mulitprocessing is used we need to store the id of the process which has handled this entry |
1218 | 1218 | $field_array['process_id_completed'] = $this->processID; |
1219 | 1219 | } |
1220 | - $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid=' . intval($queueId), $field_array); |
|
1220 | + $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid='.intval($queueId), $field_array); |
|
1221 | 1221 | |
1222 | 1222 | $result = $this->readUrl_exec($queueRec); |
1223 | 1223 | $resultData = unserialize($result['content']); |
@@ -1248,10 +1248,10 @@ discard block |
||
1248 | 1248 | [$queueId, &$field_array] |
1249 | 1249 | ); |
1250 | 1250 | |
1251 | - $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid=' . intval($queueId), $field_array); |
|
1251 | + $this->db->exec_UPDATEquery('tx_crawler_queue', 'qid='.intval($queueId), $field_array); |
|
1252 | 1252 | |
1253 | 1253 | if ($this->debugMode) { |
1254 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devlog('crawler-readurl stop ' . microtime(true), __FUNCTION__); |
|
1254 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devlog('crawler-readurl stop '.microtime(true), __FUNCTION__); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | return $ret; |
@@ -1348,7 +1348,7 @@ discard block |
||
1348 | 1348 | return false; |
1349 | 1349 | } |
1350 | 1350 | |
1351 | - if (!in_array($url['scheme'], ['','http','https'])) { |
|
1351 | + if (!in_array($url['scheme'], ['', 'http', 'https'])) { |
|
1352 | 1352 | if (TYPO3_DLOG) { |
1353 | 1353 | \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Scheme does not match for url "%s"', $url), 'crawler', 4, ['crawlerId' => $crawlerId]); |
1354 | 1354 | } |
@@ -1368,14 +1368,14 @@ discard block |
||
1368 | 1368 | |
1369 | 1369 | if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse'] && $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']) { |
1370 | 1370 | $rurl = parse_url($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']); |
1371 | - $url['path'] = $url['scheme'] . '://' . $url['host'] . ($url['port'] > 0 ? ':' . $url['port'] : '') . $url['path']; |
|
1371 | + $url['path'] = $url['scheme'].'://'.$url['host'].($url['port'] > 0 ? ':'.$url['port'] : '').$url['path']; |
|
1372 | 1372 | $reqHeaders = $this->buildRequestHeaderArray($url, $crawlerId); |
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | $host = $rurl['host']; |
1376 | 1376 | |
1377 | 1377 | if ($url['scheme'] == 'https') { |
1378 | - $host = 'ssl://' . $host; |
|
1378 | + $host = 'ssl://'.$host; |
|
1379 | 1379 | $port = ($rurl['port'] > 0) ? $rurl['port'] : 443; |
1380 | 1380 | } else { |
1381 | 1381 | $port = ($rurl['port'] > 0) ? $rurl['port'] : 80; |
@@ -1399,13 +1399,13 @@ discard block |
||
1399 | 1399 | fclose($fp); |
1400 | 1400 | |
1401 | 1401 | $time = microtime(true) - $startTime; |
1402 | - $this->log($originalUrl .' '.$time); |
|
1402 | + $this->log($originalUrl.' '.$time); |
|
1403 | 1403 | |
1404 | 1404 | // Implode content and headers: |
1405 | 1405 | $result = [ |
1406 | 1406 | 'request' => $msg, |
1407 | 1407 | 'headers' => implode('', $d['headers']), |
1408 | - 'content' => implode('', (array)$d['content']) |
|
1408 | + 'content' => implode('', (array) $d['content']) |
|
1409 | 1409 | ]; |
1410 | 1410 | |
1411 | 1411 | if (($this->extensionSettings['follow30x']) && ($newUrl = $this->getRequestUrlFrom302Header($d['headers'], $url['user'], $url['pass']))) { |
@@ -1450,8 +1450,8 @@ discard block |
||
1450 | 1450 | |
1451 | 1451 | // Base path must be '/<pathSegements>/': |
1452 | 1452 | if ($frontendBasePath != '/') { |
1453 | - $frontendBasePath = '/' . ltrim($frontendBasePath, '/'); |
|
1454 | - $frontendBasePath = rtrim($frontendBasePath, '/') . '/'; |
|
1453 | + $frontendBasePath = '/'.ltrim($frontendBasePath, '/'); |
|
1454 | + $frontendBasePath = rtrim($frontendBasePath, '/').'/'; |
|
1455 | 1455 | } |
1456 | 1456 | |
1457 | 1457 | return $frontendBasePath; |
@@ -1507,7 +1507,7 @@ discard block |
||
1507 | 1507 | protected function log($message) |
1508 | 1508 | { |
1509 | 1509 | if (!empty($this->extensionSettings['logFileName'])) { |
1510 | - @file_put_contents($this->extensionSettings['logFileName'], date('Ymd His') . ' ' . $message . PHP_EOL, FILE_APPEND); |
|
1510 | + @file_put_contents($this->extensionSettings['logFileName'], date('Ymd His').' '.$message.PHP_EOL, FILE_APPEND); |
|
1511 | 1511 | } |
1512 | 1512 | } |
1513 | 1513 | |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | } |
1530 | 1530 | $reqHeaders[] = 'Connection: close'; |
1531 | 1531 | if ($url['user'] != '') { |
1532 | - $reqHeaders[] = 'Authorization: Basic '. base64_encode($url['user'].':'.$url['pass']); |
|
1532 | + $reqHeaders[] = 'Authorization: Basic '.base64_encode($url['user'].':'.$url['pass']); |
|
1533 | 1533 | } |
1534 | 1534 | $reqHeaders[] = 'X-T3crawler: '.$crawlerId; |
1535 | 1535 | $reqHeaders[] = 'User-Agent: TYPO3 crawler'; |
@@ -1568,9 +1568,9 @@ discard block |
||
1568 | 1568 | if (!($tmp = parse_url($header['Location']))) { |
1569 | 1569 | return false; |
1570 | 1570 | } |
1571 | - $newUrl = $tmp['scheme'] . '://' . $user . ':' . $pass . '@' . $tmp['host'] . $tmp['path']; |
|
1571 | + $newUrl = $tmp['scheme'].'://'.$user.':'.$pass.'@'.$tmp['host'].$tmp['path']; |
|
1572 | 1572 | if ($tmp['query'] != '') { |
1573 | - $newUrl .= '?' . $tmp['query']; |
|
1573 | + $newUrl .= '?'.$tmp['query']; |
|
1574 | 1574 | } |
1575 | 1575 | } else { |
1576 | 1576 | $newUrl = $header['Location']; |
@@ -1658,7 +1658,7 @@ discard block |
||
1658 | 1658 | /* @var $tree \TYPO3\CMS\Backend\Tree\View\PageTreeView */ |
1659 | 1659 | $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView'); |
1660 | 1660 | $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); |
1661 | - $tree->init('AND ' . $perms_clause); |
|
1661 | + $tree->init('AND '.$perms_clause); |
|
1662 | 1662 | |
1663 | 1663 | $pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($id, $perms_clause); |
1664 | 1664 | |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | |
1709 | 1709 | $code .= $this->drawURLs_addRowsForPage( |
1710 | 1710 | $data['row'], |
1711 | - $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], true) |
|
1711 | + $data['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], true) |
|
1712 | 1712 | ); |
1713 | 1713 | } |
1714 | 1714 | |
@@ -1733,7 +1733,7 @@ discard block |
||
1733 | 1733 | if (!empty($excludeString)) { |
1734 | 1734 | /* @var $tree \TYPO3\CMS\Backend\Tree\View\PageTreeView */ |
1735 | 1735 | $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView'); |
1736 | - $tree->init('AND ' . $this->backendUser->getPagePermsClause(1)); |
|
1736 | + $tree->init('AND '.$this->backendUser->getPagePermsClause(1)); |
|
1737 | 1737 | |
1738 | 1738 | $excludeParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $excludeString); |
1739 | 1739 | |
@@ -1853,17 +1853,17 @@ discard block |
||
1853 | 1853 | |
1854 | 1854 | // Compile row: |
1855 | 1855 | $content .= ' |
1856 | - <tr class="bgColor' . ($c % 2 ? '-20':'-10') . '"> |
|
1857 | - ' . $titleClm . ' |
|
1858 | - <td>' . htmlspecialchars($confKey) . '</td> |
|
1859 | - <td>' . nl2br(htmlspecialchars(rawurldecode(trim(str_replace('&', chr(10) . '&', \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $confArray['paramParsed'])))))) . '</td> |
|
1856 | + <tr class="bgColor' . ($c % 2 ? '-20' : '-10').'"> |
|
1857 | + ' . $titleClm.' |
|
1858 | + <td>' . htmlspecialchars($confKey).'</td> |
|
1859 | + <td>' . nl2br(htmlspecialchars(rawurldecode(trim(str_replace('&', chr(10).'&', \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $confArray['paramParsed'])))))).'</td> |
|
1860 | 1860 | <td>'.$paramExpanded.'</td> |
1861 | - <td nowrap="nowrap">' . $urlList . '</td> |
|
1862 | - <td nowrap="nowrap">' . $optionValues . '</td> |
|
1863 | - <td nowrap="nowrap">' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($confArray['subCfg']['procInstrParams.']) . '</td> |
|
1861 | + <td nowrap="nowrap">' . $urlList.'</td> |
|
1862 | + <td nowrap="nowrap">' . $optionValues.'</td> |
|
1863 | + <td nowrap="nowrap">' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($confArray['subCfg']['procInstrParams.']).'</td> |
|
1864 | 1864 | </tr>'; |
1865 | 1865 | } else { |
1866 | - $content .= '<tr class="bgColor'.($c % 2 ? '-20':'-10') . '"> |
|
1866 | + $content .= '<tr class="bgColor'.($c % 2 ? '-20' : '-10').'"> |
|
1867 | 1867 | '.$titleClm.' |
1868 | 1868 | <td>'.htmlspecialchars($confKey).'</td> |
1869 | 1869 | <td colspan="5"><em>No entries</em> (Page is excluded in this configuration)</td> |
@@ -2011,7 +2011,7 @@ discard block |
||
2011 | 2011 | tx_crawler_domain_events_dispatcher::getInstance()->post( |
2012 | 2012 | 'invokeQueueChange', |
2013 | 2013 | $this->setID, |
2014 | - [ 'reason' => $reason ] |
|
2014 | + ['reason' => $reason] |
|
2015 | 2015 | ); |
2016 | 2016 | } |
2017 | 2017 | |
@@ -2111,7 +2111,7 @@ discard block |
||
2111 | 2111 | * @param tx_crawler_cli_im $cliObj Command line object |
2112 | 2112 | * @return mixed Array of keys or null if no keys found |
2113 | 2113 | */ |
2114 | - protected function getConfigurationKeys(tx_crawler_cli_im &$cliObj) |
|
2114 | + protected function getConfigurationKeys(tx_crawler_cli_im & $cliObj) |
|
2115 | 2115 | { |
2116 | 2116 | $parameter = trim($cliObj->cli_argValue('-conf')); |
2117 | 2117 | return ($parameter != '' ? \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $parameter) : []); |
@@ -2138,7 +2138,7 @@ discard block |
||
2138 | 2138 | $purgeDate = $this->getCurrentTime() - 24 * 60 * 60 * intval($this->extensionSettings['purgeQueueDays']); |
2139 | 2139 | $del = $this->db->exec_DELETEquery( |
2140 | 2140 | 'tx_crawler_queue', |
2141 | - 'exec_time!=0 AND exec_time<' . $purgeDate |
|
2141 | + 'exec_time!=0 AND exec_time<'.$purgeDate |
|
2142 | 2142 | ); |
2143 | 2143 | } |
2144 | 2144 | |
@@ -2198,7 +2198,7 @@ discard block |
||
2198 | 2198 | $result |= $this->readUrl($r['qid']); |
2199 | 2199 | |
2200 | 2200 | $counter++; |
2201 | - usleep(intval($sleepTime)); // Just to relax the system |
|
2201 | + usleep(intval($sleepTime)); // Just to relax the system |
|
2202 | 2202 | |
2203 | 2203 | // if during the start and the current read url the cli has been disable we need to return from the function |
2204 | 2204 | // mark the process NOT as ended. |
@@ -2211,7 +2211,7 @@ discard block |
||
2211 | 2211 | |
2212 | 2212 | //TODO might need an additional returncode |
2213 | 2213 | $result |= self::CLI_STATUS_ABORTED; |
2214 | - break; //possible timeout |
|
2214 | + break; //possible timeout |
|
2215 | 2215 | } |
2216 | 2216 | } |
2217 | 2217 | |
@@ -2327,7 +2327,7 @@ discard block |
||
2327 | 2327 | } |
2328 | 2328 | |
2329 | 2329 | if (!count($releaseIds) > 0) { |
2330 | - return false; //nothing to release |
|
2330 | + return false; //nothing to release |
|
2331 | 2331 | } |
2332 | 2332 | |
2333 | 2333 | if (!$withinLock) { |
@@ -2471,7 +2471,7 @@ discard block |
||
2471 | 2471 | |
2472 | 2472 | $cmd = escapeshellcmd($this->extensionSettings['phpPath']); |
2473 | 2473 | $cmd .= ' '; |
2474 | - $cmd .= escapeshellarg(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler') . 'cli/bootstrap.php'); |
|
2474 | + $cmd .= escapeshellarg(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler').'cli/bootstrap.php'); |
|
2475 | 2475 | $cmd .= ' '; |
2476 | 2476 | $cmd .= escapeshellarg($this->getFrontendBasePath()); |
2477 | 2477 | $cmd .= ' '; |
@@ -2481,10 +2481,10 @@ discard block |
||
2481 | 2481 | |
2482 | 2482 | $startTime = microtime(true); |
2483 | 2483 | $content = $this->executeShellCommand($cmd); |
2484 | - $this->log($url . ' ' . (microtime(true) - $startTime)); |
|
2484 | + $this->log($url.' '.(microtime(true) - $startTime)); |
|
2485 | 2485 | |
2486 | 2486 | $result = [ |
2487 | - 'request' => implode("\r\n", $requestHeaders) . "\r\n\r\n", |
|
2487 | + 'request' => implode("\r\n", $requestHeaders)."\r\n\r\n", |
|
2488 | 2488 | 'headers' => '', |
2489 | 2489 | 'content' => $content |
2490 | 2490 | ]; |
@@ -2505,7 +2505,7 @@ discard block |
||
2505 | 2505 | $scheduledAgeInSeconds = $this->extensionSettings['cleanUpScheduledAge'] * 86400; |
2506 | 2506 | |
2507 | 2507 | $now = time(); |
2508 | - $condition = '(exec_time<>0 AND exec_time<' . ($now - $processedAgeInSeconds) . ') OR scheduled<=' . ($now - $scheduledAgeInSeconds); |
|
2508 | + $condition = '(exec_time<>0 AND exec_time<'.($now - $processedAgeInSeconds).') OR scheduled<='.($now - $scheduledAgeInSeconds); |
|
2509 | 2509 | $this->flushQueue($condition); |
2510 | 2510 | } |
2511 | 2511 |
@@ -1,24 +1,24 @@ |
||
1 | 1 | <?php |
2 | 2 | $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler'); |
3 | 3 | return [ |
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 | ]; |
@@ -201,15 +201,15 @@ discard block |
||
201 | 201 | 'index.php' |
202 | 202 | ); |
203 | 203 | |
204 | - $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : ''; |
|
204 | + $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : ''; |
|
205 | 205 | |
206 | 206 | $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
207 | 207 | |
208 | 208 | $h_func .= '<hr/>'. |
209 | - $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) . ' - ' . |
|
210 | - $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) . ' - ' . |
|
211 | - $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) . ' - ' . |
|
212 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' . |
|
209 | + $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).' - '. |
|
210 | + $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).' - '. |
|
211 | + $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).' - '. |
|
212 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': '. |
|
213 | 213 | \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
214 | 214 | $this->pObj->id, |
215 | 215 | 'SET[itemsPerPage]', |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $theOutput = $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1); |
223 | 223 | |
224 | 224 | // Branch based on type: |
225 | - switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) { |
|
225 | + switch ((string) $this->pObj->MOD_SETTINGS['crawlaction']) { |
|
226 | 226 | case 'start': |
227 | 227 | if (empty($this->pObj->id)) { |
228 | 228 | $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected')); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download'); |
270 | 270 | $this->makeCrawlerProcessableChecks(); |
271 | 271 | |
272 | - switch ((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) { |
|
272 | + switch ((string) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) { |
|
273 | 273 | case 'midnight': |
274 | 274 | $this->scheduledTime = mktime(0, 0, 0); |
275 | 275 | break; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | tx_crawler_domain_events_dispatcher::getInstance()->post( |
313 | 313 | 'invokeQueueChange', |
314 | 314 | $this->findCrawler()->setID, |
315 | - [ 'reason' => $reason ] |
|
315 | + ['reason' => $reason] |
|
316 | 316 | ); |
317 | 317 | } |
318 | 318 | |
@@ -396,11 +396,11 @@ discard block |
||
396 | 396 | $this->pObj->MOD_SETTINGS['depth'], |
397 | 397 | 0 |
398 | 398 | ); |
399 | - $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0); |
|
399 | + $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'] ? $this->pObj->MOD_SETTINGS['depth'] : 0); |
|
400 | 400 | |
401 | 401 | // Configurations |
402 | 402 | $cell[] = $this->selectorBox( |
403 | - empty($availableConfigurations)?[]:array_combine($availableConfigurations, $availableConfigurations), |
|
403 | + empty($availableConfigurations) ? [] : array_combine($availableConfigurations, $availableConfigurations), |
|
404 | 404 | 'configurationSelection', |
405 | 405 | $this->incomingConfigurationSelection, |
406 | 406 | 1 |
@@ -529,12 +529,12 @@ discard block |
||
529 | 529 | // Print rudimentary details: |
530 | 530 | $output .= ' |
531 | 531 | <br /><br /> |
532 | - <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" /> |
|
533 | - <input type="hidden" value="' . $this->pObj->id . '" name="id" /> |
|
534 | - <input type="hidden" value="' . $showSetId . '" name="setID" /> |
|
532 | + <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back').'" name="_back" /> |
|
533 | + <input type="hidden" value="' . $this->pObj->id.'" name="id" /> |
|
534 | + <input type="hidden" value="' . $showSetId.'" name="setID" /> |
|
535 | 535 | <br /> |
536 | - Current server time: ' . date('H:i:s', time()) . '<br />' . |
|
537 | - 'Status: ' . $resStatus . '<br />' . |
|
536 | + Current server time: ' . date('H:i:s', time()).'<br />'. |
|
537 | + 'Status: '.$resStatus.'<br />'. |
|
538 | 538 | \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry); |
539 | 539 | } else { // Show list: |
540 | 540 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | foreach ($tree->tree as $data) { |
565 | 565 | $code .= $this->drawLog_addRows( |
566 | 566 | $data['row'], |
567 | - $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], true), |
|
567 | + $data['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], true), |
|
568 | 568 | intval($this->pObj->MOD_SETTINGS['itemsPerPage']) |
569 | 569 | ); |
570 | 570 | if (++$count == 1000) { |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | $cc = 0; |
619 | 619 | foreach ($setList as $set) { |
620 | 620 | $code .= ' |
621 | - <tr class="bgColor'.($cc % 2 ? '-20':'-10').'"> |
|
621 | + <tr class="bgColor'.($cc % 2 ? '-20' : '-10').'"> |
|
622 | 622 | <td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td> |
623 | 623 | <td>'.$set['count_value'].'</td> |
624 | 624 | <td>'.\TYPO3\CMS\Backend\Utility\BackendUtility::dateTimeAge($set['scheduled']).'</td> |
@@ -759,14 +759,14 @@ discard block |
||
759 | 759 | } |
760 | 760 | |
761 | 761 | $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
762 | - $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif'; |
|
762 | + $refreshIcon = $GLOBALS['BACK_PATH'].'sysext/t3skin/extjs/images/grid/refresh.gif'; |
|
763 | 763 | |
764 | 764 | // Put rows together: |
765 | 765 | $content .= ' |
766 | - <tr class="bgColor'.($c % 2 ? '-20':'-10').'"> |
|
766 | + <tr class="bgColor'.($c % 2 ? '-20' : '-10').'"> |
|
767 | 767 | '.$titleClm.' |
768 | - <td><a href="' . $this->getModuleUrl(['qid_details' => $vv['qid'], 'setID' => $setId]) . '">'.htmlspecialchars($vv['qid']).'</a></td> |
|
769 | - <td><a href="' . $this->getModuleUrl(['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>'; |
|
768 | + <td><a href="' . $this->getModuleUrl(['qid_details' => $vv['qid'], 'setID' => $setId]).'">'.htmlspecialchars($vv['qid']).'</a></td> |
|
769 | + <td><a href="' . $this->getModuleUrl(['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>'; |
|
770 | 770 | foreach ($rowData as $fKey => $value) { |
771 | 771 | if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url', $fKey)) { |
772 | 772 | $content .= ' |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | |
985 | 985 | $exitCode = 0; |
986 | 986 | $out = []; |
987 | - exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode); |
|
987 | + exec(escapeshellcmd($this->extensionSettings['phpPath'].' -v'), $out, $exitCode); |
|
988 | 988 | if ($exitCode > 0) { |
989 | 989 | $this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath']))); |
990 | 990 | } |
@@ -1173,10 +1173,10 @@ discard block |
||
1173 | 1173 | $options = []; |
1174 | 1174 | foreach ($optArray as $key => $val) { |
1175 | 1175 | $options[] = ' |
1176 | - <option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value, $key)) || ($multiple && in_array($key, (array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>'; |
|
1176 | + <option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value, $key)) || ($multiple && in_array($key, (array) $value)) ? ' selected="selected"' : '').'>'.htmlspecialchars($val).'</option>'; |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | - $output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('', $options).'</select>'; |
|
1179 | + $output = '<select name="'.htmlspecialchars($name.($multiple ? '[]' : '')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('', $options).'</select>'; |
|
1180 | 1180 | |
1181 | 1181 | return $output; |
1182 | 1182 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['procInstructions'])) { |
41 | 41 | foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['procInstructions'] as $key => $value) { |
42 | - $configuration['items'][] = [$value . ' [' . $key . ']', $key, $this->getExtensionIcon($key)]; |
|
42 | + $configuration['items'][] = [$value.' ['.$key.']', $key, $this->getExtensionIcon($key)]; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | if (method_exists('TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility', 'getExtensionKeyByPrefix')) { |
60 | 60 | $parts = explode('_', $key); |
61 | 61 | if (is_array($parts) && count($parts) > 2) { |
62 | - $extensionKey = ExtensionManagementUtility::getExtensionKeyByPrefix('tx_' . $parts[1]); |
|
63 | - $extIcon = ExtensionManagementUtility::siteRelPath($extensionKey) . 'ext_icon.gif'; |
|
62 | + $extensionKey = ExtensionManagementUtility::getExtensionKeyByPrefix('tx_'.$parts[1]); |
|
63 | + $extIcon = ExtensionManagementUtility::siteRelPath($extensionKey).'ext_icon.gif'; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | // input for startPage |
90 | 90 | $fieldId = 'task_startPage'; |
91 | - $fieldCode = '<input name="tx_scheduler[startPage]" type="text" id="' . $fieldId . '" value="' . $task->startPage . '" class="form-control" />'; |
|
91 | + $fieldCode = '<input name="tx_scheduler[startPage]" type="text" id="'.$fieldId.'" value="'.$task->startPage.'" class="form-control" />'; |
|
92 | 92 | $additionalFields[$fieldId] = [ |
93 | 93 | 'code' => $fieldCode, |
94 | 94 | 'label' => 'LLL:EXT:crawler/Resources/Private/Language/Backend.xlf:crawler_im.startPage' |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | '4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'), |
105 | 105 | '99' => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'), |
106 | 106 | ]; |
107 | - $fieldCode = '<select name="tx_scheduler[depth]" id="' . $fieldId . '" class="form-control">'; |
|
107 | + $fieldCode = '<select name="tx_scheduler[depth]" id="'.$fieldId.'" class="form-control">'; |
|
108 | 108 | |
109 | 109 | foreach ($fieldValueArray as $key => $label) { |
110 | - $fieldCode .= "\t" . '<option value="' . $key . '"' . (($key == $task->depth) ? ' selected="selected"' : '') . '>' . $label . '</option>'; |
|
110 | + $fieldCode .= "\t".'<option value="'.$key.'"'.(($key == $task->depth) ? ' selected="selected"' : '').'>'.$label.'</option>'; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $fieldCode .= '</select>'; |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | // combobox for configuration records |
120 | 120 | $recordsArray = $this->getCrawlerConfigurationRecords(); |
121 | 121 | $fieldId = 'task_configuration'; |
122 | - $fieldCode = '<select name="tx_scheduler[configuration][]" multiple="multiple" id="' . $fieldId . '" class="form-control">'; |
|
123 | - $fieldCode .= "\t" . '<option value=""></option>'; |
|
122 | + $fieldCode = '<select name="tx_scheduler[configuration][]" multiple="multiple" id="'.$fieldId.'" class="form-control">'; |
|
123 | + $fieldCode .= "\t".'<option value=""></option>'; |
|
124 | 124 | for ($i = 0; $i < count($recordsArray); $i++) { |
125 | - $fieldCode .= "\t" . '<option ' . $this->getSelectedState($task->configuration, $recordsArray[$i]['name']) . 'value="' . $recordsArray[$i]['name'] . '">' . $recordsArray[$i]['name'] . '</option>'; |
|
125 | + $fieldCode .= "\t".'<option '.$this->getSelectedState($task->configuration, $recordsArray[$i]['name']).'value="'.$recordsArray[$i]['name'].'">'.$recordsArray[$i]['name'].'</option>'; |
|
126 | 126 | } |
127 | 127 | $fieldCode .= '</select>'; |
128 | 128 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
166 | 166 | '*', |
167 | 167 | 'tx_crawler_configuration', |
168 | - '1=1' . BackendUtility::deleteClause('tx_crawler_configuration') |
|
168 | + '1=1'.BackendUtility::deleteClause('tx_crawler_configuration') |
|
169 | 169 | ); |
170 | 170 | |
171 | 171 | while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function multiProcess($timeout) |
88 | 88 | { |
89 | 89 | if ($this->processLimit <= 1) { |
90 | - throw new RuntimeException('To run crawler in multi process mode you have to configure the processLimit > 1.' . PHP_EOL); |
|
90 | + throw new RuntimeException('To run crawler in multi process mode you have to configure the processLimit > 1.'.PHP_EOL); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | $pendingItemsStart = $this->queueRepository->countAllPendingItems(); |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | $currentProcesses = $this->processRepository->countActive(); |
150 | 150 | $availableProcessesCount = $this->processLimit - $currentProcesses; |
151 | 151 | $requiredProcessesCount = ceil($this->queueRepository->countAllUnassignedPendingItems() / $this->countInARun); |
152 | - $startProcessCount = min([$availableProcessesCount,$requiredProcessesCount]); |
|
152 | + $startProcessCount = min([$availableProcessesCount, $requiredProcessesCount]); |
|
153 | 153 | if ($startProcessCount <= 0) { |
154 | 154 | return $ret; |
155 | 155 | } |
156 | 156 | if ($startProcessCount && $this->verbose) { |
157 | 157 | echo 'Start '.$startProcessCount.' new processes (Running:'.$currentProcesses.')'; |
158 | 158 | } |
159 | - for ($i = 0;$i < $startProcessCount;$i++) { |
|
159 | + for ($i = 0; $i < $startProcessCount; $i++) { |
|
160 | 160 | usleep(100); |
161 | 161 | if ($this->startProcess()) { |
162 | 162 | if ($this->verbose) { |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | { |
180 | 180 | $ttl = (time() + $this->timeToLive - 1); |
181 | 181 | $current = $this->processRepository->countNotTimeouted($ttl); |
182 | - $completePath = '(' .escapeshellcmd($this->getCrawlerCliPath()) . ' &) > /dev/null'; |
|
182 | + $completePath = '('.escapeshellcmd($this->getCrawlerCliPath()).' &) > /dev/null'; |
|
183 | 183 | if (system($completePath) === false) { |
184 | 184 | throw new Exception('could not start process!'); |
185 | 185 | } else { |
186 | - for ($i = 0;$i < 10;$i++) { |
|
186 | + for ($i = 0; $i < 10; $i++) { |
|
187 | 187 | if ($this->processRepository->countNotTimeouted($ttl) > $current) { |
188 | 188 | return true; |
189 | 189 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function getCrawlerCliPath() |
202 | 202 | { |
203 | - $phpPath = $this->crawlerObj->extensionSettings['phpPath'] . ' '; |
|
203 | + $phpPath = $this->crawlerObj->extensionSettings['phpPath'].' '; |
|
204 | 204 | $pathToTypo3 = rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_DOCUMENT_ROOT'), '/'); |
205 | 205 | $pathToTypo3 .= rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'), '/'); |
206 | 206 | $cliPart = '/typo3/cli_dispatch.phpsh crawler'; |
@@ -64,7 +64,7 @@ |
||
64 | 64 | { |
65 | 65 | $db = $this->getDB(); |
66 | 66 | $where = 'process_id_completed=' . $db->fullQuoteStr($process->getProcess_id(), $this->tableName) . |
67 | - ' AND exec_time > 0 '; |
|
67 | + ' AND exec_time > 0 '; |
|
68 | 68 | $limit = 1; |
69 | 69 | $groupby = ''; |
70 | 70 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | protected function getFirstOrLastObjectByProcess($process, $orderby) |
64 | 64 | { |
65 | 65 | $db = $this->getDB(); |
66 | - $where = 'process_id_completed=' . $db->fullQuoteStr($process->getProcess_id(), $this->tableName) . |
|
66 | + $where = 'process_id_completed='.$db->fullQuoteStr($process->getProcess_id(), $this->tableName). |
|
67 | 67 | ' AND exec_time > 0 '; |
68 | 68 | $limit = 1; |
69 | 69 | $groupby = ''; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function countExecutedItemsByProcess($process) |
90 | 90 | { |
91 | - return $this->countItemsByWhereClause('exec_time > 0 AND process_id_completed = ' . $this->getDB()->fullQuoteStr( |
|
91 | + return $this->countItemsByWhereClause('exec_time > 0 AND process_id_completed = '.$this->getDB()->fullQuoteStr( |
|
92 | 92 | $process->getProcess_id(), |
93 | 93 | $this->tableName |
94 | 94 | )); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function countNonExecutedItemsByProcess($process) |
105 | 105 | { |
106 | - return $this->countItemsByWhereClause('exec_time = 0 AND process_id = ' . $this->getDB()->fullQuoteStr( |
|
106 | + return $this->countItemsByWhereClause('exec_time = 0 AND process_id = '.$this->getDB()->fullQuoteStr( |
|
107 | 107 | $process->getProcess_id(), |
108 | 108 | $this->tableName |
109 | 109 | )); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function countAllPendingItems() |
121 | 121 | { |
122 | - return $this->countItemsByWhereClause('exec_time = 0 AND scheduled < ' . time()); |
|
122 | + return $this->countItemsByWhereClause('exec_time = 0 AND scheduled < '.time()); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function countAllAssignedPendingItems() |
134 | 134 | { |
135 | - return $this->countItemsByWhereClause("exec_time = 0 AND scheduled < " . time() . " AND process_id != ''"); |
|
135 | + return $this->countItemsByWhereClause("exec_time = 0 AND scheduled < ".time()." AND process_id != ''"); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function countAllUnassignedPendingItems() |
147 | 147 | { |
148 | - return $this->countItemsByWhereClause("exec_time = 0 AND scheduled < " . time() . " AND process_id = ''"); |
|
148 | + return $this->countItemsByWhereClause("exec_time = 0 AND scheduled < ".time()." AND process_id = ''"); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $res = $db->exec_SELECTquery( |
176 | 176 | "configuration, count(*) as unprocessed, sum(process_id != '') as assignedButUnprocessed", |
177 | 177 | $this->tableName, |
178 | - 'exec_time = 0 AND scheduled < ' . time(), |
|
178 | + 'exec_time = 0 AND scheduled < '.time(), |
|
179 | 179 | 'configuration' |
180 | 180 | ); |
181 | 181 | $rows = []; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $res = $db->exec_SELECTquery( |
200 | 200 | 'set_id', |
201 | 201 | $this->tableName, |
202 | - 'exec_time = 0 AND scheduled < ' . time(), |
|
202 | + 'exec_time = 0 AND scheduled < '.time(), |
|
203 | 203 | 'set_id' |
204 | 204 | ); |
205 | 205 | $setIds = []; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $res = $db->exec_SELECTquery( |
226 | 226 | 'configuration, count(*) as c', |
227 | 227 | $this->tableName, |
228 | - 'set_id in (' . implode(',', $setIds) . ') AND scheduled < ' . time(), |
|
228 | + 'set_id in ('.implode(',', $setIds).') AND scheduled < '.time(), |
|
229 | 229 | 'configuration' |
230 | 230 | ); |
231 | 231 | while ($row = $db->sql_fetch_assoc($res)) { |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $res = $db->exec_SELECTquery( |
306 | 306 | 'process_id_completed, min(exec_time) as start, max(exec_time) as end, count(*) as urlcount', |
307 | 307 | $this->tableName, |
308 | - 'exec_time != 0 and exec_time >= ' . intval($start) . ' and exec_time <= ' . intval($end), |
|
308 | + 'exec_time != 0 and exec_time >= '.intval($start).' and exec_time <= '.intval($end), |
|
309 | 309 | 'process_id_completed' |
310 | 310 | ); |
311 | 311 |