@@ -132,6 +132,7 @@ |
||
| 132 | 132 | /** |
| 133 | 133 | * Internal method to count items by a given where clause |
| 134 | 134 | * |
| 135 | + * @param string $where |
|
| 135 | 136 | */ |
| 136 | 137 | protected function countItemsByWhereClause($where) { |
| 137 | 138 | $db = $this->getDB(); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @return tx_crawler_domain_queue_entry $entry |
| 38 | 38 | */ |
| 39 | 39 | public function findYoungestEntryForProcess(tx_crawler_domain_process $process) { |
| 40 | - return $this->getFirstOrLastObjectByProcess($process,'exec_time ASC'); |
|
| 40 | + return $this->getFirstOrLastObjectByProcess($process, 'exec_time ASC'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @return tx_crawler_domain_queue_entry |
| 48 | 48 | */ |
| 49 | 49 | public function findOldestEntryForProcess(tx_crawler_domain_process $process) { |
| 50 | - return $this->getFirstOrLastObjectByProcess($process,'exec_time DESC'); |
|
| 50 | + return $this->getFirstOrLastObjectByProcess($process, 'exec_time DESC'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -60,15 +60,15 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | protected function getFirstOrLastObjectByProcess($process, $orderby) { |
| 62 | 62 | $db = $this->getDB(); |
| 63 | - $where = 'process_id_completed='.$db->fullQuoteStr($process->getProcess_id(),$this->tableName). |
|
| 63 | + $where = 'process_id_completed='.$db->fullQuoteStr($process->getProcess_id(), $this->tableName). |
|
| 64 | 64 | ' AND exec_time > 0 '; |
| 65 | 65 | $limit = 1; |
| 66 | 66 | $groupby = ''; |
| 67 | 67 | |
| 68 | - $res = $db->exec_SELECTgetRows('*','tx_crawler_queue',$where,$groupby,$orderby,$limit); |
|
| 69 | - if($res) { |
|
| 70 | - $first = $res[0]; |
|
| 71 | - }else{ |
|
| 68 | + $res = $db->exec_SELECTgetRows('*', 'tx_crawler_queue', $where, $groupby, $orderby, $limit); |
|
| 69 | + if ($res) { |
|
| 70 | + $first = $res[0]; |
|
| 71 | + } else { |
|
| 72 | 72 | $first = array(); |
| 73 | 73 | } |
| 74 | 74 | $resultObject = new tx_crawler_domain_queue_entry($first); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function countExtecutedItemsByProcess($process) { |
| 85 | 85 | |
| 86 | - return $this->countItemsByWhereClause('exec_time > 0 AND process_id_completed = '.$this->getDB()->fullQuoteStr($process->getProcess_id(),$this->tableName)); |
|
| 86 | + return $this->countItemsByWhereClause('exec_time > 0 AND process_id_completed = '.$this->getDB()->fullQuoteStr($process->getProcess_id(), $this->tableName)); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @return int |
| 94 | 94 | */ |
| 95 | 95 | public function countNonExecutedItemsByProcess($process) { |
| 96 | - return $this->countItemsByWhereClause('exec_time = 0 AND process_id = '.$this->getDB()->fullQuoteStr($process->getProcess_id(),$this->tableName)); |
|
| 96 | + return $this->countItemsByWhereClause('exec_time = 0 AND process_id = '.$this->getDB()->fullQuoteStr($process->getProcess_id(), $this->tableName)); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | protected function countItemsByWhereClause($where) { |
| 137 | 137 | $db = $this->getDB(); |
| 138 | - $rs = $db->exec_SELECTquery('count(*) as anz',$this->tableName,$where); |
|
| 139 | - $res = $db->sql_fetch_assoc($rs); |
|
| 138 | + $rs = $db->exec_SELECTquery('count(*) as anz', $this->tableName, $where); |
|
| 139 | + $res = $db->sql_fetch_assoc($rs); |
|
| 140 | 140 | |
| 141 | 141 | return $res['anz']; |
| 142 | 142 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $res = $db->exec_SELECTquery( |
| 203 | 203 | 'configuration, count(*) as c', |
| 204 | 204 | $this->tableName, |
| 205 | - 'set_id in ('. implode(',',$setIds).') AND scheduled < '.time(), |
|
| 205 | + 'set_id in ('.implode(',', $setIds).') AND scheduled < '.time(), |
|
| 206 | 206 | 'configuration' |
| 207 | 207 | ); |
| 208 | 208 | while ($row = $db->sql_fetch_assoc($res)) { |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * @author Fabrizio Branca <[email protected]> |
| 248 | 248 | * @since 2010-11-16 |
| 249 | 249 | */ |
| 250 | - public function getLastProcessedEntries($selectFields='*', $limit='100') { |
|
| 250 | + public function getLastProcessedEntries($selectFields = '*', $limit = '100') { |
|
| 251 | 251 | $db = $this->getDB(); |
| 252 | 252 | $res = $db->exec_SELECTquery( |
| 253 | 253 | $selectFields, |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $res = $db->exec_SELECTquery( |
| 280 | 280 | 'process_id_completed, min(exec_time) as start, max(exec_time) as end, count(*) as urlcount', |
| 281 | 281 | $this->tableName, |
| 282 | - 'exec_time != 0 and exec_time >= '.intval($start). ' and exec_time <= ' . intval($end), |
|
| 282 | + 'exec_time != 0 and exec_time >= '.intval($start).' and exec_time <= '.intval($end), |
|
| 283 | 283 | 'process_id_completed' |
| 284 | 284 | ); |
| 285 | 285 | |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | * This method is used to set the uid of the queue entry |
| 104 | 104 | * where the reason is relevant for. |
| 105 | 105 | * |
| 106 | - * @param int $entry_id |
|
| 106 | + * @param int $entry_uid |
|
| 107 | 107 | */ |
| 108 | 108 | public function setQueueEntryUid($entry_uid) { |
| 109 | 109 | $this->row['queue_entry_uid'] = $entry_uid; |
@@ -709,6 +709,7 @@ discard block |
||
| 709 | 709 | * @param array Page row or set-id |
| 710 | 710 | * @param string Title string |
| 711 | 711 | * @param int Items per Page setting |
| 712 | + * @param string $titleString |
|
| 712 | 713 | * @return string HTML <tr> content (one or more) |
| 713 | 714 | */ |
| 714 | 715 | function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) { |
@@ -1214,6 +1215,8 @@ discard block |
||
| 1214 | 1215 | * @param string Selector box name |
| 1215 | 1216 | * @param string Selector box value (array for multiple...) |
| 1216 | 1217 | * @param boolean If set, will draw multiple box. |
| 1218 | + * @param string $name |
|
| 1219 | + * @param integer $multiple |
|
| 1217 | 1220 | * @return string HTML select element |
| 1218 | 1221 | */ |
| 1219 | 1222 | function selectorBox($optArray, $name, $value, $multiple) { |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return array Menu array |
| 92 | 92 | */ |
| 93 | - function modMenu() { |
|
| 93 | + function modMenu() { |
|
| 94 | 94 | global $LANG; |
| 95 | 95 | |
| 96 | - return array ( |
|
| 96 | + return array( |
|
| 97 | 97 | 'depth' => array( |
| 98 | 98 | 0 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_0'), |
| 99 | 99 | 1 => $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.depth_1'), |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // Set CSS styles specific for this document: |
| 153 | - $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/',' |
|
| 153 | + $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/', ' |
|
| 154 | 154 | TABLE.c-list TR TD { white-space: nowrap; vertical-align: top; } |
| 155 | 155 | ',$this->pObj->content); |
| 156 | 156 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | |
| 197 | 197 | // Additional menus for the log type: |
| 198 | - if ($this->pObj->MOD_SETTINGS['crawlaction']==='log') { |
|
| 198 | + if ($this->pObj->MOD_SETTINGS['crawlaction'] === 'log') { |
|
| 199 | 199 | $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
| 200 | 200 | $this->pObj->id, |
| 201 | 201 | 'SET[depth]', |
@@ -204,15 +204,15 @@ discard block |
||
| 204 | 204 | 'index.php' |
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | - $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : ''; |
|
| 207 | + $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : ''; |
|
| 208 | 208 | |
| 209 | 209 | $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
| 210 | 210 | |
| 211 | - $h_func.= '<hr/>'. |
|
| 212 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id,'SET[log_display]',$this->pObj->MOD_SETTINGS['log_display'],$this->pObj->MOD_MENU['log_display'],'index.php','&setID='.$setId) . ' - ' . |
|
| 213 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_resultLog]',$this->pObj->MOD_SETTINGS['log_resultLog'],'index.php','&setID='.$setId . $quiPart) . ' - ' . |
|
| 214 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_feVars]',$this->pObj->MOD_SETTINGS['log_feVars'],'index.php','&setID='.$setId . $quiPart) . ' - ' . |
|
| 215 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' . |
|
| 211 | + $h_func .= '<hr/>'. |
|
| 212 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id, 'SET[log_display]', $this->pObj->MOD_SETTINGS['log_display'], $this->pObj->MOD_MENU['log_display'], 'index.php', '&setID='.$setId).' - '. |
|
| 213 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[log_resultLog]', $this->pObj->MOD_SETTINGS['log_resultLog'], 'index.php', '&setID='.$setId.$quiPart).' - '. |
|
| 214 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[log_feVars]', $this->pObj->MOD_SETTINGS['log_feVars'], 'index.php', '&setID='.$setId.$quiPart).' - '. |
|
| 215 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': '. |
|
| 216 | 216 | \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
| 217 | 217 | $this->pObj->id, |
| 218 | 218 | 'SET[itemsPerPage]', |
@@ -222,11 +222,11 @@ discard block |
||
| 222 | 222 | ); |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $theOutput= $this->pObj->doc->spacer(5); |
|
| 226 | - $theOutput.= $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1); |
|
| 225 | + $theOutput = $this->pObj->doc->spacer(5); |
|
| 226 | + $theOutput .= $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1); |
|
| 227 | 227 | |
| 228 | 228 | // Branch based on type: |
| 229 | - switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) { |
|
| 229 | + switch ((string) $this->pObj->MOD_SETTINGS['crawlaction']) { |
|
| 230 | 230 | case 'start': |
| 231 | 231 | if (empty($this->pObj->id)) { |
| 232 | 232 | $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected')); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * |
| 275 | 275 | * @return string HTML output |
| 276 | 276 | */ |
| 277 | - function drawURLs() { |
|
| 277 | + function drawURLs() { |
|
| 278 | 278 | global $BACK_PATH, $BE_USER; |
| 279 | 279 | |
| 280 | 280 | // Init: |
@@ -283,12 +283,12 @@ discard block |
||
| 283 | 283 | $this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download'); |
| 284 | 284 | $this->makeCrawlerProcessableChecks(); |
| 285 | 285 | |
| 286 | - switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) { |
|
| 286 | + switch ((string) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) { |
|
| 287 | 287 | case 'midnight': |
| 288 | - $this->scheduledTime = mktime(0,0,0); |
|
| 288 | + $this->scheduledTime = mktime(0, 0, 0); |
|
| 289 | 289 | break; |
| 290 | 290 | case '04:00': |
| 291 | - $this->scheduledTime = mktime(0,0,0)+4*3600; |
|
| 291 | + $this->scheduledTime = mktime(0, 0, 0) + 4 * 3600; |
|
| 292 | 292 | break; |
| 293 | 293 | case 'now': |
| 294 | 294 | default: |
@@ -308,23 +308,23 @@ discard block |
||
| 308 | 308 | $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime()); |
| 309 | 309 | |
| 310 | 310 | if (empty($this->incomingConfigurationSelection) |
| 311 | - || (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0])) |
|
| 311 | + || (count($this->incomingConfigurationSelection) == 1 && empty($this->incomingConfigurationSelection[0])) |
|
| 312 | 312 | ) { |
| 313 | - $code= ' |
|
| 313 | + $code = ' |
|
| 314 | 314 | <tr> |
| 315 | 315 | <td colspan="7"><b>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noConfigSelected').'</b></td> |
| 316 | 316 | </tr>'; |
| 317 | 317 | } else { |
| 318 | - if($this->submitCrawlUrls){ |
|
| 318 | + if ($this->submitCrawlUrls) { |
|
| 319 | 319 | $reason = new tx_crawler_domain_reason(); |
| 320 | 320 | $reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT); |
| 321 | 321 | |
| 322 | - if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; } |
|
| 322 | + if ($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication) { $username = $BE_USER->user['username']; } |
|
| 323 | 323 | $reason->setDetailText('The user '.$username.' added pages to the crawler queue manually '); |
| 324 | 324 | |
| 325 | - tx_crawler_domain_events_dispatcher::getInstance()->post( 'invokeQueueChange', |
|
| 325 | + tx_crawler_domain_events_dispatcher::getInstance()->post('invokeQueueChange', |
|
| 326 | 326 | $this->findCrawler()->setID, |
| 327 | - array( 'reason' => $reason )); |
|
| 327 | + array('reason' => $reason)); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | $code = $this->crawlerObj->getPageTreeAndUrls( |
@@ -345,18 +345,18 @@ discard block |
||
| 345 | 345 | $this->duplicateTrack = $this->crawlerObj->duplicateTrack; |
| 346 | 346 | |
| 347 | 347 | $output = ''; |
| 348 | - if ($code) { |
|
| 348 | + if ($code) { |
|
| 349 | 349 | |
| 350 | 350 | $output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>'; |
| 351 | 351 | $output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />'; |
| 352 | 352 | |
| 353 | - if (!$this->submitCrawlUrls) { |
|
| 353 | + if (!$this->submitCrawlUrls) { |
|
| 354 | 354 | $output .= $this->drawURLs_cfgSelectors().'<br />'; |
| 355 | 355 | $output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> '; |
| 356 | 356 | $output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> '; |
| 357 | 357 | $output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />'; |
| 358 | 358 | $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />'; |
| 359 | - $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />'; |
|
| 359 | + $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s', time()).'<br />'; |
|
| 360 | 360 | $output .= '<br /> |
| 361 | 361 | <table class="lrPadding c-list url-table">'. |
| 362 | 362 | $this->drawURLs_printTableHeader(). |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | // Download Urls to crawl: |
| 373 | - if ($this->downloadCrawlUrls) { |
|
| 373 | + if ($this->downloadCrawlUrls) { |
|
| 374 | 374 | |
| 375 | 375 | // Creating output header: |
| 376 | 376 | $mimeType = 'application/octet-stream'; |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | Header('Content-Disposition: attachment; filename=CrawlerUrls.txt'); |
| 379 | 379 | |
| 380 | 380 | // Printing the content of the CSV lines: |
| 381 | - echo implode(chr(13).chr(10),$this->downloadUrls); |
|
| 381 | + echo implode(chr(13).chr(10), $this->downloadUrls); |
|
| 382 | 382 | |
| 383 | 383 | // Exits: |
| 384 | 384 | exit; |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | * |
| 394 | 394 | * @return string HTML table |
| 395 | 395 | */ |
| 396 | - function drawURLs_cfgSelectors() { |
|
| 396 | + function drawURLs_cfgSelectors() { |
|
| 397 | 397 | |
| 398 | 398 | // depth |
| 399 | 399 | $cell[] = $this->selectorBox( |
@@ -409,11 +409,11 @@ discard block |
||
| 409 | 409 | $this->pObj->MOD_SETTINGS['depth'], |
| 410 | 410 | 0 |
| 411 | 411 | ); |
| 412 | - $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 ); |
|
| 412 | + $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'] ? $this->pObj->MOD_SETTINGS['depth'] : 0); |
|
| 413 | 413 | |
| 414 | 414 | // Configurations |
| 415 | 415 | $cell[] = $this->selectorBox( |
| 416 | - empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations), |
|
| 416 | + empty($availableConfigurations) ? array() : array_combine($availableConfigurations, $availableConfigurations), |
|
| 417 | 417 | 'configurationSelection', |
| 418 | 418 | $this->incomingConfigurationSelection, |
| 419 | 419 | 1 |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | * |
| 475 | 475 | * @return string Table header |
| 476 | 476 | */ |
| 477 | - function drawURLs_printTableHeader() { |
|
| 477 | + function drawURLs_printTableHeader() { |
|
| 478 | 478 | |
| 479 | 479 | $content = ' |
| 480 | 480 | <tr class="bgColor5 tableheader"> |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | * |
| 513 | 513 | * @return string HTML output |
| 514 | 514 | */ |
| 515 | - function drawLog() { |
|
| 515 | + function drawLog() { |
|
| 516 | 516 | global $BACK_PATH; |
| 517 | 517 | $output = ''; |
| 518 | 518 | |
@@ -524,46 +524,46 @@ discard block |
||
| 524 | 524 | $this->CSVExport = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_csv'); |
| 525 | 525 | |
| 526 | 526 | // Read URL: |
| 527 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')) { |
|
| 528 | - $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE); |
|
| 527 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')) { |
|
| 528 | + $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')), TRUE); |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | // Look for set ID sent - if it is, we will display contents of that set: |
| 532 | 532 | $showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
| 533 | 533 | |
| 534 | 534 | // Show details: |
| 535 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) { |
|
| 535 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) { |
|
| 536 | 536 | |
| 537 | 537 | // Get entry record: |
| 538 | - list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))); |
|
| 538 | + list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))); |
|
| 539 | 539 | |
| 540 | 540 | // Explode values: |
| 541 | 541 | $resStatus = $this->getResStatus($q_entry); |
| 542 | 542 | $q_entry['parameters'] = unserialize($q_entry['parameters']); |
| 543 | 543 | $q_entry['result_data'] = unserialize($q_entry['result_data']); |
| 544 | - if (is_array($q_entry['result_data'])) { |
|
| 544 | + if (is_array($q_entry['result_data'])) { |
|
| 545 | 545 | $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']); |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - if(!$this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
| 548 | + if (!$this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
| 549 | 549 | unset($q_entry['result_data']['content']['log']); |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | // Print rudimentary details: |
| 553 | 553 | $output .= ' |
| 554 | 554 | <br /><br /> |
| 555 | - <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" /> |
|
| 556 | - <input type="hidden" value="' . $this->pObj->id . '" name="id" /> |
|
| 557 | - <input type="hidden" value="' . $showSetId . '" name="setID" /> |
|
| 555 | + <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back').'" name="_back" /> |
|
| 556 | + <input type="hidden" value="' . $this->pObj->id.'" name="id" /> |
|
| 557 | + <input type="hidden" value="' . $showSetId.'" name="setID" /> |
|
| 558 | 558 | <br /> |
| 559 | - Current server time: ' . date('H:i:s', time()) . '<br />' . |
|
| 560 | - 'Status: ' . $resStatus . '<br />' . |
|
| 559 | + Current server time: ' . date('H:i:s', time()).'<br />'. |
|
| 560 | + 'Status: '.$resStatus.'<br />'. |
|
| 561 | 561 | \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry); |
| 562 | 562 | } else { // Show list: |
| 563 | 563 | |
| 564 | 564 | // If either id or set id, show list: |
| 565 | - if ($this->pObj->id || $showSetId) { |
|
| 566 | - if ($this->pObj->id) { |
|
| 565 | + if ($this->pObj->id || $showSetId) { |
|
| 566 | + if ($this->pObj->id) { |
|
| 567 | 567 | // Drawing tree: |
| 568 | 568 | $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView'); |
| 569 | 569 | $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); |
@@ -577,16 +577,16 @@ discard block |
||
| 577 | 577 | ); |
| 578 | 578 | |
| 579 | 579 | // Get branch beneath: |
| 580 | - if ($this->pObj->MOD_SETTINGS['depth']) { |
|
| 580 | + if ($this->pObj->MOD_SETTINGS['depth']) { |
|
| 581 | 581 | $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], ''); |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | // Traverse page tree: |
| 585 | 585 | $code = ''; $count = 0; |
| 586 | - foreach($tree->tree as $data) { |
|
| 586 | + foreach ($tree->tree as $data) { |
|
| 587 | 587 | $code .= $this->drawLog_addRows( |
| 588 | 588 | $data['row'], |
| 589 | - $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE), |
|
| 589 | + $data['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], TRUE), |
|
| 590 | 590 | intval($this->pObj->MOD_SETTINGS['itemsPerPage']) |
| 591 | 591 | ); |
| 592 | 592 | if (++$count == 1000) { |
@@ -595,13 +595,13 @@ discard block |
||
| 595 | 595 | } |
| 596 | 596 | } else { |
| 597 | 597 | $code = ''; |
| 598 | - $code.= $this->drawLog_addRows( |
|
| 598 | + $code .= $this->drawLog_addRows( |
|
| 599 | 599 | $showSetId, |
| 600 | 600 | 'Set ID: '.$showSetId |
| 601 | 601 | ); |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - if ($code) { |
|
| 604 | + if ($code) { |
|
| 605 | 605 | |
| 606 | 606 | $output .= ' |
| 607 | 607 | <br /><br /> |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | <input type="hidden" value="'.$this->pObj->id.'" name="id" /> |
| 613 | 613 | <input type="hidden" value="'.$showSetId.'" name="setID" /> |
| 614 | 614 | <br /> |
| 615 | - '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).' |
|
| 615 | + '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s', time()).' |
|
| 616 | 616 | <br /><br /> |
| 617 | 617 | |
| 618 | 618 | |
@@ -638,10 +638,10 @@ discard block |
||
| 638 | 638 | </tr> |
| 639 | 639 | '; |
| 640 | 640 | |
| 641 | - $cc=0; |
|
| 642 | - foreach($setList as $set) { |
|
| 643 | - $code.= ' |
|
| 644 | - <tr class="bgColor'.($cc%2 ? '-20':'-10').'"> |
|
| 641 | + $cc = 0; |
|
| 642 | + foreach ($setList as $set) { |
|
| 643 | + $code .= ' |
|
| 644 | + <tr class="bgColor'.($cc % 2 ? '-20' : '-10').'"> |
|
| 645 | 645 | <td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td> |
| 646 | 646 | <td>'.$set['count_value'].'</td> |
| 647 | 647 | <td>'.\TYPO3\CMS\Backend\Utility\BackendUtility::dateTimeAge($set['scheduled']).'</td> |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | } |
| 660 | 660 | } |
| 661 | 661 | |
| 662 | - if($this->CSVExport) { |
|
| 662 | + if ($this->CSVExport) { |
|
| 663 | 663 | $this->outputCsvFile(); |
| 664 | 664 | } |
| 665 | 665 | |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames); |
| 686 | 686 | |
| 687 | 687 | // Data: |
| 688 | - foreach($this->CSVaccu as $row) { |
|
| 688 | + foreach ($this->CSVaccu as $row) { |
|
| 689 | 689 | $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row); |
| 690 | 690 | } |
| 691 | 691 | |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | Header('Content-Disposition: attachment; filename=CrawlerLog.csv'); |
| 696 | 696 | |
| 697 | 697 | // Printing the content of the CSV lines: |
| 698 | - echo implode(chr(13).chr(10),$csvLines); |
|
| 698 | + echo implode(chr(13).chr(10), $csvLines); |
|
| 699 | 699 | |
| 700 | 700 | // Exits: |
| 701 | 701 | exit; |
@@ -710,14 +710,14 @@ discard block |
||
| 710 | 710 | * @param int Items per Page setting |
| 711 | 711 | * @return string HTML <tr> content (one or more) |
| 712 | 712 | */ |
| 713 | - function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) { |
|
| 713 | + function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage = 10) { |
|
| 714 | 714 | |
| 715 | 715 | // If Flush button is pressed, flush tables instead of selecting entries: |
| 716 | 716 | |
| 717 | - if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) { |
|
| 717 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) { |
|
| 718 | 718 | $doFlush = true; |
| 719 | 719 | $doFullFlush = false; |
| 720 | - } elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) { |
|
| 720 | + } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) { |
|
| 721 | 721 | $doFlush = true; |
| 722 | 722 | $doFullFlush = true; |
| 723 | 723 | } else { |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | // Get result: |
| 729 | - if (is_array($pageRow_setId)) { |
|
| 729 | + if (is_array($pageRow_setId)) { |
|
| 730 | 730 | $res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage)); |
| 731 | 731 | } else { |
| 732 | 732 | $res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage)); |
@@ -737,14 +737,14 @@ discard block |
||
| 737 | 737 | + ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0) |
| 738 | 738 | + ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0); |
| 739 | 739 | |
| 740 | - if (count($res)) { |
|
| 740 | + if (count($res)) { |
|
| 741 | 741 | // Traverse parameter combinations: |
| 742 | 742 | $c = 0; |
| 743 | - $content=''; |
|
| 744 | - foreach($res as $kk => $vv) { |
|
| 743 | + $content = ''; |
|
| 744 | + foreach ($res as $kk => $vv) { |
|
| 745 | 745 | |
| 746 | 746 | // Title column: |
| 747 | - if (!$c) { |
|
| 747 | + if (!$c) { |
|
| 748 | 748 | $titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>'; |
| 749 | 749 | } else { |
| 750 | 750 | $titleClm = ''; |
@@ -761,16 +761,16 @@ discard block |
||
| 761 | 761 | |
| 762 | 762 | // Put data into array: |
| 763 | 763 | $rowData = array(); |
| 764 | - if ($this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
| 764 | + if ($this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
| 765 | 765 | $rowData['result_log'] = $resLog; |
| 766 | 766 | } else { |
| 767 | - $rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate'); |
|
| 767 | + $rowData['scheduled'] = ($vv['scheduled'] > 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate'); |
|
| 768 | 768 | $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-'; |
| 769 | 769 | } |
| 770 | - $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50); |
|
| 770 | + $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus, 50); |
|
| 771 | 771 | $rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>'; |
| 772 | 772 | $rowData['feUserGroupList'] = $parameters['feUserGroupList']; |
| 773 | - $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : ''; |
|
| 773 | + $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ', $parameters['procInstructions']) : ''; |
|
| 774 | 774 | $rowData['set_id'] = $vv['set_id']; |
| 775 | 775 | |
| 776 | 776 | if ($this->pObj->MOD_SETTINGS['log_feVars']) { |
@@ -781,34 +781,34 @@ discard block |
||
| 781 | 781 | |
| 782 | 782 | $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
| 783 | 783 | |
| 784 | - $refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif'; |
|
| 785 | - if (version_compare(TYPO3_version,'7.0','>=')) { |
|
| 786 | - $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif'; |
|
| 784 | + $refreshIcon = $GLOBALS['BACK_PATH'].'gfx/refresh_n.gif'; |
|
| 785 | + if (version_compare(TYPO3_version, '7.0', '>=')) { |
|
| 786 | + $refreshIcon = $GLOBALS['BACK_PATH'].'sysext/t3skin/extjs/images/grid/refresh.gif'; |
|
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | // Put rows together: |
| 790 | - $content.= ' |
|
| 791 | - <tr class="bgColor'.($c%2 ? '-20':'-10').'"> |
|
| 790 | + $content .= ' |
|
| 791 | + <tr class="bgColor'.($c % 2 ? '-20' : '-10').'"> |
|
| 792 | 792 | '.$titleClm.' |
| 793 | - <td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)) . '">'.htmlspecialchars($vv['qid']).'</a></td> |
|
| 794 | - <td><a href="' . $this->getModuleUrl(array('qid_read' => $vv['qid'], 'setID' => $setId)) . '"><img src="' . $refreshIcon . '" width="14" hspace="1" vspace="2" height="14" border="0" title="'.htmlspecialchars('Read').'" alt="" /></a></td>'; |
|
| 795 | - foreach($rowData as $fKey => $value) { |
|
| 793 | + <td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)).'">'.htmlspecialchars($vv['qid']).'</a></td> |
|
| 794 | + <td><a href="' . $this->getModuleUrl(array('qid_read' => $vv['qid'], 'setID' => $setId)).'"><img src="'.$refreshIcon.'" width="14" hspace="1" vspace="2" height="14" border="0" title="'.htmlspecialchars('Read').'" alt="" /></a></td>'; |
|
| 795 | + foreach ($rowData as $fKey => $value) { |
|
| 796 | 796 | |
| 797 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey)) { |
|
| 798 | - $content.= ' |
|
| 797 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url', $fKey)) { |
|
| 798 | + $content .= ' |
|
| 799 | 799 | <td>'.$value.'</td>'; |
| 800 | 800 | } else { |
| 801 | - $content.= ' |
|
| 801 | + $content .= ' |
|
| 802 | 802 | <td>'.nl2br(htmlspecialchars($value)).'</td>'; |
| 803 | 803 | } |
| 804 | 804 | } |
| 805 | - $content.= ' |
|
| 805 | + $content .= ' |
|
| 806 | 806 | </tr>'; |
| 807 | 807 | $c++; |
| 808 | 808 | |
| 809 | - if ($this->CSVExport) { |
|
| 809 | + if ($this->CSVExport) { |
|
| 810 | 810 | // Only for CSV (adding qid and scheduled/exec_time if needed): |
| 811 | - $rowData['result_log'] = implode('// ',explode(chr(10),$resLog)); |
|
| 811 | + $rowData['result_log'] = implode('// ', explode(chr(10), $resLog)); |
|
| 812 | 812 | $rowData['qid'] = $vv['qid']; |
| 813 | 813 | $rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']); |
| 814 | 814 | $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-'; |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | * |
| 852 | 852 | * @return string Table header |
| 853 | 853 | */ |
| 854 | - function drawLog_printTableHeader() { |
|
| 854 | + function drawLog_printTableHeader() { |
|
| 855 | 855 | |
| 856 | 856 | $content = ' |
| 857 | 857 | <tr class="bgColor5 tableheader"> |
@@ -902,7 +902,7 @@ discard block |
||
| 902 | 902 | } |
| 903 | 903 | |
| 904 | 904 | function getResStatus($vv) { |
| 905 | - if ($vv['result_data']) { |
|
| 905 | + if ($vv['result_data']) { |
|
| 906 | 906 | $requestContent = unserialize($vv['result_data']); |
| 907 | 907 | $requestResult = unserialize($requestContent['content']); |
| 908 | 908 | if (is_array($requestResult)) { |
@@ -911,9 +911,9 @@ discard block |
||
| 911 | 911 | } else { |
| 912 | 912 | $resStatus = implode("\n", $requestResult['errorlog']); |
| 913 | 913 | } |
| 914 | - $resLog = is_array($requestResult['log']) ? implode(chr(10),$requestResult['log']) : ''; |
|
| 914 | + $resLog = is_array($requestResult['log']) ? implode(chr(10), $requestResult['log']) : ''; |
|
| 915 | 915 | } else { |
| 916 | - $resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...'; |
|
| 916 | + $resStatus = 'Error: '.substr(preg_replace('/\s+/', ' ', strip_tags($requestContent['content'])), 0, 10000).'...'; |
|
| 917 | 917 | } |
| 918 | 918 | } else { |
| 919 | 919 | $resStatus = '-'; |
@@ -941,7 +941,7 @@ discard block |
||
| 941 | 941 | * @param void |
| 942 | 942 | * @return string |
| 943 | 943 | */ |
| 944 | - protected function drawProcessOverviewAction(){ |
|
| 944 | + protected function drawProcessOverviewAction() { |
|
| 945 | 945 | |
| 946 | 946 | $this->runRefreshHooks(); |
| 947 | 947 | |
@@ -955,20 +955,20 @@ discard block |
||
| 955 | 955 | $this->addErrorMessage($e->getMessage()); |
| 956 | 956 | } |
| 957 | 957 | |
| 958 | - $offset = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset')); |
|
| 959 | - $perpage = 20; |
|
| 958 | + $offset = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset')); |
|
| 959 | + $perpage = 20; |
|
| 960 | 960 | |
| 961 | - $processRepository = new tx_crawler_domain_process_repository(); |
|
| 962 | - $queueRepository = new tx_crawler_domain_queue_repository(); |
|
| 961 | + $processRepository = new tx_crawler_domain_process_repository(); |
|
| 962 | + $queueRepository = new tx_crawler_domain_queue_repository(); |
|
| 963 | 963 | |
| 964 | 964 | $mode = $this->pObj->MOD_SETTINGS['processListMode']; |
| 965 | 965 | if ($mode == 'detail') { |
| 966 | 966 | $where = ''; |
| 967 | - } elseif($mode == 'simple') { |
|
| 967 | + } elseif ($mode == 'simple') { |
|
| 968 | 968 | $where = 'active = 1'; |
| 969 | 969 | } |
| 970 | 970 | |
| 971 | - $allProcesses = $processRepository->findAll('ttl','DESC', $perpage, $offset,$where); |
|
| 971 | + $allProcesses = $processRepository->findAll('ttl', 'DESC', $perpage, $offset, $where); |
|
| 972 | 972 | $allCount = $processRepository->countAll($where); |
| 973 | 973 | |
| 974 | 974 | $listView = new tx_crawler_view_process_list(); |
@@ -980,10 +980,10 @@ discard block |
||
| 980 | 980 | $listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems()); |
| 981 | 981 | $listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems()); |
| 982 | 982 | $listView->setActiveProcessCount($processRepository->countActive()); |
| 983 | - $listView->setMaxActiveProcessCount(tx_crawler_api::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1)); |
|
| 983 | + $listView->setMaxActiveProcessCount(tx_crawler_api::forceIntegerInRange($this->extensionSettings['processLimit'], 1, 99, 1)); |
|
| 984 | 984 | $listView->setMode($mode); |
| 985 | 985 | |
| 986 | - $paginationView = new tx_crawler_view_pagination(); |
|
| 986 | + $paginationView = new tx_crawler_view_pagination(); |
|
| 987 | 987 | $paginationView->setCurrentOffset($offset); |
| 988 | 988 | $paginationView->setPerPage($perpage); |
| 989 | 989 | $paginationView->setTotalItemCount($allCount); |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | |
| 1021 | 1021 | $exitCode = 0; |
| 1022 | 1022 | $out = array(); |
| 1023 | - exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode); |
|
| 1023 | + exec(escapeshellcmd($this->extensionSettings['phpPath'].' -v'), $out, $exitCode); |
|
| 1024 | 1024 | if ($exitCode > 0) { |
| 1025 | 1025 | $this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath']))); |
| 1026 | 1026 | } |
@@ -1083,7 +1083,7 @@ discard block |
||
| 1083 | 1083 | * @param void |
| 1084 | 1084 | * @return void |
| 1085 | 1085 | */ |
| 1086 | - protected function handleProcessOverviewActions(){ |
|
| 1086 | + protected function handleProcessOverviewActions() { |
|
| 1087 | 1087 | |
| 1088 | 1088 | $crawler = $this->findCrawler(); |
| 1089 | 1089 | |
@@ -1116,8 +1116,8 @@ discard block |
||
| 1116 | 1116 | * @return tx_crawler_lib crawler object |
| 1117 | 1117 | * @author Timo Schmidt <[email protected]> |
| 1118 | 1118 | */ |
| 1119 | - protected function findCrawler(){ |
|
| 1120 | - if(!$this->crawlerObj instanceof tx_crawler_lib){ |
|
| 1119 | + protected function findCrawler() { |
|
| 1120 | + if (!$this->crawlerObj instanceof tx_crawler_lib) { |
|
| 1121 | 1121 | $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib'); |
| 1122 | 1122 | } |
| 1123 | 1123 | return $this->crawlerObj; |
@@ -1218,15 +1218,15 @@ discard block |
||
| 1218 | 1218 | * @param boolean If set, will draw multiple box. |
| 1219 | 1219 | * @return string HTML select element |
| 1220 | 1220 | */ |
| 1221 | - function selectorBox($optArray, $name, $value, $multiple) { |
|
| 1221 | + function selectorBox($optArray, $name, $value, $multiple) { |
|
| 1222 | 1222 | |
| 1223 | 1223 | $options = array(); |
| 1224 | - foreach($optArray as $key => $val) { |
|
| 1224 | + foreach ($optArray as $key => $val) { |
|
| 1225 | 1225 | $options[] = ' |
| 1226 | - <option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value,$key)) || ($multiple && in_array($key,(array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>'; |
|
| 1226 | + <option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value, $key)) || ($multiple && in_array($key, (array) $value)) ? ' selected="selected"' : '').'>'.htmlspecialchars($val).'</option>'; |
|
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | - $output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>'; |
|
| 1229 | + $output = '<select name="'.htmlspecialchars($name.($multiple ? '[]' : '')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('', $options).'</select>'; |
|
| 1230 | 1230 | |
| 1231 | 1231 | return $output; |
| 1232 | 1232 | } |
@@ -1265,6 +1265,6 @@ discard block |
||
| 1265 | 1265 | } |
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']) { |
|
| 1268 | +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']) { |
|
| 1269 | 1269 | include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']); |
| 1270 | 1270 | } |
@@ -123,7 +123,7 @@ |
||
| 123 | 123 | * Returns the total number of pages needed to display all content which |
| 124 | 124 | * is paginatable |
| 125 | 125 | * |
| 126 | - * @return int |
|
| 126 | + * @return double |
|
| 127 | 127 | */ |
| 128 | 128 | public function getTotalPagesCount() { |
| 129 | 129 | return ceil($this->getTotalItemCount() / $this->getPerPage()); |
@@ -111,6 +111,7 @@ discard block |
||
| 111 | 111 | * Set the page id |
| 112 | 112 | * |
| 113 | 113 | * @param int page id |
| 114 | + * @param integer $pageId |
|
| 114 | 115 | */ |
| 115 | 116 | public function setPageId($pageId) { |
| 116 | 117 | $this->pageId = $pageId; |
@@ -269,7 +270,7 @@ discard block |
||
| 269 | 270 | * Converts seconds into minutes |
| 270 | 271 | * |
| 271 | 272 | * @param int $seconds |
| 272 | - * @return int |
|
| 273 | + * @return double |
|
| 273 | 274 | */ |
| 274 | 275 | protected function asMinutes($seconds) { |
| 275 | 276 | return round($seconds / 60); |
@@ -409,7 +410,7 @@ discard block |
||
| 409 | 410 | * just a wrapper should be done in a cleaner way |
| 410 | 411 | * later on |
| 411 | 412 | * |
| 412 | - * @param $label |
|
| 413 | + * @param string $label |
|
| 413 | 414 | * @return string |
| 414 | 415 | */ |
| 415 | 416 | protected function getLLLabel($label) { |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @return string icon |
| 283 | 283 | */ |
| 284 | 284 | protected function getIconForState($state) { |
| 285 | - switch($state) { |
|
| 285 | + switch ($state) { |
|
| 286 | 286 | case 'running': |
| 287 | 287 | $icon = 'bullet_orange'; |
| 288 | 288 | $title = $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.running'); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * @return string |
| 316 | 316 | */ |
| 317 | 317 | protected function getRefreshLink() { |
| 318 | - return '<input onclick="window.location=\'' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_info') . '&SET[crawlaction]=multiprocess' . '\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_refresh.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.refresh') . '" />'; |
|
| 318 | + return '<input onclick="window.location=\''.\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_info').'&SET[crawlaction]=multiprocess'.'\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'arrow_refresh.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.refresh').'" />'; |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | /** |
@@ -334,9 +334,9 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | protected function getEnableDisableLink() { |
| 336 | 336 | if ($this->getIsCrawlerEnabled()) { |
| 337 | - return '<input onclick="window.location+=\'&action=stopCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_stop_blue.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.disablecrawling') . '" />'; |
|
| 337 | + return '<input onclick="window.location+=\'&action=stopCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'control_stop_blue.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.disablecrawling').'" />'; |
|
| 338 | 338 | } else { |
| 339 | - return '<input onclick="window.location+=\'&action=resumeCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'control_play.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.enablecrawling') . '" />'; |
|
| 339 | + return '<input onclick="window.location+=\'&action=resumeCrawling\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'control_play.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.enablecrawling').'" />'; |
|
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | |
@@ -348,9 +348,9 @@ discard block |
||
| 348 | 348 | */ |
| 349 | 349 | protected function getModeLink() { |
| 350 | 350 | if ($this->getMode() == 'detail') { |
| 351 | - return '<input onclick="window.location+=\'&SET[processListMode]=simple\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_in.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.running') . '" />'; |
|
| 351 | + return '<input onclick="window.location+=\'&SET[processListMode]=simple\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'arrow_in.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.running').'" />'; |
|
| 352 | 352 | } elseif ($this->getMode() == 'simple') { |
| 353 | - return '<input onclick="window.location+=\'&SET[processListMode]=detail\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'arrow_out.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.all') . '" />'; |
|
| 353 | + return '<input onclick="window.location+=\'&SET[processListMode]=detail\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'arrow_out.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.show.all').'" />'; |
|
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | */ |
| 363 | 363 | protected function getAddLink() { |
| 364 | 364 | if ($this->getActiveProcessCount() < $this->getMaxActiveProcessCount() && $this->getIsCrawlerEnabled()) { |
| 365 | - return '<input onclick="window.location+=\'&action=addProcess\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\'' . $this->getIconPath() . 'add.png' . '\'); background-repeat: no-repeat;" value="' . $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.add') . '" />'; |
|
| 365 | + return '<input onclick="window.location+=\'&action=addProcess\';" type="button" style="padding:4px 4px 4px 20px; background-position: 3px 3px; background-image: url(\''.$this->getIconPath().'add.png'.'\'); background-repeat: no-repeat;" value="'.$this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.add').'" />'; |
|
| 366 | 366 | } else { |
| 367 | 367 | return ''; |
| 368 | 368 | } |
@@ -383,11 +383,11 @@ discard block |
||
| 383 | 383 | * @param string $icon |
| 384 | 384 | * @return string html tag for icon |
| 385 | 385 | */ |
| 386 | - protected function getIcon($icon, $title='') { |
|
| 386 | + protected function getIcon($icon, $title = '') { |
|
| 387 | 387 | if (!empty($title)) { |
| 388 | 388 | $title = ' title="'.$title.'"'; |
| 389 | 389 | } |
| 390 | - return '<img src="'.$this->getIconPath().$icon.'.png" ' . $title . ' />'; |
|
| 390 | + return '<img src="'.$this->getIconPath().$icon.'.png" '.$title.' />'; |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | /** |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | * @param string $uri |
| 54 | 54 | * @param TypoScriptFrontendController $frontend |
| 55 | 55 | * |
| 56 | - * @return array |
|
| 56 | + * @return string[] |
|
| 57 | 57 | * |
| 58 | 58 | * @throws \Exception |
| 59 | 59 | * |
@@ -66,10 +66,10 @@ |
||
| 66 | 66 | if ($this->isCrawlerExtensionRunning($frontend) && preg_match('#^/index.php\?&?id=(\d+)(&.*)?$#', $uri, $matches)) { |
| 67 | 67 | $speakingUri = $frontend->cObj->typoLink_URL(array('parameter' => $matches[1], 'additionalParams' => $matches[2])); |
| 68 | 68 | $speakingUriParts = parse_url($speakingUri); |
| 69 | - if(false === $speakingUriParts){ |
|
| 70 | - throw new \Exception('Could not parse URI: ' . $speakingUri, 1289915976); |
|
| 69 | + if (false === $speakingUriParts) { |
|
| 70 | + throw new \Exception('Could not parse URI: '.$speakingUri, 1289915976); |
|
| 71 | 71 | } |
| 72 | - $speakingUrlPath = '/' . ltrim($speakingUriParts['path'], '/'); |
|
| 72 | + $speakingUrlPath = '/'.ltrim($speakingUriParts['path'], '/'); |
|
| 73 | 73 | // Don't change anything if speaking URL is part of old URI: |
| 74 | 74 | // (it might be the case the using the speaking URL failed) |
| 75 | 75 | if (strpos($uri, $speakingUrlPath) !== 0 || $speakingUrlPath === '/') { |
@@ -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 | |
@@ -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;"> |
@@ -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 | } |