@@ -1054,8 +1054,9 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @return array Menu array |
| 97 | 97 | */ |
| 98 | - function modMenu() { |
|
| 98 | + function modMenu() { |
|
| 99 | 99 | global $LANG; |
| 100 | 100 | |
| 101 | - return array ( |
|
| 101 | + return array( |
|
| 102 | 102 | 'depth' => array( |
| 103 | 103 | 0 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'), |
| 104 | 104 | 1 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'), |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | // Set CSS styles specific for this document: |
| 158 | - $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/',' |
|
| 158 | + $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/', ' |
|
| 159 | 159 | TABLE.c-list TR TD { white-space: nowrap; vertical-align: top; } |
| 160 | 160 | ',$this->pObj->content); |
| 161 | 161 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | |
| 202 | 202 | // Additional menus for the log type: |
| 203 | - if ($this->pObj->MOD_SETTINGS['crawlaction']==='log') { |
|
| 203 | + if ($this->pObj->MOD_SETTINGS['crawlaction'] === 'log') { |
|
| 204 | 204 | $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
| 205 | 205 | $this->pObj->id, |
| 206 | 206 | 'SET[depth]', |
@@ -209,15 +209,15 @@ discard block |
||
| 209 | 209 | 'index.php' |
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | - $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : ''; |
|
| 212 | + $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : ''; |
|
| 213 | 213 | |
| 214 | 214 | $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
| 215 | 215 | |
| 216 | - $h_func.= '<hr/>'. |
|
| 217 | - $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) . ' - ' . |
|
| 218 | - $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) . ' - ' . |
|
| 219 | - $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) . ' - ' . |
|
| 220 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' . |
|
| 216 | + $h_func .= '<hr/>'. |
|
| 217 | + $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).' - '. |
|
| 218 | + $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).' - '. |
|
| 219 | + $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).' - '. |
|
| 220 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': '. |
|
| 221 | 221 | \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
| 222 | 222 | $this->pObj->id, |
| 223 | 223 | 'SET[itemsPerPage]', |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $theOutput = $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1); |
| 231 | 231 | |
| 232 | 232 | // Branch based on type: |
| 233 | - switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) { |
|
| 233 | + switch ((string) $this->pObj->MOD_SETTINGS['crawlaction']) { |
|
| 234 | 234 | case 'start': |
| 235 | 235 | if (empty($this->pObj->id)) { |
| 236 | 236 | $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected')); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @return string HTML output |
| 280 | 280 | */ |
| 281 | - function drawURLs() { |
|
| 281 | + function drawURLs() { |
|
| 282 | 282 | global $BACK_PATH, $BE_USER; |
| 283 | 283 | |
| 284 | 284 | // Init: |
@@ -287,12 +287,12 @@ discard block |
||
| 287 | 287 | $this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download'); |
| 288 | 288 | $this->makeCrawlerProcessableChecks(); |
| 289 | 289 | |
| 290 | - switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) { |
|
| 290 | + switch ((string) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) { |
|
| 291 | 291 | case 'midnight': |
| 292 | - $this->scheduledTime = mktime(0,0,0); |
|
| 292 | + $this->scheduledTime = mktime(0, 0, 0); |
|
| 293 | 293 | break; |
| 294 | 294 | case '04:00': |
| 295 | - $this->scheduledTime = mktime(0,0,0)+4*3600; |
|
| 295 | + $this->scheduledTime = mktime(0, 0, 0) + 4 * 3600; |
|
| 296 | 296 | break; |
| 297 | 297 | case 'now': |
| 298 | 298 | default: |
@@ -312,23 +312,23 @@ discard block |
||
| 312 | 312 | $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime()); |
| 313 | 313 | |
| 314 | 314 | if (empty($this->incomingConfigurationSelection) |
| 315 | - || (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0])) |
|
| 315 | + || (count($this->incomingConfigurationSelection) == 1 && empty($this->incomingConfigurationSelection[0])) |
|
| 316 | 316 | ) { |
| 317 | - $code= ' |
|
| 317 | + $code = ' |
|
| 318 | 318 | <tr> |
| 319 | 319 | <td colspan="7"><b>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noConfigSelected').'</b></td> |
| 320 | 320 | </tr>'; |
| 321 | 321 | } else { |
| 322 | - if($this->submitCrawlUrls){ |
|
| 322 | + if ($this->submitCrawlUrls) { |
|
| 323 | 323 | $reason = new tx_crawler_domain_reason(); |
| 324 | 324 | $reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT); |
| 325 | 325 | |
| 326 | - if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; } |
|
| 326 | + if ($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication) { $username = $BE_USER->user['username']; } |
|
| 327 | 327 | $reason->setDetailText('The user '.$username.' added pages to the crawler queue manually '); |
| 328 | 328 | |
| 329 | - tx_crawler_domain_events_dispatcher::getInstance()->post( 'invokeQueueChange', |
|
| 329 | + tx_crawler_domain_events_dispatcher::getInstance()->post('invokeQueueChange', |
|
| 330 | 330 | $this->findCrawler()->setID, |
| 331 | - array( 'reason' => $reason )); |
|
| 331 | + array('reason' => $reason)); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | $code = $this->crawlerObj->getPageTreeAndUrls( |
@@ -349,18 +349,18 @@ discard block |
||
| 349 | 349 | $this->duplicateTrack = $this->crawlerObj->duplicateTrack; |
| 350 | 350 | |
| 351 | 351 | $output = ''; |
| 352 | - if ($code) { |
|
| 352 | + if ($code) { |
|
| 353 | 353 | |
| 354 | 354 | $output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>'; |
| 355 | 355 | $output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />'; |
| 356 | 356 | |
| 357 | - if (!$this->submitCrawlUrls) { |
|
| 357 | + if (!$this->submitCrawlUrls) { |
|
| 358 | 358 | $output .= $this->drawURLs_cfgSelectors().'<br />'; |
| 359 | 359 | $output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> '; |
| 360 | 360 | $output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> '; |
| 361 | 361 | $output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />'; |
| 362 | 362 | $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />'; |
| 363 | - $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />'; |
|
| 363 | + $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s', time()).'<br />'; |
|
| 364 | 364 | $output .= '<br /> |
| 365 | 365 | <table class="lrPadding c-list url-table">'. |
| 366 | 366 | $this->drawURLs_printTableHeader(). |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | // Download Urls to crawl: |
| 377 | - if ($this->downloadCrawlUrls) { |
|
| 377 | + if ($this->downloadCrawlUrls) { |
|
| 378 | 378 | |
| 379 | 379 | // Creating output header: |
| 380 | 380 | $mimeType = 'application/octet-stream'; |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | Header('Content-Disposition: attachment; filename=CrawlerUrls.txt'); |
| 383 | 383 | |
| 384 | 384 | // Printing the content of the CSV lines: |
| 385 | - echo implode(chr(13).chr(10),$this->downloadUrls); |
|
| 385 | + echo implode(chr(13).chr(10), $this->downloadUrls); |
|
| 386 | 386 | |
| 387 | 387 | // Exits: |
| 388 | 388 | exit; |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | * |
| 398 | 398 | * @return string HTML table |
| 399 | 399 | */ |
| 400 | - function drawURLs_cfgSelectors() { |
|
| 400 | + function drawURLs_cfgSelectors() { |
|
| 401 | 401 | |
| 402 | 402 | // depth |
| 403 | 403 | $cell[] = $this->selectorBox( |
@@ -413,11 +413,11 @@ discard block |
||
| 413 | 413 | $this->pObj->MOD_SETTINGS['depth'], |
| 414 | 414 | 0 |
| 415 | 415 | ); |
| 416 | - $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 ); |
|
| 416 | + $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'] ? $this->pObj->MOD_SETTINGS['depth'] : 0); |
|
| 417 | 417 | |
| 418 | 418 | // Configurations |
| 419 | 419 | $cell[] = $this->selectorBox( |
| 420 | - empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations), |
|
| 420 | + empty($availableConfigurations) ? array() : array_combine($availableConfigurations, $availableConfigurations), |
|
| 421 | 421 | 'configurationSelection', |
| 422 | 422 | $this->incomingConfigurationSelection, |
| 423 | 423 | 1 |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | * |
| 479 | 479 | * @return string Table header |
| 480 | 480 | */ |
| 481 | - function drawURLs_printTableHeader() { |
|
| 481 | + function drawURLs_printTableHeader() { |
|
| 482 | 482 | |
| 483 | 483 | $content = ' |
| 484 | 484 | <tr class="bgColor5 tableheader"> |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | * |
| 517 | 517 | * @return string HTML output |
| 518 | 518 | */ |
| 519 | - function drawLog() { |
|
| 519 | + function drawLog() { |
|
| 520 | 520 | global $BACK_PATH; |
| 521 | 521 | $output = ''; |
| 522 | 522 | |
@@ -529,45 +529,45 @@ discard block |
||
| 529 | 529 | |
| 530 | 530 | // Read URL: |
| 531 | 531 | if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')) { |
| 532 | - $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE); |
|
| 532 | + $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')), TRUE); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | // Look for set ID sent - if it is, we will display contents of that set: |
| 536 | 536 | $showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
| 537 | 537 | |
| 538 | 538 | // Show details: |
| 539 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) { |
|
| 539 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) { |
|
| 540 | 540 | |
| 541 | 541 | // Get entry record: |
| 542 | - list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))); |
|
| 542 | + list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))); |
|
| 543 | 543 | |
| 544 | 544 | // Explode values: |
| 545 | 545 | $resStatus = $this->getResStatus($q_entry); |
| 546 | 546 | $q_entry['parameters'] = unserialize($q_entry['parameters']); |
| 547 | 547 | $q_entry['result_data'] = unserialize($q_entry['result_data']); |
| 548 | - if (is_array($q_entry['result_data'])) { |
|
| 548 | + if (is_array($q_entry['result_data'])) { |
|
| 549 | 549 | $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']); |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - if(!$this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
| 552 | + if (!$this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
| 553 | 553 | unset($q_entry['result_data']['content']['log']); |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | // Print rudimentary details: |
| 557 | 557 | $output .= ' |
| 558 | 558 | <br /><br /> |
| 559 | - <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" /> |
|
| 560 | - <input type="hidden" value="' . $this->pObj->id . '" name="id" /> |
|
| 561 | - <input type="hidden" value="' . $showSetId . '" name="setID" /> |
|
| 559 | + <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back').'" name="_back" /> |
|
| 560 | + <input type="hidden" value="' . $this->pObj->id.'" name="id" /> |
|
| 561 | + <input type="hidden" value="' . $showSetId.'" name="setID" /> |
|
| 562 | 562 | <br /> |
| 563 | - Current server time: ' . date('H:i:s', time()) . '<br />' . |
|
| 564 | - 'Status: ' . $resStatus . '<br />' . |
|
| 563 | + Current server time: ' . date('H:i:s', time()).'<br />'. |
|
| 564 | + 'Status: '.$resStatus.'<br />'. |
|
| 565 | 565 | \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry); |
| 566 | 566 | } else { // Show list: |
| 567 | 567 | |
| 568 | 568 | // If either id or set id, show list: |
| 569 | - if ($this->pObj->id || $showSetId) { |
|
| 570 | - if ($this->pObj->id) { |
|
| 569 | + if ($this->pObj->id || $showSetId) { |
|
| 570 | + if ($this->pObj->id) { |
|
| 571 | 571 | // Drawing tree: |
| 572 | 572 | $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView'); |
| 573 | 573 | $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); |
@@ -589,16 +589,16 @@ discard block |
||
| 589 | 589 | ); |
| 590 | 590 | |
| 591 | 591 | // Get branch beneath: |
| 592 | - if ($this->pObj->MOD_SETTINGS['depth']) { |
|
| 592 | + if ($this->pObj->MOD_SETTINGS['depth']) { |
|
| 593 | 593 | $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], ''); |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | // Traverse page tree: |
| 597 | 597 | $code = ''; $count = 0; |
| 598 | - foreach($tree->tree as $data) { |
|
| 598 | + foreach ($tree->tree as $data) { |
|
| 599 | 599 | $code .= $this->drawLog_addRows( |
| 600 | 600 | $data['row'], |
| 601 | - $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE), |
|
| 601 | + $data['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], TRUE), |
|
| 602 | 602 | intval($this->pObj->MOD_SETTINGS['itemsPerPage']) |
| 603 | 603 | ); |
| 604 | 604 | if (++$count == 1000) { |
@@ -607,13 +607,13 @@ discard block |
||
| 607 | 607 | } |
| 608 | 608 | } else { |
| 609 | 609 | $code = ''; |
| 610 | - $code.= $this->drawLog_addRows( |
|
| 610 | + $code .= $this->drawLog_addRows( |
|
| 611 | 611 | $showSetId, |
| 612 | 612 | 'Set ID: '.$showSetId |
| 613 | 613 | ); |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | - if ($code) { |
|
| 616 | + if ($code) { |
|
| 617 | 617 | |
| 618 | 618 | $output .= ' |
| 619 | 619 | <br /><br /> |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | <input type="hidden" value="'.$this->pObj->id.'" name="id" /> |
| 625 | 625 | <input type="hidden" value="'.$showSetId.'" name="setID" /> |
| 626 | 626 | <br /> |
| 627 | - '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).' |
|
| 627 | + '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s', time()).' |
|
| 628 | 628 | <br /><br /> |
| 629 | 629 | |
| 630 | 630 | |
@@ -650,10 +650,10 @@ discard block |
||
| 650 | 650 | </tr> |
| 651 | 651 | '; |
| 652 | 652 | |
| 653 | - $cc=0; |
|
| 654 | - foreach($setList as $set) { |
|
| 655 | - $code.= ' |
|
| 656 | - <tr class="bgColor'.($cc%2 ? '-20':'-10').'"> |
|
| 653 | + $cc = 0; |
|
| 654 | + foreach ($setList as $set) { |
|
| 655 | + $code .= ' |
|
| 656 | + <tr class="bgColor'.($cc % 2 ? '-20' : '-10').'"> |
|
| 657 | 657 | <td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td> |
| 658 | 658 | <td>'.$set['count_value'].'</td> |
| 659 | 659 | <td>'.\TYPO3\CMS\Backend\Utility\BackendUtility::dateTimeAge($set['scheduled']).'</td> |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | - if($this->CSVExport) { |
|
| 674 | + if ($this->CSVExport) { |
|
| 675 | 675 | $this->outputCsvFile(); |
| 676 | 676 | } |
| 677 | 677 | |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames); |
| 698 | 698 | |
| 699 | 699 | // Data: |
| 700 | - foreach($this->CSVaccu as $row) { |
|
| 700 | + foreach ($this->CSVaccu as $row) { |
|
| 701 | 701 | $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row); |
| 702 | 702 | } |
| 703 | 703 | |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | Header('Content-Disposition: attachment; filename=CrawlerLog.csv'); |
| 708 | 708 | |
| 709 | 709 | // Printing the content of the CSV lines: |
| 710 | - echo implode(chr(13).chr(10),$csvLines); |
|
| 710 | + echo implode(chr(13).chr(10), $csvLines); |
|
| 711 | 711 | |
| 712 | 712 | // Exits: |
| 713 | 713 | exit; |
@@ -723,14 +723,14 @@ discard block |
||
| 723 | 723 | * |
| 724 | 724 | * @return string HTML <tr> content (one or more) |
| 725 | 725 | */ |
| 726 | - function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) { |
|
| 726 | + function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage = 10) { |
|
| 727 | 727 | |
| 728 | 728 | // If Flush button is pressed, flush tables instead of selecting entries: |
| 729 | 729 | |
| 730 | - if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) { |
|
| 730 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) { |
|
| 731 | 731 | $doFlush = true; |
| 732 | 732 | $doFullFlush = false; |
| 733 | - } elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) { |
|
| 733 | + } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) { |
|
| 734 | 734 | $doFlush = true; |
| 735 | 735 | $doFullFlush = true; |
| 736 | 736 | } else { |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | // Get result: |
| 742 | - if (is_array($pageRow_setId)) { |
|
| 742 | + if (is_array($pageRow_setId)) { |
|
| 743 | 743 | $res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage)); |
| 744 | 744 | } else { |
| 745 | 745 | $res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage)); |
@@ -750,14 +750,14 @@ discard block |
||
| 750 | 750 | + ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0) |
| 751 | 751 | + ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0); |
| 752 | 752 | |
| 753 | - if (count($res)) { |
|
| 753 | + if (count($res)) { |
|
| 754 | 754 | // Traverse parameter combinations: |
| 755 | 755 | $c = 0; |
| 756 | - $content=''; |
|
| 757 | - foreach($res as $kk => $vv) { |
|
| 756 | + $content = ''; |
|
| 757 | + foreach ($res as $kk => $vv) { |
|
| 758 | 758 | |
| 759 | 759 | // Title column: |
| 760 | - if (!$c) { |
|
| 760 | + if (!$c) { |
|
| 761 | 761 | $titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>'; |
| 762 | 762 | } else { |
| 763 | 763 | $titleClm = ''; |
@@ -774,16 +774,16 @@ discard block |
||
| 774 | 774 | |
| 775 | 775 | // Put data into array: |
| 776 | 776 | $rowData = array(); |
| 777 | - if ($this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
| 777 | + if ($this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
| 778 | 778 | $rowData['result_log'] = $resLog; |
| 779 | 779 | } else { |
| 780 | - $rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate'); |
|
| 780 | + $rowData['scheduled'] = ($vv['scheduled'] > 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate'); |
|
| 781 | 781 | $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-'; |
| 782 | 782 | } |
| 783 | - $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50); |
|
| 783 | + $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus, 50); |
|
| 784 | 784 | $rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>'; |
| 785 | 785 | $rowData['feUserGroupList'] = $parameters['feUserGroupList']; |
| 786 | - $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : ''; |
|
| 786 | + $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ', $parameters['procInstructions']) : ''; |
|
| 787 | 787 | $rowData['set_id'] = $vv['set_id']; |
| 788 | 788 | |
| 789 | 789 | if ($this->pObj->MOD_SETTINGS['log_feVars']) { |
@@ -794,34 +794,34 @@ discard block |
||
| 794 | 794 | |
| 795 | 795 | $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
| 796 | 796 | |
| 797 | - $refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif'; |
|
| 798 | - if (version_compare(TYPO3_version,'7.0','>=')) { |
|
| 799 | - $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif'; |
|
| 797 | + $refreshIcon = $GLOBALS['BACK_PATH'].'gfx/refresh_n.gif'; |
|
| 798 | + if (version_compare(TYPO3_version, '7.0', '>=')) { |
|
| 799 | + $refreshIcon = $GLOBALS['BACK_PATH'].'sysext/t3skin/extjs/images/grid/refresh.gif'; |
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | // Put rows together: |
| 803 | - $content.= ' |
|
| 804 | - <tr class="bgColor'.($c%2 ? '-20':'-10').'"> |
|
| 803 | + $content .= ' |
|
| 804 | + <tr class="bgColor'.($c % 2 ? '-20' : '-10').'"> |
|
| 805 | 805 | '.$titleClm.' |
| 806 | - <td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)) . '">'.htmlspecialchars($vv['qid']).'</a></td> |
|
| 807 | - <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>'; |
|
| 808 | - foreach($rowData as $fKey => $value) { |
|
| 806 | + <td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)).'">'.htmlspecialchars($vv['qid']).'</a></td> |
|
| 807 | + <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>'; |
|
| 808 | + foreach ($rowData as $fKey => $value) { |
|
| 809 | 809 | |
| 810 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey)) { |
|
| 811 | - $content.= ' |
|
| 810 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url', $fKey)) { |
|
| 811 | + $content .= ' |
|
| 812 | 812 | <td>'.$value.'</td>'; |
| 813 | 813 | } else { |
| 814 | - $content.= ' |
|
| 814 | + $content .= ' |
|
| 815 | 815 | <td>'.nl2br(htmlspecialchars($value)).'</td>'; |
| 816 | 816 | } |
| 817 | 817 | } |
| 818 | - $content.= ' |
|
| 818 | + $content .= ' |
|
| 819 | 819 | </tr>'; |
| 820 | 820 | $c++; |
| 821 | 821 | |
| 822 | - if ($this->CSVExport) { |
|
| 822 | + if ($this->CSVExport) { |
|
| 823 | 823 | // Only for CSV (adding qid and scheduled/exec_time if needed): |
| 824 | - $rowData['result_log'] = implode('// ',explode(chr(10),$resLog)); |
|
| 824 | + $rowData['result_log'] = implode('// ', explode(chr(10), $resLog)); |
|
| 825 | 825 | $rowData['qid'] = $vv['qid']; |
| 826 | 826 | $rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']); |
| 827 | 827 | $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-'; |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | * |
| 865 | 865 | * @return string Table header |
| 866 | 866 | */ |
| 867 | - function drawLog_printTableHeader() { |
|
| 867 | + function drawLog_printTableHeader() { |
|
| 868 | 868 | |
| 869 | 869 | $content = ' |
| 870 | 870 | <tr class="bgColor5 tableheader"> |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | } |
| 916 | 916 | |
| 917 | 917 | function getResStatus($vv) { |
| 918 | - if ($vv['result_data']) { |
|
| 918 | + if ($vv['result_data']) { |
|
| 919 | 919 | $requestContent = unserialize($vv['result_data']); |
| 920 | 920 | $requestResult = unserialize($requestContent['content']); |
| 921 | 921 | if (is_array($requestResult)) { |
@@ -924,9 +924,9 @@ discard block |
||
| 924 | 924 | } else { |
| 925 | 925 | $resStatus = implode("\n", $requestResult['errorlog']); |
| 926 | 926 | } |
| 927 | - $resLog = is_array($requestResult['log']) ? implode(chr(10),$requestResult['log']) : ''; |
|
| 927 | + $resLog = is_array($requestResult['log']) ? implode(chr(10), $requestResult['log']) : ''; |
|
| 928 | 928 | } else { |
| 929 | - $resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...'; |
|
| 929 | + $resStatus = 'Error: '.substr(preg_replace('/\s+/', ' ', strip_tags($requestContent['content'])), 0, 10000).'...'; |
|
| 930 | 930 | } |
| 931 | 931 | } else { |
| 932 | 932 | $resStatus = '-'; |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | * @param void |
| 955 | 955 | * @return string |
| 956 | 956 | */ |
| 957 | - protected function drawProcessOverviewAction(){ |
|
| 957 | + protected function drawProcessOverviewAction() { |
|
| 958 | 958 | |
| 959 | 959 | $this->runRefreshHooks(); |
| 960 | 960 | |
@@ -968,20 +968,20 @@ discard block |
||
| 968 | 968 | $this->addErrorMessage($e->getMessage()); |
| 969 | 969 | } |
| 970 | 970 | |
| 971 | - $offset = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset')); |
|
| 972 | - $perpage = 20; |
|
| 971 | + $offset = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset')); |
|
| 972 | + $perpage = 20; |
|
| 973 | 973 | |
| 974 | - $processRepository = new tx_crawler_domain_process_repository(); |
|
| 975 | - $queueRepository = new tx_crawler_domain_queue_repository(); |
|
| 974 | + $processRepository = new tx_crawler_domain_process_repository(); |
|
| 975 | + $queueRepository = new tx_crawler_domain_queue_repository(); |
|
| 976 | 976 | |
| 977 | 977 | $mode = $this->pObj->MOD_SETTINGS['processListMode']; |
| 978 | 978 | if ($mode == 'detail') { |
| 979 | 979 | $where = ''; |
| 980 | - } elseif($mode == 'simple') { |
|
| 980 | + } elseif ($mode == 'simple') { |
|
| 981 | 981 | $where = 'active = 1'; |
| 982 | 982 | } |
| 983 | 983 | |
| 984 | - $allProcesses = $processRepository->findAll('ttl','DESC', $perpage, $offset,$where); |
|
| 984 | + $allProcesses = $processRepository->findAll('ttl', 'DESC', $perpage, $offset, $where); |
|
| 985 | 985 | $allCount = $processRepository->countAll($where); |
| 986 | 986 | |
| 987 | 987 | $listView = new tx_crawler_view_process_list(); |
@@ -993,10 +993,10 @@ discard block |
||
| 993 | 993 | $listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems()); |
| 994 | 994 | $listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems()); |
| 995 | 995 | $listView->setActiveProcessCount($processRepository->countActive()); |
| 996 | - $listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1)); |
|
| 996 | + $listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'], 1, 99, 1)); |
|
| 997 | 997 | $listView->setMode($mode); |
| 998 | 998 | |
| 999 | - $paginationView = new tx_crawler_view_pagination(); |
|
| 999 | + $paginationView = new tx_crawler_view_pagination(); |
|
| 1000 | 1000 | $paginationView->setCurrentOffset($offset); |
| 1001 | 1001 | $paginationView->setPerPage($perpage); |
| 1002 | 1002 | $paginationView->setTotalItemCount($allCount); |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | |
| 1034 | 1034 | $exitCode = 0; |
| 1035 | 1035 | $out = array(); |
| 1036 | - exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode); |
|
| 1036 | + exec(escapeshellcmd($this->extensionSettings['phpPath'].' -v'), $out, $exitCode); |
|
| 1037 | 1037 | if ($exitCode > 0) { |
| 1038 | 1038 | $this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath']))); |
| 1039 | 1039 | } |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | * @param void |
| 1097 | 1097 | * @return void |
| 1098 | 1098 | */ |
| 1099 | - protected function handleProcessOverviewActions(){ |
|
| 1099 | + protected function handleProcessOverviewActions() { |
|
| 1100 | 1100 | |
| 1101 | 1101 | $crawler = $this->findCrawler(); |
| 1102 | 1102 | |
@@ -1129,8 +1129,8 @@ discard block |
||
| 1129 | 1129 | * @return tx_crawler_lib crawler object |
| 1130 | 1130 | * @author Timo Schmidt <[email protected]> |
| 1131 | 1131 | */ |
| 1132 | - protected function findCrawler(){ |
|
| 1133 | - if(!$this->crawlerObj instanceof tx_crawler_lib){ |
|
| 1132 | + protected function findCrawler() { |
|
| 1133 | + if (!$this->crawlerObj instanceof tx_crawler_lib) { |
|
| 1134 | 1134 | $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib'); |
| 1135 | 1135 | } |
| 1136 | 1136 | return $this->crawlerObj; |
@@ -1232,15 +1232,15 @@ discard block |
||
| 1232 | 1232 | * |
| 1233 | 1233 | * @return string HTML select element |
| 1234 | 1234 | */ |
| 1235 | - function selectorBox($optArray, $name, $value, $multiple) { |
|
| 1235 | + function selectorBox($optArray, $name, $value, $multiple) { |
|
| 1236 | 1236 | |
| 1237 | 1237 | $options = array(); |
| 1238 | - foreach($optArray as $key => $val) { |
|
| 1238 | + foreach ($optArray as $key => $val) { |
|
| 1239 | 1239 | $options[] = ' |
| 1240 | - <option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value,$key)) || ($multiple && in_array($key,(array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>'; |
|
| 1240 | + <option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value, $key)) || ($multiple && in_array($key, (array) $value)) ? ' selected="selected"' : '').'>'.htmlspecialchars($val).'</option>'; |
|
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | - $output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>'; |
|
| 1243 | + $output = '<select name="'.htmlspecialchars($name.($multiple ? '[]' : '')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('', $options).'</select>'; |
|
| 1244 | 1244 | |
| 1245 | 1245 | return $output; |
| 1246 | 1246 | } |
@@ -1279,6 +1279,6 @@ discard block |
||
| 1279 | 1279 | } |
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']) { |
|
| 1282 | +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']) { |
|
| 1283 | 1283 | include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']); |
| 1284 | 1284 | } |
@@ -1,11 +1,11 @@ |
||
| 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 | |
@@ -1,4 +1,7 @@ |
||
| 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++ ){ ?> |
@@ -50,17 +50,17 @@ |
||
| 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;"> |
@@ -1,4 +1,7 @@ discard block |
||
| 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 |
||
| 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> |
@@ -1,24 +1,24 @@ |
||
| 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 | ); |
@@ -4,10 +4,10 @@ |
||
| 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 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->cli_options[] = array('-d depth', 'Tree depth, 0-99', "How many levels under the 'page_id' to include.");
|
| 58 | 58 | $this->cli_options[] = array('-o mode', 'Output mode: "url", "exec", "queue"', "Specifies output modes\nurl : Will list URLs which wget could use as input.\nqueue: Will put entries in queue table.\nexec: Will execute all entries right away!");
|
| 59 | 59 | $this->cli_options[] = array('-n number', 'Number of items per minute.', 'Specifies how many items are put in the queue per minute. Only valid for output mode "queue"');
|
| 60 | - $this->cli_options[] = array('-conf configurationkeys','List of Configuration Keys','A commaseperated list of crawler configurations');
|
|
| 60 | + $this->cli_options[] = array('-conf configurationkeys', 'List of Configuration Keys', 'A commaseperated list of crawler configurations');
|
|
| 61 | 61 | # $this->cli_options[] = array('-v level', 'Verbosity level 0-3', "The value of level can be:\n 0 = all output\n 1 = info and greater (default)\n 2 = warnings and greater\n 3 = errors");
|
| 62 | 62 | |
| 63 | 63 | // Setting help texts: |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $this->cli_help['synopsis'] = 'page_id ###OPTIONS###'; |
| 66 | 66 | $this->cli_help['description'] = "Works as a CLI interface to some functionality from the Web > Info > Site Crawler module; It can put entries in the queue from command line options, return the list of URLs and even execute all entries right away without having to queue them up - this can be useful for immediate re-cache, re-indexing or static publishing from command line."; |
| 67 | 67 | $this->cli_help['examples'] = "/.../cli_dispatch.phpsh crawler_im 7 -d=2 -conf=<configurationKey> -o=exec\nWill re-cache pages from page 7 and two levels down, executed immediately.\n"; |
| 68 | - $this->cli_help['examples'].= "/.../cli_dispatch.phpsh crawler_im 7 -d=0 -conf=<configurationKey> -n=4 -o=queue\nWill put entries for re-caching pages from page 7 into queue, 4 every minute.\n"; |
|
| 68 | + $this->cli_help['examples'] .= "/.../cli_dispatch.phpsh crawler_im 7 -d=0 -conf=<configurationKey> -n=4 -o=queue\nWill put entries for re-caching pages from page 7 into queue, 4 every minute.\n"; |
|
| 69 | 69 | $this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2009'; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | if (!isAbsPath($tempPathThisScript)) { |
| 13 | 13 | $workingDirectory = $_SERVER['PWD'] ? $_SERVER['PWD'] : getcwd(); |
| 14 | 14 | if ($workingDirectory) { |
| 15 | - $tempPathThisScript = $workingDirectory . '/' . preg_replace('/\.\//', '', $tempPathThisScript); |
|
| 15 | + $tempPathThisScript = $workingDirectory.'/'.preg_replace('/\.\//', '', $tempPathThisScript); |
|
| 16 | 16 | if (!@is_file($tempPathThisScript)) { |
| 17 | - die('Relative path found, but an error occured during resolving of the absolute path: ' . $tempPathThisScript . PHP_EOL); |
|
| 17 | + die('Relative path found, but an error occured during resolving of the absolute path: '.$tempPathThisScript.PHP_EOL); |
|
| 18 | 18 | } |
| 19 | 19 | } else { |
| 20 | - die('Relative path found, but resolving absolute path is not supported on this platform.' . PHP_EOL); |
|
| 20 | + die('Relative path found, but resolving absolute path is not supported on this platform.'.PHP_EOL); |
|
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | list($key, $value) = explode(':', $additionalHeader, 2); |
| 36 | 36 | $key = str_replace('-', '_', strtoupper(trim($key))); |
| 37 | 37 | if ($key != 'HOST') { |
| 38 | - $_SERVER['HTTP_' . $key] = $value; |
|
| 38 | + $_SERVER['HTTP_'.$key] = $value; |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -57,18 +57,18 @@ discard block |
||
| 57 | 57 | $typo3SitePath = $_SERVER['argv'][1]; |
| 58 | 58 | |
| 59 | 59 | // faking the environment |
| 60 | -$_SERVER['DOCUMENT_ROOT'] = preg_replace('#' . preg_quote($typo3SitePath, '#') . '$#', '', $typo3Root); |
|
| 60 | +$_SERVER['DOCUMENT_ROOT'] = preg_replace('#'.preg_quote($typo3SitePath, '#').'$#', '', $typo3Root); |
|
| 61 | 61 | $_SERVER['HTTP_USER_AGENT'] = 'CLI Mode'; |
| 62 | 62 | $_SERVER['HTTP_HOST'] = $_SERVER['SERVER_NAME'] = $urlParts['host']; |
| 63 | -$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = $typo3SitePath . 'index.php'; |
|
| 64 | -$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'] = $typo3Root . 'index.php'; |
|
| 63 | +$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = $typo3SitePath.'index.php'; |
|
| 64 | +$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'] = $typo3Root.'index.php'; |
|
| 65 | 65 | $_SERVER['QUERY_STRING'] = (isset($urlParts['query']) ? $urlParts['query'] : ''); |
| 66 | -$_SERVER['REQUEST_URI'] = $urlParts['path'] . (isset($urlParts['query']) ? '?' . $urlParts['query'] : ''); |
|
| 66 | +$_SERVER['REQUEST_URI'] = $urlParts['path'].(isset($urlParts['query']) ? '?'.$urlParts['query'] : ''); |
|
| 67 | 67 | $_SERVER['REQUEST_METHOD'] = 'GET'; |
| 68 | 68 | |
| 69 | 69 | // Define a port if used in the URL: |
| 70 | 70 | if (isset($urlParts['port'])) { |
| 71 | - $_SERVER['HTTP_HOST'] .= ':' . $urlParts['port']; |
|
| 71 | + $_SERVER['HTTP_HOST'] .= ':'.$urlParts['port']; |
|
| 72 | 72 | $_SERVER['SERVER_PORT'] = $urlParts['port']; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | chdir($typo3Root); |
| 81 | -include($typo3Root . '/index.php'); |
|
| 81 | +include($typo3Root.'/index.php'); |
|
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | * @param void |
| 50 | 50 | * @return string table name |
| 51 | 51 | */ |
| 52 | - public static function getTableName(){ |
|
| 52 | + public static function getTableName() { |
|
| 53 | 53 | return self::$tableName; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * |
| 35 | 35 | * @return int |
| 36 | 36 | */ |
| 37 | - public function getExecutionTime(){ |
|
| 37 | + public function getExecutionTime() { |
|
| 38 | 38 | return $this->row['exec_time']; |
| 39 | 39 | } |
| 40 | 40 | |