@@ -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 | } |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | if (!isAbsPath($tempPathThisScript)) { |
13 | 13 | $workingDirectory = $_SERVER['PWD'] ? $_SERVER['PWD'] : getcwd(); |
14 | 14 | if ($workingDirectory) { |
15 | - $tempPathThisScript = $workingDirectory . '/' . preg_replace('/\.\//', '', $tempPathThisScript); |
|
15 | + $tempPathThisScript = $workingDirectory.'/'.preg_replace('/\.\//', '', $tempPathThisScript); |
|
16 | 16 | if (!@is_file($tempPathThisScript)) { |
17 | - die('Relative path found, but an error occured during resolving of the absolute path: ' . $tempPathThisScript . PHP_EOL); |
|
17 | + die('Relative path found, but an error occured during resolving of the absolute path: '.$tempPathThisScript.PHP_EOL); |
|
18 | 18 | } |
19 | 19 | } else { |
20 | - die('Relative path found, but resolving absolute path is not supported on this platform.' . PHP_EOL); |
|
20 | + die('Relative path found, but resolving absolute path is not supported on this platform.'.PHP_EOL); |
|
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | list($key, $value) = explode(':', $additionalHeader, 2); |
36 | 36 | $key = str_replace('-', '_', strtoupper(trim($key))); |
37 | 37 | if ($key != 'HOST') { |
38 | - $_SERVER['HTTP_' . $key] = $value; |
|
38 | + $_SERVER['HTTP_'.$key] = $value; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
@@ -57,18 +57,18 @@ discard block |
||
57 | 57 | $typo3SitePath = $_SERVER['argv'][1]; |
58 | 58 | |
59 | 59 | // faking the environment |
60 | -$_SERVER['DOCUMENT_ROOT'] = preg_replace('#' . preg_quote($typo3SitePath, '#') . '$#', '', $typo3Root); |
|
60 | +$_SERVER['DOCUMENT_ROOT'] = preg_replace('#'.preg_quote($typo3SitePath, '#').'$#', '', $typo3Root); |
|
61 | 61 | $_SERVER['HTTP_USER_AGENT'] = 'CLI Mode'; |
62 | 62 | $_SERVER['HTTP_HOST'] = $_SERVER['SERVER_NAME'] = $urlParts['host']; |
63 | -$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = $typo3SitePath . 'index.php'; |
|
64 | -$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'] = $typo3Root . 'index.php'; |
|
63 | +$_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'] = $typo3SitePath.'index.php'; |
|
64 | +$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'] = $typo3Root.'index.php'; |
|
65 | 65 | $_SERVER['QUERY_STRING'] = (isset($urlParts['query']) ? $urlParts['query'] : ''); |
66 | -$_SERVER['REQUEST_URI'] = $urlParts['path'] . (isset($urlParts['query']) ? '?' . $urlParts['query'] : ''); |
|
66 | +$_SERVER['REQUEST_URI'] = $urlParts['path'].(isset($urlParts['query']) ? '?'.$urlParts['query'] : ''); |
|
67 | 67 | $_SERVER['REQUEST_METHOD'] = 'GET'; |
68 | 68 | |
69 | 69 | // Define a port if used in the URL: |
70 | 70 | if (isset($urlParts['port'])) { |
71 | - $_SERVER['HTTP_HOST'] .= ':' . $urlParts['port']; |
|
71 | + $_SERVER['HTTP_HOST'] .= ':'.$urlParts['port']; |
|
72 | 72 | $_SERVER['SERVER_PORT'] = $urlParts['port']; |
73 | 73 | } |
74 | 74 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | chdir($typo3Root); |
81 | -include($typo3Root . '/index.php'); |
|
81 | +include($typo3Root.'/index.php'); |
|
82 | 82 | |
83 | 83 | |
84 | 84 | /** |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * @param void |
50 | 50 | * @return string table name |
51 | 51 | */ |
52 | - public static function getTableName(){ |
|
52 | + public static function getTableName() { |
|
53 | 53 | return self::$tableName; |
54 | 54 | } |
55 | 55 |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @return tx_crawler_domain_process |
49 | 49 | */ |
50 | 50 | public function offsetGet($index) { |
51 | - if (! parent::offsetExists($index)) { |
|
52 | - throw new Exception('Index "' . var_export($index, true) . '" for tx_crawler_domain_process are not available'); |
|
51 | + if (!parent::offsetExists($index)) { |
|
52 | + throw new Exception('Index "'.var_export($index, true).'" for tx_crawler_domain_process are not available'); |
|
53 | 53 | } |
54 | 54 | return parent::offsetGet($index); |
55 | 55 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return void |
64 | 64 | */ |
65 | 65 | public function offsetSet($index, $subject) { |
66 | - if (! $subject instanceof tx_crawler_domain_process ) { |
|
66 | + if (!$subject instanceof tx_crawler_domain_process) { |
|
67 | 67 | throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!'); |
68 | 68 | } |
69 | 69 | parent::offsetSet($index, $subject); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @return void |
77 | 77 | */ |
78 | 78 | public function append($subject) { |
79 | - if (! $subject instanceof tx_crawler_domain_process ) { |
|
79 | + if (!$subject instanceof tx_crawler_domain_process) { |
|
80 | 80 | throw new InvalidArgumentException('Wrong parameter type given, "tx_crawler_domain_process" expected!'); |
81 | 81 | } |
82 | 82 | parent::append($subject); |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | * @return array |
88 | 88 | */ |
89 | 89 | public function getProcessIds() { |
90 | - $result=array(); |
|
90 | + $result = array(); |
|
91 | 91 | foreach ($this->getIterator() as $value) { |
92 | - $result[]=$value->getProcess_id(); |
|
92 | + $result[] = $value->getProcess_id(); |
|
93 | 93 | } |
94 | 94 | return $result; |
95 | 95 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | protected function __construct() { |
72 | 72 | $this->observers = array(); |
73 | - if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'])) { |
|
73 | + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'])) { |
|
74 | 74 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'] as $classRef) { |
75 | 75 | $hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); |
76 | 76 | if (method_exists($hookObj, 'registerObservers')) { |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | * @return void |
123 | 123 | */ |
124 | 124 | public function post($event, $group, $attachedData) { |
125 | - if(is_array($this->observers[$event])) { |
|
126 | - foreach($this->observers[$event] as $eventObserver) { |
|
127 | - call_user_func(array($eventObserver['object'],$eventObserver['method']),$event,$group,$attachedData); |
|
125 | + if (is_array($this->observers[$event])) { |
|
126 | + foreach ($this->observers[$event] as $eventObserver) { |
|
127 | + call_user_func(array($eventObserver['object'], $eventObserver['method']), $event, $group, $attachedData); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public static function getInstance() { |
139 | 139 | |
140 | - if(!self::$instance instanceof tx_crawler_domain_events_dispatcher) { |
|
140 | + if (!self::$instance instanceof tx_crawler_domain_events_dispatcher) { |
|
141 | 141 | $dispatcher = new tx_crawler_domain_events_dispatcher(); |
142 | 142 | self::$instance = $dispatcher; |
143 | 143 | } |
@@ -42,36 +42,36 @@ |
||
42 | 42 | { |
43 | 43 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\CrawlerQueueTask'] = array( |
44 | 44 | 'extension' => $extKey, |
45 | - 'title' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_im.name', |
|
46 | - 'description' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_im.description', |
|
45 | + 'title' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_im.name', |
|
46 | + 'description' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_im.description', |
|
47 | 47 | 'additionalFields' => 'AOE\\Crawler\\Task\\CrawlerQueueTaskAdditionalFieldProvider' |
48 | 48 | ); |
49 | 49 | |
50 | 50 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\CrawlerTask'] = array( |
51 | 51 | 'extension' => $extKey, |
52 | - 'title' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawl.name', |
|
53 | - 'description' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawl.description', |
|
52 | + 'title' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawl.name', |
|
53 | + 'description' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawl.description', |
|
54 | 54 | 'additionalFields' => 'AOE\\Crawler\\Task\\CrawlerTaskAdditionalFieldProvider' |
55 | 55 | ); |
56 | 56 | |
57 | 57 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\CrawlMultiProcessTask'] = array( |
58 | 58 | 'extension' => $extKey, |
59 | - 'title' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawlMultiProcess.name', |
|
60 | - 'description' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_crawl.description', |
|
59 | + 'title' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawlMultiProcess.name', |
|
60 | + 'description' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_crawl.description', |
|
61 | 61 | 'additionalFields' => 'AOE\\Crawler\\Task\\CrawlMultiProcessTaskAdditionalFieldProvider' |
62 | 62 | ); |
63 | 63 | |
64 | 64 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\FlushQueueTask'] = array( |
65 | 65 | 'extension' => $extKey, |
66 | - 'title' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_flush.name', |
|
67 | - 'description' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_flush.description', |
|
66 | + 'title' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_flush.name', |
|
67 | + 'description' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_flush.description', |
|
68 | 68 | 'additionalFields' => 'AOE\\Crawler\\Task\\FlushQueueTaskAdditionalFieldProvider' |
69 | 69 | ); |
70 | 70 | |
71 | 71 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['AOE\\Crawler\\Task\\ProcessCleanupTask'] = array( |
72 | 72 | 'extension' => $extKey, |
73 | - 'title' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_processCleanup.name', |
|
74 | - 'description' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/Backend.xlf:crawler_processCleanup.description', |
|
73 | + 'title' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_processCleanup.name', |
|
74 | + 'description' => 'LLL:EXT:'.$extKey.'/Resources/Private/Language/Backend.xlf:crawler_processCleanup.description', |
|
75 | 75 | ); |
76 | 76 | } |
77 | 77 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | if (isset($_SERVER['HTTP_X_T3CRAWLER'])) { |
49 | 49 | //@todo: ask service to exclude current call for special reasons: for example no relevance because the language version is not affected |
50 | 50 | |
51 | - list($queueId,$hash) = explode(':', $_SERVER['HTTP_X_T3CRAWLER']); |
|
52 | - list($queueRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval($queueId)); |
|
51 | + list($queueId, $hash) = explode(':', $_SERVER['HTTP_X_T3CRAWLER']); |
|
52 | + list($queueRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid='.intval($queueId)); |
|
53 | 53 | |
54 | 54 | // If a crawler record was found and hash was matching, set it up: |
55 | 55 | if (is_array($queueRec) && $hash === md5($queueRec['qid'].'|'.$queueRec['set_id'].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | * Required because some extensions (staticpub) might never be requested to run due to some Core side effects |
120 | 120 | * and since this is considered as error the crawler should handle it properly |
121 | 121 | */ |
122 | - if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pollSuccess'])) { |
|
123 | - foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pollSuccess'] as $pollable) { |
|
124 | - if(is_array($params['pObj']->applicationData['tx_crawler']['content']['parameters']['procInstructions']) && in_array($pollable,$params['pObj']->applicationData['tx_crawler']['content']['parameters']['procInstructions'])){ |
|
125 | - if(empty($params['pObj']->applicationData['tx_crawler']['success'][$pollable])) { |
|
122 | + if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pollSuccess'])) { |
|
123 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['pollSuccess'] as $pollable) { |
|
124 | + if (is_array($params['pObj']->applicationData['tx_crawler']['content']['parameters']['procInstructions']) && in_array($pollable, $params['pObj']->applicationData['tx_crawler']['content']['parameters']['procInstructions'])) { |
|
125 | + if (empty($params['pObj']->applicationData['tx_crawler']['success'][$pollable])) { |
|
126 | 126 | $params['pObj']->applicationData['tx_crawler']['errorlog'][] = 'Error: Pollable extension ('.$pollable.') did not complete successfully.'; |
127 | 127 | } |
128 | 128 | } |