@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $this->tableName, |
| 67 | 67 | $where, |
| 68 | 68 | '', |
| 69 | - htmlspecialchars($orderField) . ' ' . htmlspecialchars($orderDirection), |
|
| 69 | + htmlspecialchars($orderField).' '.htmlspecialchars($orderDirection), |
|
| 70 | 70 | self::getLimitFromItemCountAndOffset($itemCount, $offset) |
| 71 | 71 | ); |
| 72 | 72 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function countNotTimeouted($ttl) |
| 113 | 113 | { |
| 114 | - return $this->countByWhere('deleted = 0 AND ttl > ' . intval($ttl)); |
|
| 114 | + return $this->countByWhere('deleted = 0 AND ttl > '.intval($ttl)); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | $itemCount = filter_var($itemCount, FILTER_VALIDATE_INT, ['options' => ['min_range' => 1, 'default' => 20]]); |
| 129 | 129 | $offset = filter_var($offset, FILTER_VALIDATE_INT, ['options' => ['min_range' => 0, 'default' => 0]]); |
| 130 | - $limit = $offset . ', ' . $itemCount; |
|
| 130 | + $limit = $offset.', '.$itemCount; |
|
| 131 | 131 | |
| 132 | 132 | return $limit; |
| 133 | 133 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | public function execute() |
| 48 | 48 | { |
| 49 | 49 | $processManager = new \tx_crawler_domain_process_manager(); |
| 50 | - $timeout = is_int($this->timeOut) ? (int)$this->timeOut : 1800; |
|
| 50 | + $timeout = is_int($this->timeOut) ? (int) $this->timeOut : 1800; |
|
| 51 | 51 | |
| 52 | 52 | try { |
| 53 | 53 | $processManager->multiProcess($timeout); |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | { |
| 67 | 67 | $db = $this->getDB(); |
| 68 | 68 | $where = 'process_id_completed='.$db->fullQuoteStr($process->getProcess_id(), $this->tableName). |
| 69 | - ' AND exec_time > 0 '; |
|
| 69 | + ' AND exec_time > 0 '; |
|
| 70 | 70 | $limit = 1; |
| 71 | 71 | $groupby = ''; |
| 72 | 72 | |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | $limit = 1; |
| 68 | 68 | $groupby = ''; |
| 69 | 69 | |
| 70 | - $res = $db->exec_SELECTgetRows('*', 'tx_crawler_queue', $where, $groupby, $orderby, $limit); |
|
| 70 | + $res = $db->exec_SELECTgetRows('*', 'tx_crawler_queue', $where, $groupby, $orderby, $limit); |
|
| 71 | 71 | if ($res) { |
| 72 | - $first = $res[0]; |
|
| 72 | + $first = $res[0]; |
|
| 73 | 73 | } else { |
| 74 | 74 | $first = []; |
| 75 | 75 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | { |
| 144 | 144 | $db = $this->getDB(); |
| 145 | 145 | $rs = $db->exec_SELECTquery('count(*) as anz', $this->tableName, $where); |
| 146 | - $res = $db->sql_fetch_assoc($rs); |
|
| 146 | + $res = $db->sql_fetch_assoc($rs); |
|
| 147 | 147 | |
| 148 | 148 | return $res['anz']; |
| 149 | 149 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $res = $db->exec_SELECTquery( |
| 213 | 213 | 'configuration, count(*) as c', |
| 214 | 214 | $this->tableName, |
| 215 | - 'set_id in ('. implode(',', $setIds).') AND scheduled < '.time(), |
|
| 215 | + 'set_id in ('.implode(',', $setIds).') AND scheduled < '.time(), |
|
| 216 | 216 | 'configuration' |
| 217 | 217 | ); |
| 218 | 218 | while ($row = $db->sql_fetch_assoc($res)) { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @author Fabrizio Branca <[email protected]> |
| 259 | 259 | * @since 2010-11-16 |
| 260 | 260 | */ |
| 261 | - public function getLastProcessedEntries($selectFields='*', $limit='100') |
|
| 261 | + public function getLastProcessedEntries($selectFields = '*', $limit = '100') |
|
| 262 | 262 | { |
| 263 | 263 | $db = $this->getDB(); |
| 264 | 264 | $res = $db->exec_SELECTquery( |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | $res = $db->exec_SELECTquery( |
| 293 | 293 | 'process_id_completed, min(exec_time) as start, max(exec_time) as end, count(*) as urlcount', |
| 294 | 294 | $this->tableName, |
| 295 | - 'exec_time != 0 and exec_time >= '.intval($start). ' and exec_time <= ' . intval($end), |
|
| 295 | + 'exec_time != 0 and exec_time >= '.intval($start).' and exec_time <= '.intval($end), |
|
| 296 | 296 | 'process_id_completed' |
| 297 | 297 | ); |
| 298 | 298 | |
@@ -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,11 +49,11 @@ |
||
| 49 | 49 | |
| 50 | 50 | // Adding options to help archive: |
| 51 | 51 | /** |
| 52 | - * We removed the "proc" option as it seemd not to be working any more. But as the complete handling of the crawler has changed regarding the configuration |
|
| 53 | - * this is completely ok. Since configuration records were introduced to configure "what should be done" additionally to page ts the way to setup jobs |
|
| 54 | - * has drifted from selecting filtering processing instructions to selecting/filtering configuration keys (you can configure the processing instructions there). |
|
| 55 | - * This is also reflected in the backend modules and allows you a much clearer and powerful way to work with the crawler extension. |
|
| 56 | - */ |
|
| 52 | + * We removed the "proc" option as it seemd not to be working any more. But as the complete handling of the crawler has changed regarding the configuration |
|
| 53 | + * this is completely ok. Since configuration records were introduced to configure "what should be done" additionally to page ts the way to setup jobs |
|
| 54 | + * has drifted from selecting filtering processing instructions to selecting/filtering configuration keys (you can configure the processing instructions there). |
|
| 55 | + * This is also reflected in the backend modules and allows you a much clearer and powerful way to work with the crawler extension. |
|
| 56 | + */ |
|
| 57 | 57 | // $this->cli_options[] = array('-proc listOfProcInstr', 'Comma list of processing instructions. These are the "actions" carried out when crawling and you must specify at least one. Depends on third-party extensions. Examples are "tx_cachemgm_recache" from "cachemgm" extension (will recache pages), "tx_staticpub_publish" from "staticpub" (publishing pages to static files) or "tx_indexedsearch_reindex" from "indexed_search" (indexes pages).'); |
| 58 | 58 | // TODO: cleanup here! |
| 59 | 59 | $this->cli_options[] = ['-d depth', 'Tree depth, 0-99', "How many levels under the 'page_id' to include."]; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $this->cli_options[] = ['-d depth', 'Tree depth, 0-99', "How many levels under the 'page_id' to include."]; |
| 60 | 60 | $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!"]; |
| 61 | 61 | $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"']; |
| 62 | - $this->cli_options[] = ['-conf configurationkeys','List of Configuration Keys','A commaseperated list of crawler configurations']; |
|
| 62 | + $this->cli_options[] = ['-conf configurationkeys', 'List of Configuration Keys', 'A commaseperated list of crawler configurations']; |
|
| 63 | 63 | # $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"); |
| 64 | 64 | |
| 65 | 65 | // Setting help texts: |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $this->cli_help['synopsis'] = 'page_id ###OPTIONS###'; |
| 68 | 68 | $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."; |
| 69 | 69 | $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"; |
| 70 | - $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"; |
|
| 70 | + $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"; |
|
| 71 | 71 | $this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2009'; |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -9,5 +9,5 @@ |
||
| 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 | } |
@@ -53,16 +53,16 @@ |
||
| 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> |
| 60 | 60 | <td><?php echo htmlspecialchars($this->asDate($process->getTimeForLastItem())); ?></td> |
| 61 | - <td><?php echo htmlspecialchars(floor($process->getRuntime()/ 60)); ?> min. <?php echo htmlspecialchars($process->getRuntime()) % 60 ?> sec.</td> |
|
| 61 | + <td><?php echo htmlspecialchars(floor($process->getRuntime() / 60)); ?> min. <?php echo htmlspecialchars($process->getRuntime()) % 60 ?> sec.</td> |
|
| 62 | 62 | <td><?php echo htmlspecialchars($this->asDate($process->getTTL())); ?></td> |
| 63 | 63 | <td><?php echo htmlspecialchars($process->countItemsProcessed()); ?></td> |
| 64 | 64 | <td><?php echo htmlspecialchars($process->countItemsAssigned()); ?></td> |
| 65 | - <td><?php echo htmlspecialchars($process->countItemsToProcess()+$process->countItemsProcessed()); ?></td> |
|
| 65 | + <td><?php echo htmlspecialchars($process->countItemsToProcess() + $process->countItemsProcessed()); ?></td> |
|
| 66 | 66 | <td> |
| 67 | 67 | <?php if ($process->getState() == 'running'): ?> |
| 68 | 68 | <div class="crawlerprocessprogress" style="width: 200px;"> |
@@ -3,12 +3,12 @@ |
||
| 3 | 3 | } ?> |
| 4 | 4 | |
| 5 | 5 | Page: |
| 6 | -<?php for ($currentPageOffset = 0; $currentPageOffset < $this->getTotalPagesCount(); $currentPageOffset++) { |
|
| 6 | +<?php for ($currentPageOffset = 0; $currentPageOffset < $this->getTotalPagesCount(); $currentPageOffset++) { |
|
| 7 | 7 | ?> |
| 8 | 8 | <a href="index.php?offset=<?php echo htmlspecialchars($currentPageOffset * $this->getPerPage()); ?>"> |
| 9 | 9 | <?php echo htmlspecialchars($this->getLabelForPageOffset($currentPageOffset)); ?> |
| 10 | 10 | </a> |
| 11 | - <?php if ($currentPageOffset+1 < $this->getTotalPagesCount()) { |
|
| 11 | + <?php if ($currentPageOffset + 1 < $this->getTotalPagesCount()) { |
|
| 12 | 12 | ?> |
| 13 | 13 | | |
| 14 | 14 | <?php |
@@ -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); |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function getProcessIds() |
| 94 | 94 | { |
| 95 | - $result=[]; |
|
| 95 | + $result = []; |
|
| 96 | 96 | foreach ($this->getIterator() as $value) { |
| 97 | - $result[]=$value->getProcess_id(); |
|
| 97 | + $result[] = $value->getProcess_id(); |
|
| 98 | 98 | } |
| 99 | 99 | return $result; |
| 100 | 100 | } |