@@ -694,6 +694,7 @@ discard block |
||
| 694 | 694 | * @param array Page row or set-id |
| 695 | 695 | * @param string Title string |
| 696 | 696 | * @param int Items per Page setting |
| 697 | + * @param string $titleString |
|
| 697 | 698 | * @return string HTML <tr> content (one or more) |
| 698 | 699 | */ |
| 699 | 700 | public function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage = 10) |
@@ -1204,6 +1205,8 @@ discard block |
||
| 1204 | 1205 | * @param string Selector box name |
| 1205 | 1206 | * @param string Selector box value (array for multiple...) |
| 1206 | 1207 | * @param boolean If set, will draw multiple box. |
| 1208 | + * @param string $name |
|
| 1209 | + * @param integer $multiple |
|
| 1207 | 1210 | * @return string HTML select element |
| 1208 | 1211 | */ |
| 1209 | 1212 | public function selectorBox($optArray, $name, $value, $multiple) |
@@ -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 | 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').': ' . |
|
| 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]', |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $theOutput .= $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1); |
| 232 | 232 | |
| 233 | 233 | // Branch based on type: |
| 234 | - switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) { |
|
| 234 | + switch ((string) $this->pObj->MOD_SETTINGS['crawlaction']) { |
|
| 235 | 235 | case 'start': |
| 236 | 236 | if (empty($this->pObj->id)) { |
| 237 | 237 | $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected')); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | $this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download'); |
| 279 | 279 | $this->makeCrawlerProcessableChecks(); |
| 280 | 280 | |
| 281 | - switch ((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) { |
|
| 281 | + switch ((string) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) { |
|
| 282 | 282 | case 'midnight': |
| 283 | 283 | $this->scheduledTime = mktime(0, 0, 0); |
| 284 | 284 | break; |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | tx_crawler_domain_events_dispatcher::getInstance()->post( |
| 322 | 322 | 'invokeQueueChange', |
| 323 | 323 | $this->findCrawler()->setID, |
| 324 | - [ 'reason' => $reason ] |
|
| 324 | + ['reason' => $reason] |
|
| 325 | 325 | ); |
| 326 | 326 | } |
| 327 | 327 | |
@@ -405,11 +405,11 @@ discard block |
||
| 405 | 405 | $this->pObj->MOD_SETTINGS['depth'], |
| 406 | 406 | 0 |
| 407 | 407 | ); |
| 408 | - $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0); |
|
| 408 | + $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'] ? $this->pObj->MOD_SETTINGS['depth'] : 0); |
|
| 409 | 409 | |
| 410 | 410 | // Configurations |
| 411 | 411 | $cell[] = $this->selectorBox( |
| 412 | - empty($availableConfigurations)?[]:array_combine($availableConfigurations, $availableConfigurations), |
|
| 412 | + empty($availableConfigurations) ? [] : array_combine($availableConfigurations, $availableConfigurations), |
|
| 413 | 413 | 'configurationSelection', |
| 414 | 414 | $this->incomingConfigurationSelection, |
| 415 | 415 | 1 |
@@ -538,12 +538,12 @@ discard block |
||
| 538 | 538 | // Print rudimentary details: |
| 539 | 539 | $output .= ' |
| 540 | 540 | <br /><br /> |
| 541 | - <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" /> |
|
| 542 | - <input type="hidden" value="' . $this->pObj->id . '" name="id" /> |
|
| 543 | - <input type="hidden" value="' . $showSetId . '" name="setID" /> |
|
| 541 | + <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back').'" name="_back" /> |
|
| 542 | + <input type="hidden" value="' . $this->pObj->id.'" name="id" /> |
|
| 543 | + <input type="hidden" value="' . $showSetId.'" name="setID" /> |
|
| 544 | 544 | <br /> |
| 545 | - Current server time: ' . date('H:i:s', time()) . '<br />' . |
|
| 546 | - 'Status: ' . $resStatus . '<br />' . |
|
| 545 | + Current server time: ' . date('H:i:s', time()).'<br />'. |
|
| 546 | + 'Status: '.$resStatus.'<br />'. |
|
| 547 | 547 | \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry); |
| 548 | 548 | } else { // Show list: |
| 549 | 549 | |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | foreach ($tree->tree as $data) { |
| 574 | 574 | $code .= $this->drawLog_addRows( |
| 575 | 575 | $data['row'], |
| 576 | - $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], true), |
|
| 576 | + $data['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], true), |
|
| 577 | 577 | intval($this->pObj->MOD_SETTINGS['itemsPerPage']) |
| 578 | 578 | ); |
| 579 | 579 | if (++$count == 1000) { |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | $cc = 0; |
| 628 | 628 | foreach ($setList as $set) { |
| 629 | 629 | $code .= ' |
| 630 | - <tr class="bgColor'.($cc % 2 ? '-20':'-10').'"> |
|
| 630 | + <tr class="bgColor'.($cc % 2 ? '-20' : '-10').'"> |
|
| 631 | 631 | <td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td> |
| 632 | 632 | <td>'.$set['count_value'].'</td> |
| 633 | 633 | <td>'.\TYPO3\CMS\Backend\Utility\BackendUtility::dateTimeAge($set['scheduled']).'</td> |
@@ -768,17 +768,17 @@ discard block |
||
| 768 | 768 | |
| 769 | 769 | $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
| 770 | 770 | |
| 771 | - $refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif'; |
|
| 771 | + $refreshIcon = $GLOBALS['BACK_PATH'].'gfx/refresh_n.gif'; |
|
| 772 | 772 | if (version_compare(TYPO3_version, '7.0', '>=')) { |
| 773 | - $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif'; |
|
| 773 | + $refreshIcon = $GLOBALS['BACK_PATH'].'sysext/t3skin/extjs/images/grid/refresh.gif'; |
|
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | // Put rows together: |
| 777 | 777 | $content .= ' |
| 778 | - <tr class="bgColor'.($c % 2 ? '-20':'-10').'"> |
|
| 778 | + <tr class="bgColor'.($c % 2 ? '-20' : '-10').'"> |
|
| 779 | 779 | '.$titleClm.' |
| 780 | - <td><a href="' . $this->getModuleUrl(['qid_details' => $vv['qid'], 'setID' => $setId]) . '">'.htmlspecialchars($vv['qid']).'</a></td> |
|
| 781 | - <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>'; |
|
| 780 | + <td><a href="' . $this->getModuleUrl(['qid_details' => $vv['qid'], 'setID' => $setId]).'">'.htmlspecialchars($vv['qid']).'</a></td> |
|
| 781 | + <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>'; |
|
| 782 | 782 | foreach ($rowData as $fKey => $value) { |
| 783 | 783 | if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url', $fKey)) { |
| 784 | 784 | $content .= ' |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | |
| 1004 | 1004 | $exitCode = 0; |
| 1005 | 1005 | $out = []; |
| 1006 | - exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode); |
|
| 1006 | + exec(escapeshellcmd($this->extensionSettings['phpPath'].' -v'), $out, $exitCode); |
|
| 1007 | 1007 | if ($exitCode > 0) { |
| 1008 | 1008 | $this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath']))); |
| 1009 | 1009 | } |
@@ -1211,10 +1211,10 @@ discard block |
||
| 1211 | 1211 | $options = []; |
| 1212 | 1212 | foreach ($optArray as $key => $val) { |
| 1213 | 1213 | $options[] = ' |
| 1214 | - <option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value, $key)) || ($multiple && in_array($key, (array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>'; |
|
| 1214 | + <option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value, $key)) || ($multiple && in_array($key, (array) $value)) ? ' selected="selected"' : '').'>'.htmlspecialchars($val).'</option>'; |
|
| 1215 | 1215 | } |
| 1216 | 1216 | |
| 1217 | - $output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('', $options).'</select>'; |
|
| 1217 | + $output = '<select name="'.htmlspecialchars($name.($multiple ? '[]' : '')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('', $options).'</select>'; |
|
| 1218 | 1218 | |
| 1219 | 1219 | return $output; |
| 1220 | 1220 | } |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | protected function getRefreshLink() |
| 341 | 341 | { |
| 342 | - return '<input onclick="window.location=\'' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_info') . '&SET[crawlaction]=multiprocess&id=' . $this->pageId . '\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_refresh.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.refresh') . '" />'; |
|
| 342 | + return '<input onclick="window.location=\''.\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_info').'&SET[crawlaction]=multiprocess&id='.$this->pageId.'\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'arrow_refresh.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.refresh').'" />'; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | /** |
@@ -360,9 +360,9 @@ discard block |
||
| 360 | 360 | protected function getEnableDisableLink() |
| 361 | 361 | { |
| 362 | 362 | if ($this->getIsCrawlerEnabled()) { |
| 363 | - return '<input onclick="window.location+=\'&action=stopCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_stop_blue.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.disablecrawling') . '" />'; |
|
| 363 | + return '<input onclick="window.location+=\'&action=stopCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'control_stop_blue.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.disablecrawling').'" />'; |
|
| 364 | 364 | } else { |
| 365 | - return '<input onclick="window.location+=\'&action=resumeCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_play.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.enablecrawling') . '" />'; |
|
| 365 | + return '<input onclick="window.location+=\'&action=resumeCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'control_play.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.enablecrawling').'" />'; |
|
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | protected function getModeLink() |
| 376 | 376 | { |
| 377 | 377 | if ($this->getMode() == 'detail') { |
| 378 | - return '<input onclick="window.location+=\'&SET[processListMode]=simple\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_in.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.running') . '" />'; |
|
| 378 | + return '<input onclick="window.location+=\'&SET[processListMode]=simple\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'arrow_in.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.running').'" />'; |
|
| 379 | 379 | } elseif ($this->getMode() == 'simple') { |
| 380 | - return '<input onclick="window.location+=\'&SET[processListMode]=detail\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_out.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.all') . '" />'; |
|
| 380 | + return '<input onclick="window.location+=\'&SET[processListMode]=detail\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'arrow_out.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.all').'" />'; |
|
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | protected function getAddLink() |
| 391 | 391 | { |
| 392 | 392 | if ($this->getActiveProcessCount() < $this->getMaxActiveProcessCount() && $this->getIsCrawlerEnabled()) { |
| 393 | - return '<input onclick="window.location+=\'&action=addProcess\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'add.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.add') . '" />'; |
|
| 393 | + return '<input onclick="window.location+=\'&action=addProcess\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'add.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.add').'" />'; |
|
| 394 | 394 | } else { |
| 395 | 395 | return ''; |
| 396 | 396 | } |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | if (!empty($title)) { |
| 418 | 418 | $title = ' title="'.$title.'"'; |
| 419 | 419 | } |
| 420 | - return '<img src="'.$this->getIconPath().$icon.'.png" ' . $title . ' />'; |
|
| 420 | + return '<img src="'.$this->getIconPath().$icon.'.png" '.$title.' />'; |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | /** |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | </thead> |
| 54 | 54 | <tbody> |
| 55 | 55 | <?php foreach ($this->getProcessCollection() as $process): /* @var $process tx_crawler_domain_process */ ?> |
| 56 | - <tr class="<?php echo (++$count % 2 == 0) ? 'odd': 'even' ?>"> |
|
| 56 | + <tr class="<?php echo (++$count % 2 == 0) ? 'odd' : 'even' ?>"> |
|
| 57 | 57 | <td><?php echo $this->getIconForState(htmlspecialchars($process->getState())); ?></td> |
| 58 | 58 | <td><?php echo htmlspecialchars($process->getProcess_id()); ?></td> |
| 59 | 59 | <td><?php echo htmlspecialchars($this->asDate($process->getTimeForFirstItem())); ?></td> |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $res = $db->exec_SELECTquery( |
| 212 | 212 | 'configuration, count(*) as c', |
| 213 | 213 | $this->tableName, |
| 214 | - 'set_id in ('. implode(',', $setIds).') AND scheduled < '.time(), |
|
| 214 | + 'set_id in ('.implode(',', $setIds).') AND scheduled < '.time(), |
|
| 215 | 215 | 'configuration' |
| 216 | 216 | ); |
| 217 | 217 | while ($row = $db->sql_fetch_assoc($res)) { |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $res = $db->exec_SELECTquery( |
| 292 | 292 | 'process_id_completed, min(exec_time) as start, max(exec_time) as end, count(*) as urlcount', |
| 293 | 293 | $this->tableName, |
| 294 | - 'exec_time != 0 and exec_time >= '.intval($start). ' and exec_time <= ' . intval($end), |
|
| 294 | + 'exec_time != 0 and exec_time >= '.intval($start).' and exec_time <= '.intval($end), |
|
| 295 | 295 | 'process_id_completed' |
| 296 | 296 | ); |
| 297 | 297 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function multiProcess($timeout) |
| 85 | 85 | { |
| 86 | 86 | if ($this->processLimit <= 1) { |
| 87 | - throw new RuntimeException('To run crawler in multi process mode you have to configure the processLimit > 1.' . PHP_EOL); |
|
| 87 | + throw new RuntimeException('To run crawler in multi process mode you have to configure the processLimit > 1.'.PHP_EOL); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $pendingItemsStart = $this->queueRepository->countAllPendingItems(); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | if ($currentPendingItems == 0) { |
| 104 | 104 | if ($this->verbose) { |
| 105 | - echo 'Finished...' . chr(10); |
|
| 105 | + echo 'Finished...'.chr(10); |
|
| 106 | 106 | } |
| 107 | 107 | break; |
| 108 | 108 | } |
@@ -114,16 +114,16 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | sleep(1); |
| 116 | 116 | if ($nextTimeOut < time()) { |
| 117 | - $timedOutProcesses = $this->processRepository->findAll('', 'DESC', null, 0, 'ttl >' . $nextTimeOut); |
|
| 117 | + $timedOutProcesses = $this->processRepository->findAll('', 'DESC', null, 0, 'ttl >'.$nextTimeOut); |
|
| 118 | 118 | $nextTimeOut = time() + $this->timeToLive; |
| 119 | 119 | if ($this->verbose) { |
| 120 | - echo 'Cleanup' . implode(',', $timedOutProcesses->getProcessIds()) . chr(10); |
|
| 120 | + echo 'Cleanup'.implode(',', $timedOutProcesses->getProcessIds()).chr(10); |
|
| 121 | 121 | } |
| 122 | 122 | $this->crawlerObj->CLI_releaseProcesses($timedOutProcesses->getProcessIds(), true); |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | if ($currentPendingItems > 0 && $this->verbose) { |
| 126 | - echo 'Stop with timeout' . chr(10); |
|
| 126 | + echo 'Stop with timeout'.chr(10); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
@@ -146,14 +146,14 @@ discard block |
||
| 146 | 146 | $currentProcesses = $this->processRepository->countActive(); |
| 147 | 147 | $availableProcessesCount = $this->processLimit - $currentProcesses; |
| 148 | 148 | $requiredProcessesCount = ceil($this->queueRepository->countAllUnassignedPendingItems() / $this->countInARun); |
| 149 | - $startProcessCount = min([$availableProcessesCount,$requiredProcessesCount]); |
|
| 149 | + $startProcessCount = min([$availableProcessesCount, $requiredProcessesCount]); |
|
| 150 | 150 | if ($startProcessCount <= 0) { |
| 151 | 151 | return $ret; |
| 152 | 152 | } |
| 153 | 153 | if ($startProcessCount && $this->verbose) { |
| 154 | 154 | echo 'Start '.$startProcessCount.' new processes (Running:'.$currentProcesses.')'; |
| 155 | 155 | } |
| 156 | - for ($i = 0;$i < $startProcessCount;$i++) { |
|
| 156 | + for ($i = 0; $i < $startProcessCount; $i++) { |
|
| 157 | 157 | usleep(100); |
| 158 | 158 | if ($this->startProcess()) { |
| 159 | 159 | if ($this->verbose) { |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | { |
| 177 | 177 | $ttl = (time() + $this->timeToLive - 1); |
| 178 | 178 | $current = $this->processRepository->countNotTimeouted($ttl); |
| 179 | - $completePath = '(' .escapeshellcmd($this->getCrawlerCliPath()) . ' &) > /dev/null'; |
|
| 179 | + $completePath = '('.escapeshellcmd($this->getCrawlerCliPath()).' &) > /dev/null'; |
|
| 180 | 180 | if (system($completePath) === false) { |
| 181 | 181 | throw new Exception('could not start process!'); |
| 182 | 182 | } else { |
| 183 | - for ($i = 0;$i < 10;$i++) { |
|
| 183 | + for ($i = 0; $i < 10; $i++) { |
|
| 184 | 184 | if ($this->processRepository->countNotTimeouted($ttl) > $current) { |
| 185 | 185 | return true; |
| 186 | 186 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | public function getCrawlerCliPath() |
| 199 | 199 | { |
| 200 | - $phpPath = $this->crawlerObj->extensionSettings['phpPath'] . ' '; |
|
| 200 | + $phpPath = $this->crawlerObj->extensionSettings['phpPath'].' '; |
|
| 201 | 201 | $pathToTypo3 = rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_DOCUMENT_ROOT'), '/'); |
| 202 | 202 | $pathToTypo3 .= rtrim(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'), '/'); |
| 203 | 203 | $cliPart = '/typo3/cli_dispatch.phpsh crawler'; |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function offsetGet($index) |
| 52 | 52 | { |
| 53 | - if (! parent::offsetExists($index)) { |
|
| 54 | - throw new Exception('Index "' . var_export($index, true) . '" for tx_crawler_domain_process are not available'); |
|
| 53 | + if (!parent::offsetExists($index)) { |
|
| 54 | + throw new Exception('Index "'.var_export($index, true).'" for tx_crawler_domain_process are not available'); |
|
| 55 | 55 | } |
| 56 | 56 | return parent::offsetGet($index); |
| 57 | 57 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function offsetSet($index, $subject) |
| 68 | 68 | { |
| 69 | - if (! $subject instanceof tx_crawler_domain_process) { |
|
| 69 | + if (!$subject instanceof tx_crawler_domain_process) { |
|
| 70 | 70 | throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!'); |
| 71 | 71 | } |
| 72 | 72 | parent::offsetSet($index, $subject); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function append($subject) |
| 82 | 82 | { |
| 83 | - if (! $subject instanceof tx_crawler_domain_process) { |
|
| 83 | + if (!$subject instanceof tx_crawler_domain_process) { |
|
| 84 | 84 | throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!'); |
| 85 | 85 | } |
| 86 | 86 | parent::append($subject); |
@@ -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 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | list($key, $value) = explode(':', $additionalHeader, 2); |
| 34 | 34 | $key = str_replace('-', '_', strtoupper(trim($key))); |
| 35 | 35 | if ($key != 'HOST') { |
| 36 | - $_SERVER['HTTP_' . $key] = $value; |
|
| 36 | + $_SERVER['HTTP_'.$key] = $value; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -54,18 +54,18 @@ discard block |
||
| 54 | 54 | $typo3SitePath = $_SERVER['argv'][1]; |
| 55 | 55 | |
| 56 | 56 | // faking the environment |
| 57 | -$_SERVER['DOCUMENT_ROOT'] = preg_replace('#' . preg_quote($typo3SitePath, '#') . '$#', '', $typo3Root); |
|
| 57 | +$_SERVER['DOCUMENT_ROOT'] = preg_replace('#'.preg_quote($typo3SitePath, '#').'$#', '', $typo3Root); |
|
| 58 | 58 | $_SERVER['HTTP_USER_AGENT'] = 'CLI Mode'; |
| 59 | 59 | $_SERVER['HTTP_HOST'] = $_SERVER['SERVER_NAME'] = $urlParts['host']; |
| 60 | -$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = $typo3SitePath . 'index.php'; |
|
| 61 | -$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'] = $typo3Root . 'index.php'; |
|
| 60 | +$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = $typo3SitePath.'index.php'; |
|
| 61 | +$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'] = $typo3Root.'index.php'; |
|
| 62 | 62 | $_SERVER['QUERY_STRING'] = (isset($urlParts['query']) ? $urlParts['query'] : ''); |
| 63 | -$_SERVER['REQUEST_URI'] = $urlParts['path'] . (isset($urlParts['query']) ? '?' . $urlParts['query'] : ''); |
|
| 63 | +$_SERVER['REQUEST_URI'] = $urlParts['path'].(isset($urlParts['query']) ? '?'.$urlParts['query'] : ''); |
|
| 64 | 64 | $_SERVER['REQUEST_METHOD'] = 'GET'; |
| 65 | 65 | |
| 66 | 66 | // Define a port if used in the URL: |
| 67 | 67 | if (isset($urlParts['port'])) { |
| 68 | - $_SERVER['HTTP_HOST'] .= ':' . $urlParts['port']; |
|
| 68 | + $_SERVER['HTTP_HOST'] .= ':'.$urlParts['port']; |
|
| 69 | 69 | $_SERVER['SERVER_PORT'] = $urlParts['port']; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | chdir($typo3Root); |
| 78 | -include($typo3Root . '/index.php'); |
|
| 78 | +include($typo3Root.'/index.php'); |
|
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * Checks if the $path is absolute or relative (detecting either '/' or 'x:/' as first part of string) and returns TRUE if so. |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | $this->cli_options[] = ['-d depth', 'Tree depth, 0-99', "How many levels under the 'page_id' to include."]; |
| 59 | 59 | $this->cli_options[] = ['-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!"]; |
| 60 | 60 | $this->cli_options[] = ['-n number', 'Number of items per minute.', 'Specifies how many items are put in the queue per minute. Only valid for output mode "queue"']; |
| 61 | - $this->cli_options[] = ['-conf configurationkeys','List of Configuration Keys','A commaseperated list of crawler configurations']; |
|
| 61 | + $this->cli_options[] = ['-conf configurationkeys', 'List of Configuration Keys', 'A commaseperated list of crawler configurations']; |
|
| 62 | 62 | # $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"); |
| 63 | 63 | |
| 64 | 64 | // Setting help texts: |
@@ -45,36 +45,36 @@ |
||
| 45 | 45 | { |
| 46 | 46 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\CrawlerQueueTask'] = [ |
| 47 | 47 | 'extension' => $extKey, |
| 48 | - 'title' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_im.name', |
|
| 49 | - 'description' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_im.description', |
|
| 48 | + 'title' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_im.name', |
|
| 49 | + 'description' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_im.description', |
|
| 50 | 50 | 'additionalFields' => CrawlerQueueTaskAdditionalFieldProvider::class |
| 51 | 51 | ]; |
| 52 | 52 | |
| 53 | 53 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\CrawlerTask'] = [ |
| 54 | 54 | 'extension' => $extKey, |
| 55 | - 'title' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawl.name', |
|
| 56 | - 'description' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawl.description', |
|
| 55 | + 'title' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawl.name', |
|
| 56 | + 'description' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawl.description', |
|
| 57 | 57 | 'additionalFields' => CrawlerTaskAdditionalFieldProvider::class |
| 58 | 58 | ]; |
| 59 | 59 | |
| 60 | 60 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\CrawlMultiProcessTask'] = [ |
| 61 | 61 | 'extension' => $extKey, |
| 62 | - 'title' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawlMultiProcess.name', |
|
| 63 | - 'description' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawl.description', |
|
| 62 | + 'title' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawlMultiProcess.name', |
|
| 63 | + 'description' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawl.description', |
|
| 64 | 64 | 'additionalFields' => CrawlMultiProcessTaskAdditionalFieldProvider::class |
| 65 | 65 | ]; |
| 66 | 66 | |
| 67 | 67 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\FlushQueueTask'] = [ |
| 68 | 68 | 'extension' => $extKey, |
| 69 | - 'title' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_flush.name', |
|
| 70 | - 'description' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_flush.description', |
|
| 69 | + 'title' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_flush.name', |
|
| 70 | + 'description' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_flush.description', |
|
| 71 | 71 | 'additionalFields' => FlushQueueTaskAdditionalFieldProvider::class |
| 72 | 72 | ]; |
| 73 | 73 | |
| 74 | 74 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\ProcessCleanupTask'] = [ |
| 75 | 75 | 'extension' => $extKey, |
| 76 | - 'title' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_processCleanup.name', |
|
| 77 | - 'description' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_processCleanup.description', |
|
| 76 | + 'title' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_processCleanup.name', |
|
| 77 | + 'description' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_processCleanup.description', |
|
| 78 | 78 | ]; |
| 79 | 79 | } |
| 80 | 80 | } |