@@ -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 === '/') { |
@@ -209,7 +209,7 @@ |
||
209 | 209 | /** |
210 | 210 | * Determines if a page is queued |
211 | 211 | * |
212 | - * @param $uid |
|
212 | + * @param integer $uid |
|
213 | 213 | * @param bool $unprocessed_only |
214 | 214 | * @param bool $timed_only |
215 | 215 | * @param bool $timestamp |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | protected function findCrawler() |
93 | 93 | { |
94 | - if ( ! is_object($this->crawlerObj)) { |
|
94 | + if (!is_object($this->crawlerObj)) { |
|
95 | 95 | $this->crawlerObj = GeneralUtility::makeInstance('tx_crawler_lib'); |
96 | 96 | $this->crawlerObj->setID = GeneralUtility::md5int(microtime()); |
97 | 97 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | if (count($this->allowedConfigrations) > 0) { |
127 | 127 | // remove configuration that does not match the current selection |
128 | 128 | foreach ($configurations as $confKey => $confArray) { |
129 | - if ( ! in_array($confKey, $this->allowedConfigrations)) { |
|
129 | + if (!in_array($confKey, $this->allowedConfigrations)) { |
|
130 | 130 | unset($configurations[$confKey]); |
131 | 131 | } |
132 | 132 | } |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | //if the same page is scheduled for the same time and has not be executed? |
193 | 193 | if ($schedule_timestamp == 0) { |
194 | 194 | //untimed elements need an exec_time with 0 because they can occure multiple times |
195 | - $where = 'page_id=' . $page_uid . ' AND exec_time = 0 AND scheduled=' . $schedule_timestamp; |
|
195 | + $where = 'page_id='.$page_uid.' AND exec_time = 0 AND scheduled='.$schedule_timestamp; |
|
196 | 196 | } else { |
197 | 197 | //timed elementes have got a fixed schedule time, if a record with this time |
198 | 198 | //exists it is maybe queued for the future, or is has been queue for the past and therefore |
199 | 199 | //also been processed. |
200 | - $where = 'page_id=' . $page_uid . ' AND scheduled=' . $schedule_timestamp; |
|
200 | + $where = 'page_id='.$page_uid.' AND scheduled='.$schedule_timestamp; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*) as cnt', |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | $isPageInQueue = false; |
226 | 226 | |
227 | - $whereClause = 'page_id = ' . (integer)$uid; |
|
227 | + $whereClause = 'page_id = '.(integer) $uid; |
|
228 | 228 | |
229 | 229 | if (false !== $unprocessed_only) { |
230 | 230 | $whereClause .= ' AND exec_time = 0'; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | if (false !== $timestamp) { |
238 | - $whereClause .= ' AND scheduled = ' . (integer)$timestamp; |
|
238 | + $whereClause .= ' AND scheduled = '.(integer) $timestamp; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows( |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | { |
265 | 265 | $uid = intval($uid); |
266 | 266 | $query = 'max(scheduled) as latest'; |
267 | - $where = ' page_id = ' . $uid; |
|
267 | + $where = ' page_id = '.$uid; |
|
268 | 268 | |
269 | 269 | if ($future_crawldates_only) { |
270 | - $where .= ' AND scheduled > ' . time(); |
|
270 | + $where .= ' AND scheduled > '.time(); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | if ($unprocessed_only) { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $limit = $GLOBALS['TYPO3_DB']->fullQuoteStr($limit, 'tx_crawler_queue'); |
301 | 301 | |
302 | 302 | $query = 'scheduled, exec_time, set_id'; |
303 | - $where = ' page_id = ' . $uid; |
|
303 | + $where = ' page_id = '.$uid; |
|
304 | 304 | |
305 | 305 | $limit_query = ($limit) ? $limit : null; |
306 | 306 | |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | { |
379 | 379 | $qid = intval($qid); |
380 | 380 | $table = 'tx_crawler_queue'; |
381 | - $where = ' qid=' . $qid; |
|
381 | + $where = ' qid='.$qid; |
|
382 | 382 | $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where); |
383 | 383 | } |
384 | 384 | |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | */ |
407 | 407 | protected function getQueueRepository() |
408 | 408 | { |
409 | - if ( ! $this->queueRepository instanceof \tx_crawler_domain_queue_repository) { |
|
409 | + if (!$this->queueRepository instanceof \tx_crawler_domain_queue_repository) { |
|
410 | 410 | $this->queueRepository = new \tx_crawler_domain_queue_repository(); |
411 | 411 | } |
412 | 412 |
@@ -1054,8 +1054,9 @@ discard block |
||
1054 | 1054 | $isAvailable = false; |
1055 | 1055 | $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler'); |
1056 | 1056 | |
1057 | - if (is_array($userArray)) |
|
1058 | - $isAvailable = true; |
|
1057 | + if (is_array($userArray)) { |
|
1058 | + $isAvailable = true; |
|
1059 | + } |
|
1059 | 1060 | |
1060 | 1061 | return $isAvailable; |
1061 | 1062 | } |
@@ -1073,8 +1074,9 @@ discard block |
||
1073 | 1074 | $isAvailable = false; |
1074 | 1075 | $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler'); |
1075 | 1076 | |
1076 | - if (is_array($userArray) && $userArray[0]['admin'] == 0) |
|
1077 | - $isAvailable = true; |
|
1077 | + if (is_array($userArray) && $userArray[0]['admin'] == 0) { |
|
1078 | + $isAvailable = true; |
|
1079 | + } |
|
1078 | 1080 | |
1079 | 1081 | return $isAvailable; |
1080 | 1082 | } |
@@ -40,126 +40,126 @@ discard block |
||
40 | 40 | * @subpackage tx_crawler |
41 | 41 | */ |
42 | 42 | class tx_crawler_modfunc1 extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule { |
43 | - // Internal, dynamic: |
|
44 | - var $duplicateTrack = array(); |
|
45 | - var $submitCrawlUrls = FALSE; |
|
46 | - var $downloadCrawlUrls = FALSE; |
|
43 | + // Internal, dynamic: |
|
44 | + var $duplicateTrack = array(); |
|
45 | + var $submitCrawlUrls = FALSE; |
|
46 | + var $downloadCrawlUrls = FALSE; |
|
47 | 47 | |
48 | - var $scheduledTime = 0; |
|
49 | - var $reqMinute = 0; |
|
48 | + var $scheduledTime = 0; |
|
49 | + var $reqMinute = 0; |
|
50 | 50 | |
51 | - /** |
|
52 | - * @var array holds the selection of configuration from the configuration selector box |
|
53 | - */ |
|
54 | - var $incomingConfigurationSelection = array(); |
|
51 | + /** |
|
52 | + * @var array holds the selection of configuration from the configuration selector box |
|
53 | + */ |
|
54 | + var $incomingConfigurationSelection = array(); |
|
55 | 55 | |
56 | - /** |
|
57 | - * @var tx_crawler_lib |
|
58 | - */ |
|
59 | - var $crawlerObj; |
|
56 | + /** |
|
57 | + * @var tx_crawler_lib |
|
58 | + */ |
|
59 | + var $crawlerObj; |
|
60 | 60 | |
61 | - var $CSVaccu = array(); |
|
61 | + var $CSVaccu = array(); |
|
62 | 62 | |
63 | - /** |
|
64 | - * If true the user requested a CSV export of the queue |
|
65 | - * |
|
66 | - * @var boolean |
|
67 | - */ |
|
68 | - var $CSVExport = FALSE; |
|
69 | - |
|
70 | - var $downloadUrls = array(); |
|
63 | + /** |
|
64 | + * If true the user requested a CSV export of the queue |
|
65 | + * |
|
66 | + * @var boolean |
|
67 | + */ |
|
68 | + var $CSVExport = FALSE; |
|
71 | 69 | |
72 | - /** |
|
73 | - * Holds the configuration from ext_conf_template loaded by loadExtensionSettings() |
|
74 | - * |
|
75 | - * @var array |
|
76 | - */ |
|
77 | - protected $extensionSettings = array(); |
|
70 | + var $downloadUrls = array(); |
|
78 | 71 | |
79 | - /** |
|
80 | - * Indicate that an flash message with an error is present. |
|
81 | - * |
|
82 | - * @var boolean |
|
83 | - */ |
|
84 | - protected $isErrorDetected = false; |
|
85 | - |
|
86 | - /** |
|
87 | - * the constructor |
|
88 | - */ |
|
89 | - public function __construct() { |
|
90 | - $this->processManager = new tx_crawler_domain_process_manager(); |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * Additions to the function menu array |
|
95 | - * |
|
96 | - * @return array Menu array |
|
97 | - */ |
|
98 | - function modMenu() { |
|
99 | - global $LANG; |
|
100 | - |
|
101 | - return array ( |
|
102 | - 'depth' => array( |
|
103 | - 0 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'), |
|
104 | - 1 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'), |
|
105 | - 2 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'), |
|
106 | - 3 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'), |
|
107 | - 4 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'), |
|
108 | - 99 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'), |
|
109 | - ), |
|
110 | - 'crawlaction' => array( |
|
111 | - 'start' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.start'), |
|
112 | - 'log' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.log'), |
|
113 | - 'multiprocess' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.multiprocess') |
|
114 | - ), |
|
115 | - 'log_resultLog' => '', |
|
116 | - 'log_feVars' => '', |
|
117 | - 'processListMode' => '', |
|
118 | - 'log_display' => array( |
|
119 | - 'all' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.all'), |
|
120 | - 'pending' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pending'), |
|
121 | - 'finished' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.finished') |
|
122 | - ), |
|
123 | - 'itemsPerPage' => array( |
|
124 | - '5' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.5'), |
|
125 | - '10' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.10'), |
|
126 | - '50' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.50'), |
|
127 | - '0' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.0') |
|
128 | - ) |
|
129 | - ); |
|
130 | - } |
|
72 | + /** |
|
73 | + * Holds the configuration from ext_conf_template loaded by loadExtensionSettings() |
|
74 | + * |
|
75 | + * @var array |
|
76 | + */ |
|
77 | + protected $extensionSettings = array(); |
|
131 | 78 | |
132 | - /** |
|
133 | - * Load extension settings |
|
134 | - * |
|
135 | - * @param void |
|
136 | - * @return void |
|
137 | - */ |
|
138 | - protected function loadExtensionSettings() { |
|
139 | - $this->extensionSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['crawler']); |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * Main function |
|
144 | - * |
|
145 | - * @return string HTML output |
|
146 | - */ |
|
147 | - function main() { |
|
148 | - global $LANG, $BACK_PATH; |
|
79 | + /** |
|
80 | + * Indicate that an flash message with an error is present. |
|
81 | + * |
|
82 | + * @var boolean |
|
83 | + */ |
|
84 | + protected $isErrorDetected = false; |
|
85 | + |
|
86 | + /** |
|
87 | + * the constructor |
|
88 | + */ |
|
89 | + public function __construct() { |
|
90 | + $this->processManager = new tx_crawler_domain_process_manager(); |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * Additions to the function menu array |
|
95 | + * |
|
96 | + * @return array Menu array |
|
97 | + */ |
|
98 | + function modMenu() { |
|
99 | + global $LANG; |
|
100 | + |
|
101 | + return array ( |
|
102 | + 'depth' => array( |
|
103 | + 0 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'), |
|
104 | + 1 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'), |
|
105 | + 2 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'), |
|
106 | + 3 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'), |
|
107 | + 4 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'), |
|
108 | + 99 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'), |
|
109 | + ), |
|
110 | + 'crawlaction' => array( |
|
111 | + 'start' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.start'), |
|
112 | + 'log' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.log'), |
|
113 | + 'multiprocess' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.multiprocess') |
|
114 | + ), |
|
115 | + 'log_resultLog' => '', |
|
116 | + 'log_feVars' => '', |
|
117 | + 'processListMode' => '', |
|
118 | + 'log_display' => array( |
|
119 | + 'all' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.all'), |
|
120 | + 'pending' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pending'), |
|
121 | + 'finished' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.finished') |
|
122 | + ), |
|
123 | + 'itemsPerPage' => array( |
|
124 | + '5' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.5'), |
|
125 | + '10' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.10'), |
|
126 | + '50' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.50'), |
|
127 | + '0' => $LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage.0') |
|
128 | + ) |
|
129 | + ); |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * Load extension settings |
|
134 | + * |
|
135 | + * @param void |
|
136 | + * @return void |
|
137 | + */ |
|
138 | + protected function loadExtensionSettings() { |
|
139 | + $this->extensionSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['crawler']); |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * Main function |
|
144 | + * |
|
145 | + * @return string HTML output |
|
146 | + */ |
|
147 | + function main() { |
|
148 | + global $LANG, $BACK_PATH; |
|
149 | 149 | |
150 | - $this->incLocalLang(); |
|
150 | + $this->incLocalLang(); |
|
151 | 151 | |
152 | - $this->loadExtensionSettings(); |
|
153 | - if (empty($this->pObj->MOD_SETTINGS['processListMode'])) { |
|
154 | - $this->pObj->MOD_SETTINGS['processListMode'] = 'simple'; |
|
155 | - } |
|
152 | + $this->loadExtensionSettings(); |
|
153 | + if (empty($this->pObj->MOD_SETTINGS['processListMode'])) { |
|
154 | + $this->pObj->MOD_SETTINGS['processListMode'] = 'simple'; |
|
155 | + } |
|
156 | 156 | |
157 | - // Set CSS styles specific for this document: |
|
158 | - $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/',' |
|
157 | + // Set CSS styles specific for this document: |
|
158 | + $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/',' |
|
159 | 159 | TABLE.c-list TR TD { white-space: nowrap; vertical-align: top; } |
160 | 160 | ',$this->pObj->content); |
161 | 161 | |
162 | - $this->pObj->content .= '<style type="text/css"><!-- |
|
162 | + $this->pObj->content .= '<style type="text/css"><!-- |
|
163 | 163 | table.url-table, |
164 | 164 | table.param-expanded, |
165 | 165 | table.crawlerlog { |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | <link rel="stylesheet" type="text/css" href="'.$BACK_PATH.'../typo3conf/ext/crawler/template/res.css" /> |
178 | 178 | '; |
179 | 179 | |
180 | - // Type function menu: |
|
181 | - $h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
|
182 | - $this->pObj->id, |
|
183 | - 'SET[crawlaction]', |
|
184 | - $this->pObj->MOD_SETTINGS['crawlaction'], |
|
185 | - $this->pObj->MOD_MENU['crawlaction'], |
|
186 | - 'index.php' |
|
187 | - ); |
|
180 | + // Type function menu: |
|
181 | + $h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
|
182 | + $this->pObj->id, |
|
183 | + 'SET[crawlaction]', |
|
184 | + $this->pObj->MOD_SETTINGS['crawlaction'], |
|
185 | + $this->pObj->MOD_MENU['crawlaction'], |
|
186 | + 'index.php' |
|
187 | + ); |
|
188 | 188 | |
189 | - /* |
|
189 | + /* |
|
190 | 190 | // Showing depth-menu in certain cases: |
191 | 191 | if ($this->pObj->MOD_SETTINGS['crawlaction']!=='cli' && $this->pObj->MOD_SETTINGS['crawlaction']!== 'multiprocess' && ($this->pObj->MOD_SETTINGS['crawlaction']!=='log' || $this->pObj->id)) { |
192 | 192 | $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
@@ -199,62 +199,62 @@ discard block |
||
199 | 199 | } |
200 | 200 | */ |
201 | 201 | |
202 | - // Additional menus for the log type: |
|
203 | - if ($this->pObj->MOD_SETTINGS['crawlaction']==='log') { |
|
204 | - $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
|
205 | - $this->pObj->id, |
|
206 | - 'SET[depth]', |
|
207 | - $this->pObj->MOD_SETTINGS['depth'], |
|
208 | - $this->pObj->MOD_MENU['depth'], |
|
209 | - 'index.php' |
|
210 | - ); |
|
202 | + // Additional menus for the log type: |
|
203 | + if ($this->pObj->MOD_SETTINGS['crawlaction']==='log') { |
|
204 | + $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
|
205 | + $this->pObj->id, |
|
206 | + 'SET[depth]', |
|
207 | + $this->pObj->MOD_SETTINGS['depth'], |
|
208 | + $this->pObj->MOD_MENU['depth'], |
|
209 | + 'index.php' |
|
210 | + ); |
|
211 | + |
|
212 | + $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : ''; |
|
213 | + |
|
214 | + $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
|
215 | + |
|
216 | + $h_func.= '<hr/>'. |
|
217 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id,'SET[log_display]',$this->pObj->MOD_SETTINGS['log_display'],$this->pObj->MOD_MENU['log_display'],'index.php','&setID='.$setId) . ' - ' . |
|
218 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_resultLog]',$this->pObj->MOD_SETTINGS['log_resultLog'],'index.php','&setID='.$setId . $quiPart) . ' - ' . |
|
219 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_feVars]',$this->pObj->MOD_SETTINGS['log_feVars'],'index.php','&setID='.$setId . $quiPart) . ' - ' . |
|
220 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' . |
|
221 | + \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
|
222 | + $this->pObj->id, |
|
223 | + 'SET[itemsPerPage]', |
|
224 | + $this->pObj->MOD_SETTINGS['itemsPerPage'], |
|
225 | + $this->pObj->MOD_MENU['itemsPerPage'], |
|
226 | + 'index.php' |
|
227 | + ); |
|
228 | + } |
|
211 | 229 | |
212 | - $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : ''; |
|
213 | - |
|
214 | - $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
|
215 | - |
|
216 | - $h_func.= '<hr/>'. |
|
217 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id,'SET[log_display]',$this->pObj->MOD_SETTINGS['log_display'],$this->pObj->MOD_MENU['log_display'],'index.php','&setID='.$setId) . ' - ' . |
|
218 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_resultLog]',$this->pObj->MOD_SETTINGS['log_resultLog'],'index.php','&setID='.$setId . $quiPart) . ' - ' . |
|
219 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_feVars]',$this->pObj->MOD_SETTINGS['log_feVars'],'index.php','&setID='.$setId . $quiPart) . ' - ' . |
|
220 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' . |
|
221 | - \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
|
222 | - $this->pObj->id, |
|
223 | - 'SET[itemsPerPage]', |
|
224 | - $this->pObj->MOD_SETTINGS['itemsPerPage'], |
|
225 | - $this->pObj->MOD_MENU['itemsPerPage'], |
|
226 | - 'index.php' |
|
227 | - ); |
|
228 | - } |
|
230 | + $theOutput = $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1); |
|
229 | 231 | |
230 | - $theOutput = $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1); |
|
231 | - |
|
232 | - // Branch based on type: |
|
233 | - switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) { |
|
234 | - case 'start': |
|
235 | - if (empty($this->pObj->id)) { |
|
236 | - $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected')); |
|
237 | - } else { |
|
238 | - $theOutput .= $this->pObj->doc->section('', $this->drawURLs(), 0, 1); |
|
239 | - } |
|
240 | - break; |
|
241 | - case 'log': |
|
242 | - if (empty($this->pObj->id)) { |
|
243 | - $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected')); |
|
244 | - } else { |
|
245 | - $theOutput .= $this->pObj->doc->section('', $this->drawLog(), 0, 1); |
|
246 | - } |
|
247 | - break; |
|
248 | - case 'cli': |
|
249 | - $theOutput .= $this->pObj->doc->section('', $this->drawCLIstatus(), 0, 1); |
|
250 | - break; |
|
251 | - case 'multiprocess': |
|
252 | - $theOutput .= $this->pObj->doc->section('', $this->drawProcessOverviewAction(), 0, 1); |
|
253 | - break; |
|
254 | - } |
|
232 | + // Branch based on type: |
|
233 | + switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) { |
|
234 | + case 'start': |
|
235 | + if (empty($this->pObj->id)) { |
|
236 | + $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected')); |
|
237 | + } else { |
|
238 | + $theOutput .= $this->pObj->doc->section('', $this->drawURLs(), 0, 1); |
|
239 | + } |
|
240 | + break; |
|
241 | + case 'log': |
|
242 | + if (empty($this->pObj->id)) { |
|
243 | + $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected')); |
|
244 | + } else { |
|
245 | + $theOutput .= $this->pObj->doc->section('', $this->drawLog(), 0, 1); |
|
246 | + } |
|
247 | + break; |
|
248 | + case 'cli': |
|
249 | + $theOutput .= $this->pObj->doc->section('', $this->drawCLIstatus(), 0, 1); |
|
250 | + break; |
|
251 | + case 'multiprocess': |
|
252 | + $theOutput .= $this->pObj->doc->section('', $this->drawProcessOverviewAction(), 0, 1); |
|
253 | + break; |
|
254 | + } |
|
255 | 255 | |
256 | - return $theOutput; |
|
257 | - } |
|
256 | + return $theOutput; |
|
257 | + } |
|
258 | 258 | |
259 | 259 | |
260 | 260 | |
@@ -267,176 +267,176 @@ discard block |
||
267 | 267 | |
268 | 268 | |
269 | 269 | |
270 | - /******************************* |
|
270 | + /******************************* |
|
271 | 271 | * |
272 | 272 | * Generate URLs for crawling: |
273 | 273 | * |
274 | 274 | ******************************/ |
275 | 275 | |
276 | - /** |
|
277 | - * Produces a table with overview of the URLs to be crawled for each page |
|
278 | - * |
|
279 | - * @return string HTML output |
|
280 | - */ |
|
281 | - function drawURLs() { |
|
282 | - global $BACK_PATH, $BE_USER; |
|
283 | - |
|
284 | - // Init: |
|
285 | - $this->duplicateTrack = array(); |
|
286 | - $this->submitCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_crawl'); |
|
287 | - $this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download'); |
|
288 | - $this->makeCrawlerProcessableChecks(); |
|
289 | - |
|
290 | - switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) { |
|
291 | - case 'midnight': |
|
292 | - $this->scheduledTime = mktime(0,0,0); |
|
293 | - break; |
|
294 | - case '04:00': |
|
295 | - $this->scheduledTime = mktime(0,0,0)+4*3600; |
|
296 | - break; |
|
297 | - case 'now': |
|
298 | - default: |
|
299 | - $this->scheduledTime = time(); |
|
300 | - break; |
|
301 | - } |
|
302 | - // $this->reqMinute = \TYPO3\CMS\Core\Utility\GeneralUtility::intInRange(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('perminute'),1,10000); |
|
303 | - // TODO: check relevance |
|
304 | - $this->reqMinute = 1000; |
|
276 | + /** |
|
277 | + * Produces a table with overview of the URLs to be crawled for each page |
|
278 | + * |
|
279 | + * @return string HTML output |
|
280 | + */ |
|
281 | + function drawURLs() { |
|
282 | + global $BACK_PATH, $BE_USER; |
|
283 | + |
|
284 | + // Init: |
|
285 | + $this->duplicateTrack = array(); |
|
286 | + $this->submitCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_crawl'); |
|
287 | + $this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download'); |
|
288 | + $this->makeCrawlerProcessableChecks(); |
|
289 | + |
|
290 | + switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) { |
|
291 | + case 'midnight': |
|
292 | + $this->scheduledTime = mktime(0,0,0); |
|
293 | + break; |
|
294 | + case '04:00': |
|
295 | + $this->scheduledTime = mktime(0,0,0)+4*3600; |
|
296 | + break; |
|
297 | + case 'now': |
|
298 | + default: |
|
299 | + $this->scheduledTime = time(); |
|
300 | + break; |
|
301 | + } |
|
302 | + // $this->reqMinute = \TYPO3\CMS\Core\Utility\GeneralUtility::intInRange(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('perminute'),1,10000); |
|
303 | + // TODO: check relevance |
|
304 | + $this->reqMinute = 1000; |
|
305 | 305 | |
306 | 306 | |
307 | - $this->incomingConfigurationSelection = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('configurationSelection'); |
|
308 | - $this->incomingConfigurationSelection = is_array($this->incomingConfigurationSelection) ? $this->incomingConfigurationSelection : array(''); |
|
307 | + $this->incomingConfigurationSelection = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('configurationSelection'); |
|
308 | + $this->incomingConfigurationSelection = is_array($this->incomingConfigurationSelection) ? $this->incomingConfigurationSelection : array(''); |
|
309 | 309 | |
310 | - $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib'); |
|
311 | - $this->crawlerObj->setAccessMode('gui'); |
|
312 | - $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime()); |
|
310 | + $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib'); |
|
311 | + $this->crawlerObj->setAccessMode('gui'); |
|
312 | + $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime()); |
|
313 | 313 | |
314 | - if (empty($this->incomingConfigurationSelection) |
|
315 | - || (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0])) |
|
316 | - ) { |
|
317 | - $code= ' |
|
314 | + if (empty($this->incomingConfigurationSelection) |
|
315 | + || (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0])) |
|
316 | + ) { |
|
317 | + $code= ' |
|
318 | 318 | <tr> |
319 | 319 | <td colspan="7"><b>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noConfigSelected').'</b></td> |
320 | 320 | </tr>'; |
321 | - } else { |
|
322 | - if($this->submitCrawlUrls){ |
|
323 | - $reason = new tx_crawler_domain_reason(); |
|
324 | - $reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT); |
|
321 | + } else { |
|
322 | + if($this->submitCrawlUrls){ |
|
323 | + $reason = new tx_crawler_domain_reason(); |
|
324 | + $reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT); |
|
325 | + |
|
326 | + if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; } |
|
327 | + $reason->setDetailText('The user '.$username.' added pages to the crawler queue manually '); |
|
328 | + |
|
329 | + tx_crawler_domain_events_dispatcher::getInstance()->post( 'invokeQueueChange', |
|
330 | + $this->findCrawler()->setID, |
|
331 | + array( 'reason' => $reason )); |
|
332 | + } |
|
333 | + |
|
334 | + $code = $this->crawlerObj->getPageTreeAndUrls( |
|
335 | + $this->pObj->id, |
|
336 | + $this->pObj->MOD_SETTINGS['depth'], |
|
337 | + $this->scheduledTime, |
|
338 | + $this->reqMinute, |
|
339 | + $this->submitCrawlUrls, |
|
340 | + $this->downloadCrawlUrls, |
|
341 | + array(), // Do not filter any processing instructions |
|
342 | + $this->incomingConfigurationSelection |
|
343 | + ); |
|
325 | 344 | |
326 | - if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; } |
|
327 | - $reason->setDetailText('The user '.$username.' added pages to the crawler queue manually '); |
|
328 | 345 | |
329 | - tx_crawler_domain_events_dispatcher::getInstance()->post( 'invokeQueueChange', |
|
330 | - $this->findCrawler()->setID, |
|
331 | - array( 'reason' => $reason )); |
|
332 | - } |
|
333 | - |
|
334 | - $code = $this->crawlerObj->getPageTreeAndUrls( |
|
335 | - $this->pObj->id, |
|
336 | - $this->pObj->MOD_SETTINGS['depth'], |
|
337 | - $this->scheduledTime, |
|
338 | - $this->reqMinute, |
|
339 | - $this->submitCrawlUrls, |
|
340 | - $this->downloadCrawlUrls, |
|
341 | - array(), // Do not filter any processing instructions |
|
342 | - $this->incomingConfigurationSelection |
|
343 | - ); |
|
344 | - |
|
345 | - |
|
346 | - } |
|
346 | + } |
|
347 | 347 | |
348 | - $this->downloadUrls = $this->crawlerObj->downloadUrls; |
|
349 | - $this->duplicateTrack = $this->crawlerObj->duplicateTrack; |
|
348 | + $this->downloadUrls = $this->crawlerObj->downloadUrls; |
|
349 | + $this->duplicateTrack = $this->crawlerObj->duplicateTrack; |
|
350 | 350 | |
351 | - $output = ''; |
|
352 | - if ($code) { |
|
351 | + $output = ''; |
|
352 | + if ($code) { |
|
353 | 353 | |
354 | - $output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>'; |
|
355 | - $output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />'; |
|
354 | + $output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>'; |
|
355 | + $output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />'; |
|
356 | 356 | |
357 | - if (!$this->submitCrawlUrls) { |
|
358 | - $output .= $this->drawURLs_cfgSelectors().'<br />'; |
|
359 | - $output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> '; |
|
360 | - $output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> '; |
|
361 | - $output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />'; |
|
362 | - $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />'; |
|
363 | - $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />'; |
|
364 | - $output .= '<br /> |
|
357 | + if (!$this->submitCrawlUrls) { |
|
358 | + $output .= $this->drawURLs_cfgSelectors().'<br />'; |
|
359 | + $output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> '; |
|
360 | + $output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> '; |
|
361 | + $output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />'; |
|
362 | + $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />'; |
|
363 | + $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />'; |
|
364 | + $output .= '<br /> |
|
365 | 365 | <table class="lrPadding c-list url-table">'. |
366 | - $this->drawURLs_printTableHeader(). |
|
367 | - $code. |
|
368 | - '</table>'; |
|
369 | - } else { |
|
370 | - $output .= count(array_keys($this->duplicateTrack)).' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.submitted').'. <br /><br />'; |
|
371 | - $output .= '<input type="submit" name="_" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continue').'" />'; |
|
372 | - $output .= '<input type="submit" onclick="this.form.elements[\'SET[crawlaction]\'].value=\'log\';" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continueinlog').'" />'; |
|
373 | - } |
|
374 | - } |
|
375 | - |
|
376 | - // Download Urls to crawl: |
|
377 | - if ($this->downloadCrawlUrls) { |
|
378 | - |
|
379 | - // Creating output header: |
|
380 | - $mimeType = 'application/octet-stream'; |
|
381 | - Header('Content-Type: '.$mimeType); |
|
382 | - Header('Content-Disposition: attachment; filename=CrawlerUrls.txt'); |
|
383 | - |
|
384 | - // Printing the content of the CSV lines: |
|
385 | - echo implode(chr(13).chr(10),$this->downloadUrls); |
|
366 | + $this->drawURLs_printTableHeader(). |
|
367 | + $code. |
|
368 | + '</table>'; |
|
369 | + } else { |
|
370 | + $output .= count(array_keys($this->duplicateTrack)).' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.submitted').'. <br /><br />'; |
|
371 | + $output .= '<input type="submit" name="_" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continue').'" />'; |
|
372 | + $output .= '<input type="submit" onclick="this.form.elements[\'SET[crawlaction]\'].value=\'log\';" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.continueinlog').'" />'; |
|
373 | + } |
|
374 | + } |
|
386 | 375 | |
387 | - // Exits: |
|
388 | - exit; |
|
389 | - } |
|
376 | + // Download Urls to crawl: |
|
377 | + if ($this->downloadCrawlUrls) { |
|
390 | 378 | |
391 | - // Return output: |
|
392 | - return $output; |
|
393 | - } |
|
379 | + // Creating output header: |
|
380 | + $mimeType = 'application/octet-stream'; |
|
381 | + Header('Content-Type: '.$mimeType); |
|
382 | + Header('Content-Disposition: attachment; filename=CrawlerUrls.txt'); |
|
394 | 383 | |
395 | - /** |
|
396 | - * Draws the configuration selectors for compiling URLs: |
|
397 | - * |
|
398 | - * @return string HTML table |
|
399 | - */ |
|
400 | - function drawURLs_cfgSelectors() { |
|
384 | + // Printing the content of the CSV lines: |
|
385 | + echo implode(chr(13).chr(10),$this->downloadUrls); |
|
401 | 386 | |
402 | - // depth |
|
403 | - $cell[] = $this->selectorBox( |
|
404 | - array( |
|
405 | - 0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'), |
|
406 | - 1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'), |
|
407 | - 2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'), |
|
408 | - 3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'), |
|
409 | - 4 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'), |
|
410 | - 99 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'), |
|
411 | - ), |
|
412 | - 'SET[depth]', |
|
413 | - $this->pObj->MOD_SETTINGS['depth'], |
|
414 | - 0 |
|
415 | - ); |
|
416 | - $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 ); |
|
417 | - |
|
418 | - // Configurations |
|
419 | - $cell[] = $this->selectorBox( |
|
420 | - empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations), |
|
421 | - 'configurationSelection', |
|
422 | - $this->incomingConfigurationSelection, |
|
423 | - 1 |
|
424 | - ); |
|
387 | + // Exits: |
|
388 | + exit; |
|
389 | + } |
|
425 | 390 | |
426 | - // Scheduled time: |
|
427 | - $cell[] = $this->selectorBox( |
|
428 | - array( |
|
429 | - 'now' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.now'), |
|
430 | - 'midnight' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.midnight'), |
|
431 | - '04:00' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.4am'), |
|
432 | - ), |
|
433 | - 'tstamp', |
|
434 | - \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('tstamp'), |
|
435 | - 0 |
|
436 | - ); |
|
391 | + // Return output: |
|
392 | + return $output; |
|
393 | + } |
|
437 | 394 | |
438 | - // TODO: check relevance |
|
439 | - /* |
|
395 | + /** |
|
396 | + * Draws the configuration selectors for compiling URLs: |
|
397 | + * |
|
398 | + * @return string HTML table |
|
399 | + */ |
|
400 | + function drawURLs_cfgSelectors() { |
|
401 | + |
|
402 | + // depth |
|
403 | + $cell[] = $this->selectorBox( |
|
404 | + array( |
|
405 | + 0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'), |
|
406 | + 1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'), |
|
407 | + 2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'), |
|
408 | + 3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'), |
|
409 | + 4 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'), |
|
410 | + 99 => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'), |
|
411 | + ), |
|
412 | + 'SET[depth]', |
|
413 | + $this->pObj->MOD_SETTINGS['depth'], |
|
414 | + 0 |
|
415 | + ); |
|
416 | + $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 ); |
|
417 | + |
|
418 | + // Configurations |
|
419 | + $cell[] = $this->selectorBox( |
|
420 | + empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations), |
|
421 | + 'configurationSelection', |
|
422 | + $this->incomingConfigurationSelection, |
|
423 | + 1 |
|
424 | + ); |
|
425 | + |
|
426 | + // Scheduled time: |
|
427 | + $cell[] = $this->selectorBox( |
|
428 | + array( |
|
429 | + 'now' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.now'), |
|
430 | + 'midnight' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.midnight'), |
|
431 | + '04:00' => $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time.4am'), |
|
432 | + ), |
|
433 | + 'tstamp', |
|
434 | + \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('tstamp'), |
|
435 | + 0 |
|
436 | + ); |
|
437 | + |
|
438 | + // TODO: check relevance |
|
439 | + /* |
|
440 | 440 | // Requests per minute: |
441 | 441 | $cell[] = $this->selectorBox( |
442 | 442 | array( |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | ); |
458 | 458 | */ |
459 | 459 | |
460 | - $output = ' |
|
460 | + $output = ' |
|
461 | 461 | <table class="lrPadding c-list"> |
462 | 462 | <tr class="bgColor5 tableheader"> |
463 | 463 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.depth').':</td> |
@@ -470,17 +470,17 @@ discard block |
||
470 | 470 | </tr> |
471 | 471 | </table>'; |
472 | 472 | |
473 | - return $output; |
|
474 | - } |
|
473 | + return $output; |
|
474 | + } |
|
475 | 475 | |
476 | - /** |
|
477 | - * Create Table header row for URL display |
|
478 | - * |
|
479 | - * @return string Table header |
|
480 | - */ |
|
481 | - function drawURLs_printTableHeader() { |
|
476 | + /** |
|
477 | + * Create Table header row for URL display |
|
478 | + * |
|
479 | + * @return string Table header |
|
480 | + */ |
|
481 | + function drawURLs_printTableHeader() { |
|
482 | 482 | |
483 | - $content = ' |
|
483 | + $content = ' |
|
484 | 484 | <tr class="bgColor5 tableheader"> |
485 | 485 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pagetitle').':</td> |
486 | 486 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.key').':</td> |
@@ -491,8 +491,8 @@ discard block |
||
491 | 491 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.parameters').':</td> |
492 | 492 | </tr>'; |
493 | 493 | |
494 | - return $content; |
|
495 | - } |
|
494 | + return $content; |
|
495 | + } |
|
496 | 496 | |
497 | 497 | |
498 | 498 | |
@@ -505,75 +505,75 @@ discard block |
||
505 | 505 | |
506 | 506 | |
507 | 507 | |
508 | - /******************************* |
|
508 | + /******************************* |
|
509 | 509 | * |
510 | 510 | * Shows log of indexed URLs |
511 | 511 | * |
512 | 512 | ******************************/ |
513 | 513 | |
514 | - /** |
|
515 | - * Shows the log of indexed URLs |
|
516 | - * |
|
517 | - * @return string HTML output |
|
518 | - */ |
|
519 | - function drawLog() { |
|
520 | - global $BACK_PATH; |
|
521 | - $output = ''; |
|
522 | - |
|
523 | - // Init: |
|
524 | - $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib'); |
|
525 | - $this->crawlerObj->setAccessMode('gui'); |
|
526 | - $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime()); |
|
527 | - |
|
528 | - $this->CSVExport = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_csv'); |
|
529 | - |
|
530 | - // Read URL: |
|
531 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')) { |
|
532 | - $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE); |
|
533 | - } |
|
514 | + /** |
|
515 | + * Shows the log of indexed URLs |
|
516 | + * |
|
517 | + * @return string HTML output |
|
518 | + */ |
|
519 | + function drawLog() { |
|
520 | + global $BACK_PATH; |
|
521 | + $output = ''; |
|
522 | + |
|
523 | + // Init: |
|
524 | + $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib'); |
|
525 | + $this->crawlerObj->setAccessMode('gui'); |
|
526 | + $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime()); |
|
527 | + |
|
528 | + $this->CSVExport = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_csv'); |
|
529 | + |
|
530 | + // Read URL: |
|
531 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')) { |
|
532 | + $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE); |
|
533 | + } |
|
534 | 534 | |
535 | - // Look for set ID sent - if it is, we will display contents of that set: |
|
536 | - $showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
|
535 | + // Look for set ID sent - if it is, we will display contents of that set: |
|
536 | + $showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
|
537 | 537 | |
538 | - // Show details: |
|
539 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) { |
|
538 | + // Show details: |
|
539 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) { |
|
540 | 540 | |
541 | - // Get entry record: |
|
542 | - list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))); |
|
541 | + // Get entry record: |
|
542 | + list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))); |
|
543 | 543 | |
544 | - // Explode values: |
|
545 | - $resStatus = $this->getResStatus($q_entry); |
|
546 | - $q_entry['parameters'] = unserialize($q_entry['parameters']); |
|
547 | - $q_entry['result_data'] = unserialize($q_entry['result_data']); |
|
548 | - if (is_array($q_entry['result_data'])) { |
|
549 | - $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']); |
|
550 | - } |
|
544 | + // Explode values: |
|
545 | + $resStatus = $this->getResStatus($q_entry); |
|
546 | + $q_entry['parameters'] = unserialize($q_entry['parameters']); |
|
547 | + $q_entry['result_data'] = unserialize($q_entry['result_data']); |
|
548 | + if (is_array($q_entry['result_data'])) { |
|
549 | + $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']); |
|
550 | + } |
|
551 | 551 | |
552 | - if(!$this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
553 | - unset($q_entry['result_data']['content']['log']); |
|
554 | - } |
|
552 | + if(!$this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
553 | + unset($q_entry['result_data']['content']['log']); |
|
554 | + } |
|
555 | 555 | |
556 | - // Print rudimentary details: |
|
557 | - $output .= ' |
|
556 | + // Print rudimentary details: |
|
557 | + $output .= ' |
|
558 | 558 | <br /><br /> |
559 | 559 | <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" /> |
560 | 560 | <input type="hidden" value="' . $this->pObj->id . '" name="id" /> |
561 | 561 | <input type="hidden" value="' . $showSetId . '" name="setID" /> |
562 | 562 | <br /> |
563 | 563 | Current server time: ' . date('H:i:s', time()) . '<br />' . |
564 | - 'Status: ' . $resStatus . '<br />' . |
|
565 | - \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry); |
|
566 | - } else { // Show list: |
|
567 | - |
|
568 | - // If either id or set id, show list: |
|
569 | - if ($this->pObj->id || $showSetId) { |
|
570 | - if ($this->pObj->id) { |
|
571 | - // Drawing tree: |
|
572 | - $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView'); |
|
573 | - $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); |
|
574 | - $tree->init('AND '.$perms_clause); |
|
575 | - |
|
576 | - // Set root row: |
|
564 | + 'Status: ' . $resStatus . '<br />' . |
|
565 | + \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry); |
|
566 | + } else { // Show list: |
|
567 | + |
|
568 | + // If either id or set id, show list: |
|
569 | + if ($this->pObj->id || $showSetId) { |
|
570 | + if ($this->pObj->id) { |
|
571 | + // Drawing tree: |
|
572 | + $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView'); |
|
573 | + $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); |
|
574 | + $tree->init('AND '.$perms_clause); |
|
575 | + |
|
576 | + // Set root row: |
|
577 | 577 | if (VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getCurrentTypo3Version()) < 8000000) { |
578 | 578 | $HTML = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord( |
579 | 579 | 'pages', |
@@ -583,39 +583,39 @@ discard block |
||
583 | 583 | $iconFactory = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Imaging\\IconFactory'); |
584 | 584 | $HTML = $iconFactory->getIconForRecord('pages', $this->pObj->pageinfo, Icon::SIZE_SMALL)->render(); |
585 | 585 | } |
586 | - $tree->tree[] = Array( |
|
587 | - 'row' => $this->pObj->pageinfo, |
|
588 | - 'HTML' => $HTML |
|
589 | - ); |
|
590 | - |
|
591 | - // Get branch beneath: |
|
592 | - if ($this->pObj->MOD_SETTINGS['depth']) { |
|
593 | - $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], ''); |
|
594 | - } |
|
595 | - |
|
596 | - // Traverse page tree: |
|
597 | - $code = ''; $count = 0; |
|
598 | - foreach($tree->tree as $data) { |
|
599 | - $code .= $this->drawLog_addRows( |
|
600 | - $data['row'], |
|
601 | - $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE), |
|
602 | - intval($this->pObj->MOD_SETTINGS['itemsPerPage']) |
|
603 | - ); |
|
604 | - if (++$count == 1000) { |
|
605 | - break; |
|
606 | - } |
|
607 | - } |
|
608 | - } else { |
|
609 | - $code = ''; |
|
610 | - $code.= $this->drawLog_addRows( |
|
611 | - $showSetId, |
|
612 | - 'Set ID: '.$showSetId |
|
613 | - ); |
|
614 | - } |
|
615 | - |
|
616 | - if ($code) { |
|
617 | - |
|
618 | - $output .= ' |
|
586 | + $tree->tree[] = Array( |
|
587 | + 'row' => $this->pObj->pageinfo, |
|
588 | + 'HTML' => $HTML |
|
589 | + ); |
|
590 | + |
|
591 | + // Get branch beneath: |
|
592 | + if ($this->pObj->MOD_SETTINGS['depth']) { |
|
593 | + $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], ''); |
|
594 | + } |
|
595 | + |
|
596 | + // Traverse page tree: |
|
597 | + $code = ''; $count = 0; |
|
598 | + foreach($tree->tree as $data) { |
|
599 | + $code .= $this->drawLog_addRows( |
|
600 | + $data['row'], |
|
601 | + $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE), |
|
602 | + intval($this->pObj->MOD_SETTINGS['itemsPerPage']) |
|
603 | + ); |
|
604 | + if (++$count == 1000) { |
|
605 | + break; |
|
606 | + } |
|
607 | + } |
|
608 | + } else { |
|
609 | + $code = ''; |
|
610 | + $code.= $this->drawLog_addRows( |
|
611 | + $showSetId, |
|
612 | + 'Set ID: '.$showSetId |
|
613 | + ); |
|
614 | + } |
|
615 | + |
|
616 | + if ($code) { |
|
617 | + |
|
618 | + $output .= ' |
|
619 | 619 | <br /><br /> |
620 | 620 | <input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.reloadlist').'" name="_reload" /> |
621 | 621 | <input type="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.downloadcsv').'" name="_csv" /> |
@@ -629,20 +629,20 @@ discard block |
||
629 | 629 | |
630 | 630 | |
631 | 631 | <table class="lrPadding c-list crawlerlog">'. |
632 | - $this->drawLog_printTableHeader(). |
|
633 | - $code. |
|
634 | - '</table>'; |
|
635 | - } |
|
636 | - } else { // Otherwise show available sets: |
|
637 | - $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( |
|
638 | - 'set_id, count(*) as count_value, scheduled', |
|
639 | - 'tx_crawler_queue', |
|
640 | - '', |
|
641 | - 'set_id, scheduled', |
|
642 | - 'scheduled DESC' |
|
643 | - ); |
|
644 | - |
|
645 | - $code = ' |
|
632 | + $this->drawLog_printTableHeader(). |
|
633 | + $code. |
|
634 | + '</table>'; |
|
635 | + } |
|
636 | + } else { // Otherwise show available sets: |
|
637 | + $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( |
|
638 | + 'set_id, count(*) as count_value, scheduled', |
|
639 | + 'tx_crawler_queue', |
|
640 | + '', |
|
641 | + 'set_id, scheduled', |
|
642 | + 'scheduled DESC' |
|
643 | + ); |
|
644 | + |
|
645 | + $code = ' |
|
646 | 646 | <tr class="bgColor5 tableheader"> |
647 | 647 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid').':</td> |
648 | 648 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').'t:</td> |
@@ -650,9 +650,9 @@ discard block |
||
650 | 650 | </tr> |
651 | 651 | '; |
652 | 652 | |
653 | - $cc=0; |
|
654 | - foreach($setList as $set) { |
|
655 | - $code.= ' |
|
653 | + $cc=0; |
|
654 | + foreach($setList as $set) { |
|
655 | + $code.= ' |
|
656 | 656 | <tr class="bgColor'.($cc%2 ? '-20':'-10').'"> |
657 | 657 | <td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td> |
658 | 658 | <td>'.$set['count_value'].'</td> |
@@ -660,218 +660,218 @@ discard block |
||
660 | 660 | </tr> |
661 | 661 | '; |
662 | 662 | |
663 | - $cc++; |
|
664 | - } |
|
663 | + $cc++; |
|
664 | + } |
|
665 | 665 | |
666 | - $output .= ' |
|
666 | + $output .= ' |
|
667 | 667 | <br /><br /> |
668 | 668 | <table class="lrPadding c-list">'. |
669 | - $code. |
|
670 | - '</table>'; |
|
671 | - } |
|
672 | - } |
|
669 | + $code. |
|
670 | + '</table>'; |
|
671 | + } |
|
672 | + } |
|
673 | 673 | |
674 | - if($this->CSVExport) { |
|
675 | - $this->outputCsvFile(); |
|
676 | - } |
|
674 | + if($this->CSVExport) { |
|
675 | + $this->outputCsvFile(); |
|
676 | + } |
|
677 | 677 | |
678 | - // Return output |
|
679 | - return $output; |
|
680 | - } |
|
678 | + // Return output |
|
679 | + return $output; |
|
680 | + } |
|
681 | 681 | |
682 | - /** |
|
683 | - * Outputs the CSV file and sets the correct headers |
|
684 | - */ |
|
685 | - protected function outputCsvFile() { |
|
682 | + /** |
|
683 | + * Outputs the CSV file and sets the correct headers |
|
684 | + */ |
|
685 | + protected function outputCsvFile() { |
|
686 | 686 | |
687 | - if (!count($this->CSVaccu)) { |
|
688 | - $this->addWarningMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.canNotExportEmptyQueueToCsvText')); |
|
689 | - return; |
|
690 | - } |
|
687 | + if (!count($this->CSVaccu)) { |
|
688 | + $this->addWarningMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.canNotExportEmptyQueueToCsvText')); |
|
689 | + return; |
|
690 | + } |
|
691 | 691 | |
692 | - $csvLines = array(); |
|
692 | + $csvLines = array(); |
|
693 | 693 | |
694 | - // Field names: |
|
695 | - reset($this->CSVaccu); |
|
696 | - $fieldNames = array_keys(current($this->CSVaccu)); |
|
697 | - $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames); |
|
694 | + // Field names: |
|
695 | + reset($this->CSVaccu); |
|
696 | + $fieldNames = array_keys(current($this->CSVaccu)); |
|
697 | + $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames); |
|
698 | 698 | |
699 | - // Data: |
|
700 | - foreach($this->CSVaccu as $row) { |
|
701 | - $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row); |
|
702 | - } |
|
699 | + // Data: |
|
700 | + foreach($this->CSVaccu as $row) { |
|
701 | + $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row); |
|
702 | + } |
|
703 | 703 | |
704 | - // Creating output header: |
|
705 | - $mimeType = 'application/octet-stream'; |
|
706 | - Header('Content-Type: '.$mimeType); |
|
707 | - Header('Content-Disposition: attachment; filename=CrawlerLog.csv'); |
|
704 | + // Creating output header: |
|
705 | + $mimeType = 'application/octet-stream'; |
|
706 | + Header('Content-Type: '.$mimeType); |
|
707 | + Header('Content-Disposition: attachment; filename=CrawlerLog.csv'); |
|
708 | 708 | |
709 | - // Printing the content of the CSV lines: |
|
710 | - echo implode(chr(13).chr(10),$csvLines); |
|
709 | + // Printing the content of the CSV lines: |
|
710 | + echo implode(chr(13).chr(10),$csvLines); |
|
711 | 711 | |
712 | - // Exits: |
|
713 | - exit; |
|
714 | - } |
|
712 | + // Exits: |
|
713 | + exit; |
|
714 | + } |
|
715 | 715 | |
716 | - /** |
|
717 | - * Create the rows for display of the page tree |
|
718 | - * For each page a number of rows are shown displaying GET variable configuration |
|
719 | - * |
|
720 | - * @param array $pageRow_setId Page row or set-id |
|
721 | - * @param string $titleString Title string |
|
722 | - * @param int $itemsPerPage Items per Page setting |
|
716 | + /** |
|
717 | + * Create the rows for display of the page tree |
|
718 | + * For each page a number of rows are shown displaying GET variable configuration |
|
723 | 719 | * |
724 | - * @return string HTML <tr> content (one or more) |
|
725 | - */ |
|
726 | - function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) { |
|
727 | - |
|
728 | - // If Flush button is pressed, flush tables instead of selecting entries: |
|
729 | - |
|
730 | - if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) { |
|
731 | - $doFlush = true; |
|
732 | - $doFullFlush = false; |
|
733 | - } elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) { |
|
734 | - $doFlush = true; |
|
735 | - $doFullFlush = true; |
|
736 | - } else { |
|
737 | - $doFlush = false; |
|
738 | - $doFullFlush = false; |
|
739 | - } |
|
720 | + * @param array $pageRow_setId Page row or set-id |
|
721 | + * @param string $titleString Title string |
|
722 | + * @param int $itemsPerPage Items per Page setting |
|
723 | + * |
|
724 | + * @return string HTML <tr> content (one or more) |
|
725 | + */ |
|
726 | + function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) { |
|
727 | + |
|
728 | + // If Flush button is pressed, flush tables instead of selecting entries: |
|
729 | + |
|
730 | + if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) { |
|
731 | + $doFlush = true; |
|
732 | + $doFullFlush = false; |
|
733 | + } elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) { |
|
734 | + $doFlush = true; |
|
735 | + $doFullFlush = true; |
|
736 | + } else { |
|
737 | + $doFlush = false; |
|
738 | + $doFullFlush = false; |
|
739 | + } |
|
740 | 740 | |
741 | - // Get result: |
|
742 | - if (is_array($pageRow_setId)) { |
|
743 | - $res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage)); |
|
744 | - } else { |
|
745 | - $res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage)); |
|
746 | - } |
|
741 | + // Get result: |
|
742 | + if (is_array($pageRow_setId)) { |
|
743 | + $res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage)); |
|
744 | + } else { |
|
745 | + $res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage)); |
|
746 | + } |
|
747 | + |
|
748 | + // Init var: |
|
749 | + $colSpan = 9 |
|
750 | + + ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0) |
|
751 | + + ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0); |
|
752 | + |
|
753 | + if (count($res)) { |
|
754 | + // Traverse parameter combinations: |
|
755 | + $c = 0; |
|
756 | + $content=''; |
|
757 | + foreach($res as $kk => $vv) { |
|
758 | + |
|
759 | + // Title column: |
|
760 | + if (!$c) { |
|
761 | + $titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>'; |
|
762 | + } else { |
|
763 | + $titleClm = ''; |
|
764 | + } |
|
765 | + |
|
766 | + // Result: |
|
767 | + $resLog = $this->getResultLog($vv); |
|
768 | + |
|
769 | + $resStatus = $this->getResStatus($vv); |
|
770 | + $resFeVars = $this->getResFeVars($vv); |
|
771 | + |
|
772 | + // Compile row: |
|
773 | + $parameters = unserialize($vv['parameters']); |
|
774 | + |
|
775 | + // Put data into array: |
|
776 | + $rowData = array(); |
|
777 | + if ($this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
778 | + $rowData['result_log'] = $resLog; |
|
779 | + } else { |
|
780 | + $rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate'); |
|
781 | + $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-'; |
|
782 | + } |
|
783 | + $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50); |
|
784 | + $rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>'; |
|
785 | + $rowData['feUserGroupList'] = $parameters['feUserGroupList']; |
|
786 | + $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : ''; |
|
787 | + $rowData['set_id'] = $vv['set_id']; |
|
788 | + |
|
789 | + if ($this->pObj->MOD_SETTINGS['log_feVars']) { |
|
790 | + $rowData['tsfe_id'] = $resFeVars['id']; |
|
791 | + $rowData['tsfe_gr_list'] = $resFeVars['gr_list']; |
|
792 | + $rowData['tsfe_no_cache'] = $resFeVars['no_cache']; |
|
793 | + } |
|
747 | 794 | |
748 | - // Init var: |
|
749 | - $colSpan = 9 |
|
750 | - + ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0) |
|
751 | - + ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0); |
|
752 | - |
|
753 | - if (count($res)) { |
|
754 | - // Traverse parameter combinations: |
|
755 | - $c = 0; |
|
756 | - $content=''; |
|
757 | - foreach($res as $kk => $vv) { |
|
758 | - |
|
759 | - // Title column: |
|
760 | - if (!$c) { |
|
761 | - $titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>'; |
|
762 | - } else { |
|
763 | - $titleClm = ''; |
|
764 | - } |
|
765 | - |
|
766 | - // Result: |
|
767 | - $resLog = $this->getResultLog($vv); |
|
768 | - |
|
769 | - $resStatus = $this->getResStatus($vv); |
|
770 | - $resFeVars = $this->getResFeVars($vv); |
|
771 | - |
|
772 | - // Compile row: |
|
773 | - $parameters = unserialize($vv['parameters']); |
|
774 | - |
|
775 | - // Put data into array: |
|
776 | - $rowData = array(); |
|
777 | - if ($this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
778 | - $rowData['result_log'] = $resLog; |
|
779 | - } else { |
|
780 | - $rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate'); |
|
781 | - $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-'; |
|
782 | - } |
|
783 | - $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50); |
|
784 | - $rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>'; |
|
785 | - $rowData['feUserGroupList'] = $parameters['feUserGroupList']; |
|
786 | - $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : ''; |
|
787 | - $rowData['set_id'] = $vv['set_id']; |
|
788 | - |
|
789 | - if ($this->pObj->MOD_SETTINGS['log_feVars']) { |
|
790 | - $rowData['tsfe_id'] = $resFeVars['id']; |
|
791 | - $rowData['tsfe_gr_list'] = $resFeVars['gr_list']; |
|
792 | - $rowData['tsfe_no_cache'] = $resFeVars['no_cache']; |
|
793 | - } |
|
794 | - |
|
795 | - $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
|
796 | - |
|
797 | - $refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif'; |
|
798 | - if (version_compare(TYPO3_version,'7.0','>=')) { |
|
799 | - $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif'; |
|
800 | - } |
|
801 | - |
|
802 | - // Put rows together: |
|
803 | - $content.= ' |
|
795 | + $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
|
796 | + |
|
797 | + $refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif'; |
|
798 | + if (version_compare(TYPO3_version,'7.0','>=')) { |
|
799 | + $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif'; |
|
800 | + } |
|
801 | + |
|
802 | + // Put rows together: |
|
803 | + $content.= ' |
|
804 | 804 | <tr class="bgColor'.($c%2 ? '-20':'-10').'"> |
805 | 805 | '.$titleClm.' |
806 | 806 | <td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)) . '">'.htmlspecialchars($vv['qid']).'</a></td> |
807 | 807 | <td><a href="' . $this->getModuleUrl(array('qid_read' => $vv['qid'], 'setID' => $setId)) . '"><img src="' . $refreshIcon . '" width="14" hspace="1" vspace="2" height="14" border="0" title="'.htmlspecialchars('Read').'" alt="" /></a></td>'; |
808 | - foreach($rowData as $fKey => $value) { |
|
808 | + foreach($rowData as $fKey => $value) { |
|
809 | 809 | |
810 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey)) { |
|
811 | - $content.= ' |
|
810 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey)) { |
|
811 | + $content.= ' |
|
812 | 812 | <td>'.$value.'</td>'; |
813 | - } else { |
|
814 | - $content.= ' |
|
813 | + } else { |
|
814 | + $content.= ' |
|
815 | 815 | <td>'.nl2br(htmlspecialchars($value)).'</td>'; |
816 | - } |
|
817 | - } |
|
818 | - $content.= ' |
|
816 | + } |
|
817 | + } |
|
818 | + $content.= ' |
|
819 | 819 | </tr>'; |
820 | - $c++; |
|
821 | - |
|
822 | - if ($this->CSVExport) { |
|
823 | - // Only for CSV (adding qid and scheduled/exec_time if needed): |
|
824 | - $rowData['result_log'] = implode('// ',explode(chr(10),$resLog)); |
|
825 | - $rowData['qid'] = $vv['qid']; |
|
826 | - $rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']); |
|
827 | - $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-'; |
|
828 | - $this->CSVaccu[] = $rowData; |
|
829 | - } |
|
830 | - } |
|
831 | - } else { |
|
820 | + $c++; |
|
821 | + |
|
822 | + if ($this->CSVExport) { |
|
823 | + // Only for CSV (adding qid and scheduled/exec_time if needed): |
|
824 | + $rowData['result_log'] = implode('// ',explode(chr(10),$resLog)); |
|
825 | + $rowData['qid'] = $vv['qid']; |
|
826 | + $rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']); |
|
827 | + $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-'; |
|
828 | + $this->CSVaccu[] = $rowData; |
|
829 | + } |
|
830 | + } |
|
831 | + } else { |
|
832 | 832 | |
833 | - // Compile row: |
|
834 | - $content = ' |
|
833 | + // Compile row: |
|
834 | + $content = ' |
|
835 | 835 | <tr class="bgColor-20"> |
836 | 836 | <td>'.$titleString.'</td> |
837 | 837 | <td colspan="'.$colSpan.'"><em>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noentries').'</em></td> |
838 | 838 | </tr>'; |
839 | - } |
|
839 | + } |
|
840 | 840 | |
841 | - return $content; |
|
842 | - } |
|
841 | + return $content; |
|
842 | + } |
|
843 | 843 | |
844 | - /** |
|
845 | - * Find Fe vars |
|
846 | - * |
|
847 | - * @param array $row |
|
848 | - * @return array |
|
849 | - */ |
|
850 | - function getResFeVars($row) { |
|
851 | - $feVars = array(); |
|
852 | - |
|
853 | - if ($row['result_data']) { |
|
854 | - $resultData = unserialize($row['result_data']); |
|
855 | - $requestResult = unserialize($resultData['content']); |
|
856 | - $feVars = $requestResult['vars']; |
|
857 | - } |
|
844 | + /** |
|
845 | + * Find Fe vars |
|
846 | + * |
|
847 | + * @param array $row |
|
848 | + * @return array |
|
849 | + */ |
|
850 | + function getResFeVars($row) { |
|
851 | + $feVars = array(); |
|
852 | + |
|
853 | + if ($row['result_data']) { |
|
854 | + $resultData = unserialize($row['result_data']); |
|
855 | + $requestResult = unserialize($resultData['content']); |
|
856 | + $feVars = $requestResult['vars']; |
|
857 | + } |
|
858 | 858 | |
859 | - return $feVars; |
|
860 | - } |
|
859 | + return $feVars; |
|
860 | + } |
|
861 | 861 | |
862 | - /** |
|
863 | - * Create Table header row (log) |
|
864 | - * |
|
865 | - * @return string Table header |
|
866 | - */ |
|
867 | - function drawLog_printTableHeader() { |
|
862 | + /** |
|
863 | + * Create Table header row (log) |
|
864 | + * |
|
865 | + * @return string Table header |
|
866 | + */ |
|
867 | + function drawLog_printTableHeader() { |
|
868 | 868 | |
869 | - $content = ' |
|
869 | + $content = ' |
|
870 | 870 | <tr class="bgColor5 tableheader"> |
871 | 871 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.pagetitle').':</td> |
872 | 872 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.qid').':</td> |
873 | 873 | <td> </td>'. |
874 | - ($this->pObj->MOD_SETTINGS['log_resultLog'] ? ' |
|
874 | + ($this->pObj->MOD_SETTINGS['log_resultLog'] ? ' |
|
875 | 875 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.resultlog').':</td>' : ' |
876 | 876 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.scheduledtime').':</td> |
877 | 877 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.runtime').':</td>').' |
@@ -880,14 +880,14 @@ discard block |
||
880 | 880 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.groups').':</td> |
881 | 881 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.procinstr').':</td> |
882 | 882 | <td>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid').':</td>'. |
883 | - ($this->pObj->MOD_SETTINGS['log_feVars'] ? ' |
|
883 | + ($this->pObj->MOD_SETTINGS['log_feVars'] ? ' |
|
884 | 884 | <td>'.htmlspecialchars('TSFE->id').'</td> |
885 | 885 | <td>'.htmlspecialchars('TSFE->gr_list').'</td> |
886 | 886 | <td>'.htmlspecialchars('TSFE->no_cache').'</td>' : '').' |
887 | 887 | </tr>'; |
888 | 888 | |
889 | - return $content; |
|
890 | - } |
|
889 | + return $content; |
|
890 | + } |
|
891 | 891 | |
892 | 892 | /** |
893 | 893 | * Extract the log information from the current row and retrive it as formatted string. |
@@ -914,25 +914,25 @@ discard block |
||
914 | 914 | return $content; |
915 | 915 | } |
916 | 916 | |
917 | - function getResStatus($vv) { |
|
918 | - if ($vv['result_data']) { |
|
919 | - $requestContent = unserialize($vv['result_data']); |
|
920 | - $requestResult = unserialize($requestContent['content']); |
|
921 | - if (is_array($requestResult)) { |
|
922 | - if (empty($requestResult['errorlog'])) { |
|
923 | - $resStatus = 'OK'; |
|
924 | - } else { |
|
925 | - $resStatus = implode("\n", $requestResult['errorlog']); |
|
926 | - } |
|
927 | - $resLog = is_array($requestResult['log']) ? implode(chr(10),$requestResult['log']) : ''; |
|
928 | - } else { |
|
929 | - $resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...'; |
|
930 | - } |
|
931 | - } else { |
|
932 | - $resStatus = '-'; |
|
933 | - } |
|
934 | - return $resStatus; |
|
935 | - } |
|
917 | + function getResStatus($vv) { |
|
918 | + if ($vv['result_data']) { |
|
919 | + $requestContent = unserialize($vv['result_data']); |
|
920 | + $requestResult = unserialize($requestContent['content']); |
|
921 | + if (is_array($requestResult)) { |
|
922 | + if (empty($requestResult['errorlog'])) { |
|
923 | + $resStatus = 'OK'; |
|
924 | + } else { |
|
925 | + $resStatus = implode("\n", $requestResult['errorlog']); |
|
926 | + } |
|
927 | + $resLog = is_array($requestResult['log']) ? implode(chr(10),$requestResult['log']) : ''; |
|
928 | + } else { |
|
929 | + $resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...'; |
|
930 | + } |
|
931 | + } else { |
|
932 | + $resStatus = '-'; |
|
933 | + } |
|
934 | + return $resStatus; |
|
935 | + } |
|
936 | 936 | |
937 | 937 | |
938 | 938 | |
@@ -941,344 +941,344 @@ discard block |
||
941 | 941 | |
942 | 942 | |
943 | 943 | |
944 | - /***************************** |
|
944 | + /***************************** |
|
945 | 945 | * |
946 | 946 | * CLI status display |
947 | 947 | * |
948 | 948 | *****************************/ |
949 | 949 | |
950 | - /** |
|
951 | - * This method is used to show an overview about the active an the finished crawling processes |
|
952 | - * |
|
953 | - * @author Timo Schmidt |
|
954 | - * @param void |
|
955 | - * @return string |
|
956 | - */ |
|
957 | - protected function drawProcessOverviewAction(){ |
|
958 | - |
|
959 | - $this->runRefreshHooks(); |
|
960 | - |
|
961 | - global $BACK_PATH; |
|
962 | - $this->makeCrawlerProcessableChecks(); |
|
963 | - |
|
964 | - $crawler = $this->findCrawler(); |
|
965 | - try { |
|
966 | - $this->handleProcessOverviewActions(); |
|
967 | - } catch (Exception $e) { |
|
968 | - $this->addErrorMessage($e->getMessage()); |
|
969 | - } |
|
950 | + /** |
|
951 | + * This method is used to show an overview about the active an the finished crawling processes |
|
952 | + * |
|
953 | + * @author Timo Schmidt |
|
954 | + * @param void |
|
955 | + * @return string |
|
956 | + */ |
|
957 | + protected function drawProcessOverviewAction(){ |
|
958 | + |
|
959 | + $this->runRefreshHooks(); |
|
960 | + |
|
961 | + global $BACK_PATH; |
|
962 | + $this->makeCrawlerProcessableChecks(); |
|
963 | + |
|
964 | + $crawler = $this->findCrawler(); |
|
965 | + try { |
|
966 | + $this->handleProcessOverviewActions(); |
|
967 | + } catch (Exception $e) { |
|
968 | + $this->addErrorMessage($e->getMessage()); |
|
969 | + } |
|
970 | 970 | |
971 | - $offset = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset')); |
|
972 | - $perpage = 20; |
|
971 | + $offset = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset')); |
|
972 | + $perpage = 20; |
|
973 | 973 | |
974 | - $processRepository = new tx_crawler_domain_process_repository(); |
|
975 | - $queueRepository = new tx_crawler_domain_queue_repository(); |
|
974 | + $processRepository = new tx_crawler_domain_process_repository(); |
|
975 | + $queueRepository = new tx_crawler_domain_queue_repository(); |
|
976 | 976 | |
977 | - $mode = $this->pObj->MOD_SETTINGS['processListMode']; |
|
978 | - if ($mode == 'detail') { |
|
979 | - $where = ''; |
|
980 | - } elseif($mode == 'simple') { |
|
981 | - $where = 'active = 1'; |
|
982 | - } |
|
977 | + $mode = $this->pObj->MOD_SETTINGS['processListMode']; |
|
978 | + if ($mode == 'detail') { |
|
979 | + $where = ''; |
|
980 | + } elseif($mode == 'simple') { |
|
981 | + $where = 'active = 1'; |
|
982 | + } |
|
983 | 983 | |
984 | - $allProcesses = $processRepository->findAll('ttl','DESC', $perpage, $offset,$where); |
|
985 | - $allCount = $processRepository->countAll($where); |
|
986 | - |
|
987 | - $listView = new tx_crawler_view_process_list(); |
|
988 | - $listView->setPageId($this->pObj->id); |
|
989 | - $listView->setIconPath($BACK_PATH.'../typo3conf/ext/crawler/template/process/res/img/'); |
|
990 | - $listView->setProcessCollection($allProcesses); |
|
991 | - $listView->setCliPath($this->processManager->getCrawlerCliPath()); |
|
992 | - $listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected); |
|
993 | - $listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems()); |
|
994 | - $listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems()); |
|
995 | - $listView->setActiveProcessCount($processRepository->countActive()); |
|
996 | - $listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1)); |
|
997 | - $listView->setMode($mode); |
|
998 | - |
|
999 | - $paginationView = new tx_crawler_view_pagination(); |
|
1000 | - $paginationView->setCurrentOffset($offset); |
|
1001 | - $paginationView->setPerPage($perpage); |
|
1002 | - $paginationView->setTotalItemCount($allCount); |
|
1003 | - |
|
1004 | - $output = $listView->render(); |
|
1005 | - |
|
1006 | - if ($paginationView->getTotalPagesCount() > 1) { |
|
1007 | - $output .= ' <br />'.$paginationView->render(); |
|
1008 | - } |
|
984 | + $allProcesses = $processRepository->findAll('ttl','DESC', $perpage, $offset,$where); |
|
985 | + $allCount = $processRepository->countAll($where); |
|
986 | + |
|
987 | + $listView = new tx_crawler_view_process_list(); |
|
988 | + $listView->setPageId($this->pObj->id); |
|
989 | + $listView->setIconPath($BACK_PATH.'../typo3conf/ext/crawler/template/process/res/img/'); |
|
990 | + $listView->setProcessCollection($allProcesses); |
|
991 | + $listView->setCliPath($this->processManager->getCrawlerCliPath()); |
|
992 | + $listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected); |
|
993 | + $listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems()); |
|
994 | + $listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems()); |
|
995 | + $listView->setActiveProcessCount($processRepository->countActive()); |
|
996 | + $listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1)); |
|
997 | + $listView->setMode($mode); |
|
998 | + |
|
999 | + $paginationView = new tx_crawler_view_pagination(); |
|
1000 | + $paginationView->setCurrentOffset($offset); |
|
1001 | + $paginationView->setPerPage($perpage); |
|
1002 | + $paginationView->setTotalItemCount($allCount); |
|
1003 | + |
|
1004 | + $output = $listView->render(); |
|
1005 | + |
|
1006 | + if ($paginationView->getTotalPagesCount() > 1) { |
|
1007 | + $output .= ' <br />'.$paginationView->render(); |
|
1008 | + } |
|
1009 | 1009 | |
1010 | - return $output; |
|
1011 | - } |
|
1010 | + return $output; |
|
1011 | + } |
|
1012 | 1012 | |
1013 | - /** |
|
1014 | - * Verify that the crawler is exectuable. |
|
1015 | - * |
|
1016 | - * @access protected |
|
1017 | - * @return void |
|
1018 | - * |
|
1019 | - * @author Michael Klapper <[email protected]> |
|
1020 | - */ |
|
1021 | - protected function makeCrawlerProcessableChecks() { |
|
1022 | - global $LANG; |
|
1023 | - |
|
1024 | - if ($this->isCrawlerUserAvailable() === false) { |
|
1025 | - $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noBeUserAvailable')); |
|
1026 | - } elseif ($this->isCrawlerUserNotAdmin() === false) { |
|
1027 | - $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.beUserIsAdmin')); |
|
1028 | - } |
|
1013 | + /** |
|
1014 | + * Verify that the crawler is exectuable. |
|
1015 | + * |
|
1016 | + * @access protected |
|
1017 | + * @return void |
|
1018 | + * |
|
1019 | + * @author Michael Klapper <[email protected]> |
|
1020 | + */ |
|
1021 | + protected function makeCrawlerProcessableChecks() { |
|
1022 | + global $LANG; |
|
1023 | + |
|
1024 | + if ($this->isCrawlerUserAvailable() === false) { |
|
1025 | + $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noBeUserAvailable')); |
|
1026 | + } elseif ($this->isCrawlerUserNotAdmin() === false) { |
|
1027 | + $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.beUserIsAdmin')); |
|
1028 | + } |
|
1029 | 1029 | |
1030 | - if ($this->isPhpForkAvailable() === false) { |
|
1031 | - $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noPhpForkAvailable')); |
|
1032 | - } |
|
1030 | + if ($this->isPhpForkAvailable() === false) { |
|
1031 | + $this->addErrorMessage($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.noPhpForkAvailable')); |
|
1032 | + } |
|
1033 | 1033 | |
1034 | - $exitCode = 0; |
|
1035 | - $out = array(); |
|
1036 | - exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode); |
|
1037 | - if ($exitCode > 0) { |
|
1038 | - $this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath']))); |
|
1039 | - } |
|
1040 | - } |
|
1034 | + $exitCode = 0; |
|
1035 | + $out = array(); |
|
1036 | + exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode); |
|
1037 | + if ($exitCode > 0) { |
|
1038 | + $this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath']))); |
|
1039 | + } |
|
1040 | + } |
|
1041 | 1041 | |
1042 | - /** |
|
1043 | - * Indicate that the required PHP method "popen" is |
|
1044 | - * available in the system. |
|
1045 | - * |
|
1046 | - * @access protected |
|
1047 | - * @return boolean |
|
1048 | - * |
|
1049 | - * @author Michael Klapper <[email protected]> |
|
1050 | - */ |
|
1051 | - protected function isPhpForkAvailable() { |
|
1052 | - return function_exists('popen'); |
|
1053 | - } |
|
1054 | - |
|
1055 | - /** |
|
1056 | - * Indicate that the required be_user "_cli_crawler" is |
|
1057 | - * global available in the system. |
|
1058 | - * |
|
1059 | - * @access protected |
|
1060 | - * @return boolean |
|
1061 | - * |
|
1062 | - * @author Michael Klapper <[email protected]> |
|
1063 | - */ |
|
1064 | - protected function isCrawlerUserAvailable() { |
|
1065 | - $isAvailable = false; |
|
1066 | - $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler'); |
|
1042 | + /** |
|
1043 | + * Indicate that the required PHP method "popen" is |
|
1044 | + * available in the system. |
|
1045 | + * |
|
1046 | + * @access protected |
|
1047 | + * @return boolean |
|
1048 | + * |
|
1049 | + * @author Michael Klapper <[email protected]> |
|
1050 | + */ |
|
1051 | + protected function isPhpForkAvailable() { |
|
1052 | + return function_exists('popen'); |
|
1053 | + } |
|
1054 | + |
|
1055 | + /** |
|
1056 | + * Indicate that the required be_user "_cli_crawler" is |
|
1057 | + * global available in the system. |
|
1058 | + * |
|
1059 | + * @access protected |
|
1060 | + * @return boolean |
|
1061 | + * |
|
1062 | + * @author Michael Klapper <[email protected]> |
|
1063 | + */ |
|
1064 | + protected function isCrawlerUserAvailable() { |
|
1065 | + $isAvailable = false; |
|
1066 | + $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler'); |
|
1067 | 1067 | |
1068 | - if (is_array($userArray)) |
|
1069 | - $isAvailable = true; |
|
1068 | + if (is_array($userArray)) |
|
1069 | + $isAvailable = true; |
|
1070 | 1070 | |
1071 | - return $isAvailable; |
|
1072 | - } |
|
1071 | + return $isAvailable; |
|
1072 | + } |
|
1073 | 1073 | |
1074 | - /** |
|
1075 | - * Indicate that the required be_user "_cli_crawler" is |
|
1076 | - * has no admin rights. |
|
1077 | - * |
|
1078 | - * @access protected |
|
1079 | - * @return boolean |
|
1080 | - * |
|
1081 | - * @author Michael Klapper <[email protected]> |
|
1082 | - */ |
|
1083 | - protected function isCrawlerUserNotAdmin() { |
|
1084 | - $isAvailable = false; |
|
1085 | - $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler'); |
|
1074 | + /** |
|
1075 | + * Indicate that the required be_user "_cli_crawler" is |
|
1076 | + * has no admin rights. |
|
1077 | + * |
|
1078 | + * @access protected |
|
1079 | + * @return boolean |
|
1080 | + * |
|
1081 | + * @author Michael Klapper <[email protected]> |
|
1082 | + */ |
|
1083 | + protected function isCrawlerUserNotAdmin() { |
|
1084 | + $isAvailable = false; |
|
1085 | + $userArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('be_users', 'username', '_cli_crawler'); |
|
1086 | 1086 | |
1087 | - if (is_array($userArray) && $userArray[0]['admin'] == 0) |
|
1088 | - $isAvailable = true; |
|
1087 | + if (is_array($userArray) && $userArray[0]['admin'] == 0) |
|
1088 | + $isAvailable = true; |
|
1089 | 1089 | |
1090 | - return $isAvailable; |
|
1091 | - } |
|
1090 | + return $isAvailable; |
|
1091 | + } |
|
1092 | 1092 | |
1093 | - /** |
|
1094 | - * Method to handle incomming actions of the process overview |
|
1095 | - * |
|
1096 | - * @param void |
|
1097 | - * @return void |
|
1098 | - */ |
|
1099 | - protected function handleProcessOverviewActions(){ |
|
1100 | - |
|
1101 | - $crawler = $this->findCrawler(); |
|
1102 | - |
|
1103 | - switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) { |
|
1104 | - case 'stopCrawling' : |
|
1105 | - //set the cli status to disable (all processes will be terminated) |
|
1106 | - $crawler->setDisabled(true); |
|
1107 | - break; |
|
1108 | - case 'resumeCrawling' : |
|
1109 | - //set the cli status to end (all processes will be terminated) |
|
1110 | - $crawler->setDisabled(false); |
|
1111 | - break; |
|
1112 | - case 'addProcess' : |
|
1113 | - $handle = $this->processManager->startProcess(); |
|
1114 | - if ($handle === false) { |
|
1115 | - throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocesserror')); |
|
1116 | - } |
|
1117 | - $this->addNoticeMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocess')); |
|
1118 | - break; |
|
1119 | - } |
|
1120 | - } |
|
1093 | + /** |
|
1094 | + * Method to handle incomming actions of the process overview |
|
1095 | + * |
|
1096 | + * @param void |
|
1097 | + * @return void |
|
1098 | + */ |
|
1099 | + protected function handleProcessOverviewActions(){ |
|
1100 | + |
|
1101 | + $crawler = $this->findCrawler(); |
|
1102 | + |
|
1103 | + switch (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action')) { |
|
1104 | + case 'stopCrawling' : |
|
1105 | + //set the cli status to disable (all processes will be terminated) |
|
1106 | + $crawler->setDisabled(true); |
|
1107 | + break; |
|
1108 | + case 'resumeCrawling' : |
|
1109 | + //set the cli status to end (all processes will be terminated) |
|
1110 | + $crawler->setDisabled(false); |
|
1111 | + break; |
|
1112 | + case 'addProcess' : |
|
1113 | + $handle = $this->processManager->startProcess(); |
|
1114 | + if ($handle === false) { |
|
1115 | + throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocesserror')); |
|
1116 | + } |
|
1117 | + $this->addNoticeMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.newprocess')); |
|
1118 | + break; |
|
1119 | + } |
|
1120 | + } |
|
1121 | 1121 | |
1122 | 1122 | |
1123 | 1123 | |
1124 | 1124 | |
1125 | - /** |
|
1126 | - * Returns the singleton instance of the crawler. |
|
1127 | - * |
|
1128 | - * @param void |
|
1129 | - * @return tx_crawler_lib crawler object |
|
1130 | - * @author Timo Schmidt <[email protected]> |
|
1131 | - */ |
|
1132 | - protected function findCrawler(){ |
|
1133 | - if(!$this->crawlerObj instanceof tx_crawler_lib){ |
|
1134 | - $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib'); |
|
1135 | - } |
|
1136 | - return $this->crawlerObj; |
|
1137 | - } |
|
1125 | + /** |
|
1126 | + * Returns the singleton instance of the crawler. |
|
1127 | + * |
|
1128 | + * @param void |
|
1129 | + * @return tx_crawler_lib crawler object |
|
1130 | + * @author Timo Schmidt <[email protected]> |
|
1131 | + */ |
|
1132 | + protected function findCrawler(){ |
|
1133 | + if(!$this->crawlerObj instanceof tx_crawler_lib){ |
|
1134 | + $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib'); |
|
1135 | + } |
|
1136 | + return $this->crawlerObj; |
|
1137 | + } |
|
1138 | 1138 | |
1139 | 1139 | |
1140 | 1140 | |
1141 | - /***************************** |
|
1141 | + /***************************** |
|
1142 | 1142 | * |
1143 | 1143 | * General Helper Functions |
1144 | 1144 | * |
1145 | 1145 | *****************************/ |
1146 | 1146 | |
1147 | - /** |
|
1148 | - * This method is used to add a message to the internal queue |
|
1149 | - * |
|
1150 | - * NOTE: |
|
1151 | - * This method is basesd on TYPO3 4.3 or higher! |
|
1152 | - * |
|
1153 | - * @param string the message itself |
|
1154 | - * @param integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error) |
|
1155 | - * |
|
1156 | - * @access private |
|
1157 | - * @return void |
|
1158 | - */ |
|
1159 | - private function addMessage($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) { |
|
1160 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
1161 | - 'TYPO3\CMS\Core\Messaging\FlashMessage', |
|
1162 | - $message, |
|
1163 | - '', |
|
1164 | - $severity |
|
1165 | - ); |
|
1166 | - |
|
1167 | - // TODO: |
|
1168 | - /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */ |
|
1169 | - $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'); |
|
1170 | - $flashMessageService->getMessageQueueByIdentifier()->addMessage($message); |
|
1171 | - } |
|
1172 | - |
|
1173 | - /** |
|
1174 | - * Add notice message to the user interface. |
|
1175 | - * |
|
1176 | - * NOTE: |
|
1177 | - * This method is basesd on TYPO3 4.3 or higher! |
|
1178 | - * |
|
1179 | - * @param string The message |
|
1180 | - * |
|
1181 | - * @access protected |
|
1182 | - * @return void |
|
1183 | - * |
|
1184 | - * @author Michael Klapper <[email protected]> |
|
1185 | - */ |
|
1186 | - protected function addNoticeMessage($message) { |
|
1187 | - $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE); |
|
1188 | - } |
|
1189 | - |
|
1190 | - /** |
|
1191 | - * Add error message to the user interface. |
|
1192 | - * |
|
1193 | - * NOTE: |
|
1194 | - * This method is basesd on TYPO3 4.3 or higher! |
|
1195 | - * |
|
1196 | - * @param string The message |
|
1197 | - * |
|
1198 | - * @access protected |
|
1199 | - * @return void |
|
1200 | - * |
|
1201 | - * @author Michael Klapper <[email protected]> |
|
1202 | - */ |
|
1203 | - protected function addErrorMessage($message) { |
|
1204 | - $this->isErrorDetected = TRUE; |
|
1205 | - $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); |
|
1206 | - } |
|
1207 | - |
|
1208 | - /** |
|
1209 | - * Add error message to the user interface. |
|
1210 | - * |
|
1211 | - * NOTE: |
|
1212 | - * This method is basesd on TYPO3 4.3 or higher! |
|
1213 | - * |
|
1214 | - * @param string The message |
|
1215 | - * |
|
1216 | - * @access protected |
|
1217 | - * @return void |
|
1218 | - * |
|
1219 | - * @author Michael Klapper <[email protected]> |
|
1220 | - */ |
|
1221 | - protected function addWarningMessage($message) { |
|
1222 | - $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING); |
|
1223 | - } |
|
1224 | - |
|
1225 | - /** |
|
1226 | - * Create selector box |
|
1227 | - * |
|
1228 | - * @param array $optArray Options key(value) => label pairs |
|
1229 | - * @param string $name Selector box name |
|
1230 | - * @param string $value Selector box value (array for multiple...) |
|
1231 | - * @param boolean $multiple If set, will draw multiple box. |
|
1147 | + /** |
|
1148 | + * This method is used to add a message to the internal queue |
|
1149 | + * |
|
1150 | + * NOTE: |
|
1151 | + * This method is basesd on TYPO3 4.3 or higher! |
|
1232 | 1152 | * |
1233 | - * @return string HTML select element |
|
1234 | - */ |
|
1235 | - function selectorBox($optArray, $name, $value, $multiple) { |
|
1153 | + * @param string the message itself |
|
1154 | + * @param integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error) |
|
1155 | + * |
|
1156 | + * @access private |
|
1157 | + * @return void |
|
1158 | + */ |
|
1159 | + private function addMessage($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) { |
|
1160 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
1161 | + 'TYPO3\CMS\Core\Messaging\FlashMessage', |
|
1162 | + $message, |
|
1163 | + '', |
|
1164 | + $severity |
|
1165 | + ); |
|
1166 | + |
|
1167 | + // TODO: |
|
1168 | + /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */ |
|
1169 | + $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'); |
|
1170 | + $flashMessageService->getMessageQueueByIdentifier()->addMessage($message); |
|
1171 | + } |
|
1172 | + |
|
1173 | + /** |
|
1174 | + * Add notice message to the user interface. |
|
1175 | + * |
|
1176 | + * NOTE: |
|
1177 | + * This method is basesd on TYPO3 4.3 or higher! |
|
1178 | + * |
|
1179 | + * @param string The message |
|
1180 | + * |
|
1181 | + * @access protected |
|
1182 | + * @return void |
|
1183 | + * |
|
1184 | + * @author Michael Klapper <[email protected]> |
|
1185 | + */ |
|
1186 | + protected function addNoticeMessage($message) { |
|
1187 | + $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE); |
|
1188 | + } |
|
1189 | + |
|
1190 | + /** |
|
1191 | + * Add error message to the user interface. |
|
1192 | + * |
|
1193 | + * NOTE: |
|
1194 | + * This method is basesd on TYPO3 4.3 or higher! |
|
1195 | + * |
|
1196 | + * @param string The message |
|
1197 | + * |
|
1198 | + * @access protected |
|
1199 | + * @return void |
|
1200 | + * |
|
1201 | + * @author Michael Klapper <[email protected]> |
|
1202 | + */ |
|
1203 | + protected function addErrorMessage($message) { |
|
1204 | + $this->isErrorDetected = TRUE; |
|
1205 | + $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); |
|
1206 | + } |
|
1207 | + |
|
1208 | + /** |
|
1209 | + * Add error message to the user interface. |
|
1210 | + * |
|
1211 | + * NOTE: |
|
1212 | + * This method is basesd on TYPO3 4.3 or higher! |
|
1213 | + * |
|
1214 | + * @param string The message |
|
1215 | + * |
|
1216 | + * @access protected |
|
1217 | + * @return void |
|
1218 | + * |
|
1219 | + * @author Michael Klapper <[email protected]> |
|
1220 | + */ |
|
1221 | + protected function addWarningMessage($message) { |
|
1222 | + $this->addMessage($message, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING); |
|
1223 | + } |
|
1224 | + |
|
1225 | + /** |
|
1226 | + * Create selector box |
|
1227 | + * |
|
1228 | + * @param array $optArray Options key(value) => label pairs |
|
1229 | + * @param string $name Selector box name |
|
1230 | + * @param string $value Selector box value (array for multiple...) |
|
1231 | + * @param boolean $multiple If set, will draw multiple box. |
|
1232 | + * |
|
1233 | + * @return string HTML select element |
|
1234 | + */ |
|
1235 | + function selectorBox($optArray, $name, $value, $multiple) { |
|
1236 | 1236 | |
1237 | - $options = array(); |
|
1238 | - foreach($optArray as $key => $val) { |
|
1239 | - $options[] = ' |
|
1237 | + $options = array(); |
|
1238 | + foreach($optArray as $key => $val) { |
|
1239 | + $options[] = ' |
|
1240 | 1240 | <option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value,$key)) || ($multiple && in_array($key,(array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>'; |
1241 | - } |
|
1241 | + } |
|
1242 | 1242 | |
1243 | - $output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>'; |
|
1243 | + $output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>'; |
|
1244 | 1244 | |
1245 | - return $output; |
|
1246 | - } |
|
1245 | + return $output; |
|
1246 | + } |
|
1247 | 1247 | |
1248 | - /** |
|
1249 | - * Activate hooks |
|
1250 | - * |
|
1251 | - * @return void |
|
1252 | - */ |
|
1253 | - function runRefreshHooks() { |
|
1254 | - $crawlerLib = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib'); |
|
1255 | - if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'])) { |
|
1256 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'] as $objRef) { |
|
1257 | - $hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef); |
|
1258 | - if (is_object($hookObj)) { |
|
1259 | - $hookObj->crawler_init($crawlerLib); |
|
1260 | - } |
|
1261 | - } |
|
1262 | - } |
|
1248 | + /** |
|
1249 | + * Activate hooks |
|
1250 | + * |
|
1251 | + * @return void |
|
1252 | + */ |
|
1253 | + function runRefreshHooks() { |
|
1254 | + $crawlerLib = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib'); |
|
1255 | + if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'])) { |
|
1256 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['refresh_hooks'] as $objRef) { |
|
1257 | + $hookObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($objRef); |
|
1258 | + if (is_object($hookObj)) { |
|
1259 | + $hookObj->crawler_init($crawlerLib); |
|
1260 | + } |
|
1261 | + } |
|
1262 | + } |
|
1263 | 1263 | |
1264 | - } |
|
1264 | + } |
|
1265 | 1265 | |
1266 | - /** |
|
1267 | - * Returns the URL to the current module, including $_GET['id']. |
|
1268 | - * |
|
1269 | - * @param array $urlParameters optional parameters to add to the URL |
|
1270 | - * @return string |
|
1271 | - */ |
|
1272 | - protected function getModuleUrl(array $urlParameters = array()) { |
|
1273 | - if ($this->pObj->id) { |
|
1274 | - $urlParameters = array_merge($urlParameters, array( |
|
1266 | + /** |
|
1267 | + * Returns the URL to the current module, including $_GET['id']. |
|
1268 | + * |
|
1269 | + * @param array $urlParameters optional parameters to add to the URL |
|
1270 | + * @return string |
|
1271 | + */ |
|
1272 | + protected function getModuleUrl(array $urlParameters = array()) { |
|
1273 | + if ($this->pObj->id) { |
|
1274 | + $urlParameters = array_merge($urlParameters, array( |
|
1275 | 1275 | 'id' => $this->pObj->id |
1276 | 1276 | )); |
1277 | - } |
|
1277 | + } |
|
1278 | 1278 | return \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('M'), $urlParameters); |
1279 | - } |
|
1279 | + } |
|
1280 | 1280 | } |
1281 | 1281 | |
1282 | 1282 | if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']) { |
1283 | - include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']); |
|
1283 | + include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']); |
|
1284 | 1284 | } |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return array Menu array |
97 | 97 | */ |
98 | - function modMenu() { |
|
98 | + function modMenu() { |
|
99 | 99 | global $LANG; |
100 | 100 | |
101 | - return array ( |
|
101 | + return array( |
|
102 | 102 | 'depth' => array( |
103 | 103 | 0 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'), |
104 | 104 | 1 => $LANG->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'), |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | // Set CSS styles specific for this document: |
158 | - $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/',' |
|
158 | + $this->pObj->content = str_replace('/*###POSTCSSMARKER###*/', ' |
|
159 | 159 | TABLE.c-list TR TD { white-space: nowrap; vertical-align: top; } |
160 | 160 | ',$this->pObj->content); |
161 | 161 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | |
202 | 202 | // Additional menus for the log type: |
203 | - if ($this->pObj->MOD_SETTINGS['crawlaction']==='log') { |
|
203 | + if ($this->pObj->MOD_SETTINGS['crawlaction'] === 'log') { |
|
204 | 204 | $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
205 | 205 | $this->pObj->id, |
206 | 206 | 'SET[depth]', |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | 'index.php' |
210 | 210 | ); |
211 | 211 | |
212 | - $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details=' . intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : ''; |
|
212 | + $quiPart = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details') ? '&qid_details='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) : ''; |
|
213 | 213 | |
214 | 214 | $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
215 | 215 | |
216 | - $h_func.= '<hr/>'. |
|
217 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id,'SET[log_display]',$this->pObj->MOD_SETTINGS['log_display'],$this->pObj->MOD_MENU['log_display'],'index.php','&setID='.$setId) . ' - ' . |
|
218 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_resultLog]',$this->pObj->MOD_SETTINGS['log_resultLog'],'index.php','&setID='.$setId . $quiPart) . ' - ' . |
|
219 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id,'SET[log_feVars]',$this->pObj->MOD_SETTINGS['log_feVars'],'index.php','&setID='.$setId . $quiPart) . ' - ' . |
|
220 | - $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': ' . |
|
216 | + $h_func .= '<hr/>'. |
|
217 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.display').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id, 'SET[log_display]', $this->pObj->MOD_SETTINGS['log_display'], $this->pObj->MOD_MENU['log_display'], 'index.php', '&setID='.$setId).' - '. |
|
218 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showresultlog').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[log_resultLog]', $this->pObj->MOD_SETTINGS['log_resultLog'], 'index.php', '&setID='.$setId.$quiPart).' - '. |
|
219 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.showfevars').': '.\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[log_feVars]', $this->pObj->MOD_SETTINGS['log_feVars'], 'index.php', '&setID='.$setId.$quiPart).' - '. |
|
220 | + $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.itemsPerPage').': '. |
|
221 | 221 | \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu( |
222 | 222 | $this->pObj->id, |
223 | 223 | 'SET[itemsPerPage]', |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $theOutput = $this->pObj->doc->section($LANG->getLL('title'), $h_func, 0, 1); |
231 | 231 | |
232 | 232 | // Branch based on type: |
233 | - switch ((string)$this->pObj->MOD_SETTINGS['crawlaction']) { |
|
233 | + switch ((string) $this->pObj->MOD_SETTINGS['crawlaction']) { |
|
234 | 234 | case 'start': |
235 | 235 | if (empty($this->pObj->id)) { |
236 | 236 | $this->addErrorMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noPageSelected')); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @return string HTML output |
280 | 280 | */ |
281 | - function drawURLs() { |
|
281 | + function drawURLs() { |
|
282 | 282 | global $BACK_PATH, $BE_USER; |
283 | 283 | |
284 | 284 | // Init: |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | $this->downloadCrawlUrls = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('_download'); |
288 | 288 | $this->makeCrawlerProcessableChecks(); |
289 | 289 | |
290 | - switch((string)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) { |
|
290 | + switch ((string) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tstamp')) { |
|
291 | 291 | case 'midnight': |
292 | - $this->scheduledTime = mktime(0,0,0); |
|
292 | + $this->scheduledTime = mktime(0, 0, 0); |
|
293 | 293 | break; |
294 | 294 | case '04:00': |
295 | - $this->scheduledTime = mktime(0,0,0)+4*3600; |
|
295 | + $this->scheduledTime = mktime(0, 0, 0) + 4 * 3600; |
|
296 | 296 | break; |
297 | 297 | case 'now': |
298 | 298 | default: |
@@ -312,23 +312,23 @@ discard block |
||
312 | 312 | $this->crawlerObj->setID = \TYPO3\CMS\Core\Utility\GeneralUtility::md5int(microtime()); |
313 | 313 | |
314 | 314 | if (empty($this->incomingConfigurationSelection) |
315 | - || (count($this->incomingConfigurationSelection)==1 && empty($this->incomingConfigurationSelection[0])) |
|
315 | + || (count($this->incomingConfigurationSelection) == 1 && empty($this->incomingConfigurationSelection[0])) |
|
316 | 316 | ) { |
317 | - $code= ' |
|
317 | + $code = ' |
|
318 | 318 | <tr> |
319 | 319 | <td colspan="7"><b>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.noConfigSelected').'</b></td> |
320 | 320 | </tr>'; |
321 | 321 | } else { |
322 | - if($this->submitCrawlUrls){ |
|
322 | + if ($this->submitCrawlUrls) { |
|
323 | 323 | $reason = new tx_crawler_domain_reason(); |
324 | 324 | $reason->setReason(tx_crawler_domain_reason::REASON_GUI_SUBMIT); |
325 | 325 | |
326 | - if($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication){ $username = $BE_USER->user['username']; } |
|
326 | + if ($BE_USER instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication) { $username = $BE_USER->user['username']; } |
|
327 | 327 | $reason->setDetailText('The user '.$username.' added pages to the crawler queue manually '); |
328 | 328 | |
329 | - tx_crawler_domain_events_dispatcher::getInstance()->post( 'invokeQueueChange', |
|
329 | + tx_crawler_domain_events_dispatcher::getInstance()->post('invokeQueueChange', |
|
330 | 330 | $this->findCrawler()->setID, |
331 | - array( 'reason' => $reason )); |
|
331 | + array('reason' => $reason)); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | $code = $this->crawlerObj->getPageTreeAndUrls( |
@@ -349,18 +349,18 @@ discard block |
||
349 | 349 | $this->duplicateTrack = $this->crawlerObj->duplicateTrack; |
350 | 350 | |
351 | 351 | $output = ''; |
352 | - if ($code) { |
|
352 | + if ($code) { |
|
353 | 353 | |
354 | 354 | $output .= '<h3>'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.configuration').':</h3>'; |
355 | 355 | $output .= '<input type="hidden" name="id" value="'.intval($this->pObj->id).'" />'; |
356 | 356 | |
357 | - if (!$this->submitCrawlUrls) { |
|
357 | + if (!$this->submitCrawlUrls) { |
|
358 | 358 | $output .= $this->drawURLs_cfgSelectors().'<br />'; |
359 | 359 | $output .= '<input type="submit" name="_update" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerUpdate').'" /> '; |
360 | 360 | $output .= '<input type="submit" name="_crawl" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerCrawl').'" /> '; |
361 | 361 | $output .= '<input type="submit" name="_download" value="'.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.triggerDownload').'" /><br /><br />'; |
362 | 362 | $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count').': '.count(array_keys($this->duplicateTrack)).'<br />'; |
363 | - $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).'<br />'; |
|
363 | + $output .= $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s', time()).'<br />'; |
|
364 | 364 | $output .= '<br /> |
365 | 365 | <table class="lrPadding c-list url-table">'. |
366 | 366 | $this->drawURLs_printTableHeader(). |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | // Download Urls to crawl: |
377 | - if ($this->downloadCrawlUrls) { |
|
377 | + if ($this->downloadCrawlUrls) { |
|
378 | 378 | |
379 | 379 | // Creating output header: |
380 | 380 | $mimeType = 'application/octet-stream'; |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | Header('Content-Disposition: attachment; filename=CrawlerUrls.txt'); |
383 | 383 | |
384 | 384 | // Printing the content of the CSV lines: |
385 | - echo implode(chr(13).chr(10),$this->downloadUrls); |
|
385 | + echo implode(chr(13).chr(10), $this->downloadUrls); |
|
386 | 386 | |
387 | 387 | // Exits: |
388 | 388 | exit; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * |
398 | 398 | * @return string HTML table |
399 | 399 | */ |
400 | - function drawURLs_cfgSelectors() { |
|
400 | + function drawURLs_cfgSelectors() { |
|
401 | 401 | |
402 | 402 | // depth |
403 | 403 | $cell[] = $this->selectorBox( |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | $this->pObj->MOD_SETTINGS['depth'], |
414 | 414 | 0 |
415 | 415 | ); |
416 | - $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth']?$this->pObj->MOD_SETTINGS['depth']:0 ); |
|
416 | + $availableConfigurations = $this->crawlerObj->getConfigurationsForBranch($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'] ? $this->pObj->MOD_SETTINGS['depth'] : 0); |
|
417 | 417 | |
418 | 418 | // Configurations |
419 | 419 | $cell[] = $this->selectorBox( |
420 | - empty($availableConfigurations)?array():array_combine($availableConfigurations, $availableConfigurations), |
|
420 | + empty($availableConfigurations) ? array() : array_combine($availableConfigurations, $availableConfigurations), |
|
421 | 421 | 'configurationSelection', |
422 | 422 | $this->incomingConfigurationSelection, |
423 | 423 | 1 |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | * |
479 | 479 | * @return string Table header |
480 | 480 | */ |
481 | - function drawURLs_printTableHeader() { |
|
481 | + function drawURLs_printTableHeader() { |
|
482 | 482 | |
483 | 483 | $content = ' |
484 | 484 | <tr class="bgColor5 tableheader"> |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * |
517 | 517 | * @return string HTML output |
518 | 518 | */ |
519 | - function drawLog() { |
|
519 | + function drawLog() { |
|
520 | 520 | global $BACK_PATH; |
521 | 521 | $output = ''; |
522 | 522 | |
@@ -529,45 +529,45 @@ discard block |
||
529 | 529 | |
530 | 530 | // Read URL: |
531 | 531 | if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')) { |
532 | - $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')),TRUE); |
|
532 | + $this->crawlerObj->readUrl(intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_read')), TRUE); |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | // Look for set ID sent - if it is, we will display contents of that set: |
536 | 536 | $showSetId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
537 | 537 | |
538 | 538 | // Show details: |
539 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) { |
|
539 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details')) { |
|
540 | 540 | |
541 | 541 | // Get entry record: |
542 | - list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','tx_crawler_queue','qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))); |
|
542 | + list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid='.intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('qid_details'))); |
|
543 | 543 | |
544 | 544 | // Explode values: |
545 | 545 | $resStatus = $this->getResStatus($q_entry); |
546 | 546 | $q_entry['parameters'] = unserialize($q_entry['parameters']); |
547 | 547 | $q_entry['result_data'] = unserialize($q_entry['result_data']); |
548 | - if (is_array($q_entry['result_data'])) { |
|
548 | + if (is_array($q_entry['result_data'])) { |
|
549 | 549 | $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']); |
550 | 550 | } |
551 | 551 | |
552 | - if(!$this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
552 | + if (!$this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
553 | 553 | unset($q_entry['result_data']['content']['log']); |
554 | 554 | } |
555 | 555 | |
556 | 556 | // Print rudimentary details: |
557 | 557 | $output .= ' |
558 | 558 | <br /><br /> |
559 | - <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" /> |
|
560 | - <input type="hidden" value="' . $this->pObj->id . '" name="id" /> |
|
561 | - <input type="hidden" value="' . $showSetId . '" name="setID" /> |
|
559 | + <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back').'" name="_back" /> |
|
560 | + <input type="hidden" value="' . $this->pObj->id.'" name="id" /> |
|
561 | + <input type="hidden" value="' . $showSetId.'" name="setID" /> |
|
562 | 562 | <br /> |
563 | - Current server time: ' . date('H:i:s', time()) . '<br />' . |
|
564 | - 'Status: ' . $resStatus . '<br />' . |
|
563 | + Current server time: ' . date('H:i:s', time()).'<br />'. |
|
564 | + 'Status: '.$resStatus.'<br />'. |
|
565 | 565 | \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($q_entry); |
566 | 566 | } else { // Show list: |
567 | 567 | |
568 | 568 | // If either id or set id, show list: |
569 | - if ($this->pObj->id || $showSetId) { |
|
570 | - if ($this->pObj->id) { |
|
569 | + if ($this->pObj->id || $showSetId) { |
|
570 | + if ($this->pObj->id) { |
|
571 | 571 | // Drawing tree: |
572 | 572 | $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Tree\View\PageTreeView'); |
573 | 573 | $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); |
@@ -589,16 +589,16 @@ discard block |
||
589 | 589 | ); |
590 | 590 | |
591 | 591 | // Get branch beneath: |
592 | - if ($this->pObj->MOD_SETTINGS['depth']) { |
|
592 | + if ($this->pObj->MOD_SETTINGS['depth']) { |
|
593 | 593 | $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], ''); |
594 | 594 | } |
595 | 595 | |
596 | 596 | // Traverse page tree: |
597 | 597 | $code = ''; $count = 0; |
598 | - foreach($tree->tree as $data) { |
|
598 | + foreach ($tree->tree as $data) { |
|
599 | 599 | $code .= $this->drawLog_addRows( |
600 | 600 | $data['row'], |
601 | - $data['HTML'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages',$data['row'],TRUE), |
|
601 | + $data['HTML'].\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $data['row'], TRUE), |
|
602 | 602 | intval($this->pObj->MOD_SETTINGS['itemsPerPage']) |
603 | 603 | ); |
604 | 604 | if (++$count == 1000) { |
@@ -607,13 +607,13 @@ discard block |
||
607 | 607 | } |
608 | 608 | } else { |
609 | 609 | $code = ''; |
610 | - $code.= $this->drawLog_addRows( |
|
610 | + $code .= $this->drawLog_addRows( |
|
611 | 611 | $showSetId, |
612 | 612 | 'Set ID: '.$showSetId |
613 | 613 | ); |
614 | 614 | } |
615 | 615 | |
616 | - if ($code) { |
|
616 | + if ($code) { |
|
617 | 617 | |
618 | 618 | $output .= ' |
619 | 619 | <br /><br /> |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | <input type="hidden" value="'.$this->pObj->id.'" name="id" /> |
625 | 625 | <input type="hidden" value="'.$showSetId.'" name="setID" /> |
626 | 626 | <br /> |
627 | - '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s',time()).' |
|
627 | + '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime').': '.date('H:i:s', time()).' |
|
628 | 628 | <br /><br /> |
629 | 629 | |
630 | 630 | |
@@ -650,10 +650,10 @@ discard block |
||
650 | 650 | </tr> |
651 | 651 | '; |
652 | 652 | |
653 | - $cc=0; |
|
654 | - foreach($setList as $set) { |
|
655 | - $code.= ' |
|
656 | - <tr class="bgColor'.($cc%2 ? '-20':'-10').'"> |
|
653 | + $cc = 0; |
|
654 | + foreach ($setList as $set) { |
|
655 | + $code .= ' |
|
656 | + <tr class="bgColor'.($cc % 2 ? '-20' : '-10').'"> |
|
657 | 657 | <td><a href="'.htmlspecialchars('index.php?setID='.$set['set_id']).'">'.$set['set_id'].'</a></td> |
658 | 658 | <td>'.$set['count_value'].'</td> |
659 | 659 | <td>'.\TYPO3\CMS\Backend\Utility\BackendUtility::dateTimeAge($set['scheduled']).'</td> |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | } |
672 | 672 | } |
673 | 673 | |
674 | - if($this->CSVExport) { |
|
674 | + if ($this->CSVExport) { |
|
675 | 675 | $this->outputCsvFile(); |
676 | 676 | } |
677 | 677 | |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($fieldNames); |
698 | 698 | |
699 | 699 | // Data: |
700 | - foreach($this->CSVaccu as $row) { |
|
700 | + foreach ($this->CSVaccu as $row) { |
|
701 | 701 | $csvLines[] = \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($row); |
702 | 702 | } |
703 | 703 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | Header('Content-Disposition: attachment; filename=CrawlerLog.csv'); |
708 | 708 | |
709 | 709 | // Printing the content of the CSV lines: |
710 | - echo implode(chr(13).chr(10),$csvLines); |
|
710 | + echo implode(chr(13).chr(10), $csvLines); |
|
711 | 711 | |
712 | 712 | // Exits: |
713 | 713 | exit; |
@@ -723,14 +723,14 @@ discard block |
||
723 | 723 | * |
724 | 724 | * @return string HTML <tr> content (one or more) |
725 | 725 | */ |
726 | - function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage=10) { |
|
726 | + function drawLog_addRows($pageRow_setId, $titleString, $itemsPerPage = 10) { |
|
727 | 727 | |
728 | 728 | // If Flush button is pressed, flush tables instead of selecting entries: |
729 | 729 | |
730 | - if(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) { |
|
730 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush')) { |
|
731 | 731 | $doFlush = true; |
732 | 732 | $doFullFlush = false; |
733 | - } elseif(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) { |
|
733 | + } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('_flush_all')) { |
|
734 | 734 | $doFlush = true; |
735 | 735 | $doFullFlush = true; |
736 | 736 | } else { |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | } |
740 | 740 | |
741 | 741 | // Get result: |
742 | - if (is_array($pageRow_setId)) { |
|
742 | + if (is_array($pageRow_setId)) { |
|
743 | 743 | $res = $this->crawlerObj->getLogEntriesForPageId($pageRow_setId['uid'], $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage)); |
744 | 744 | } else { |
745 | 745 | $res = $this->crawlerObj->getLogEntriesForSetId($pageRow_setId, $this->pObj->MOD_SETTINGS['log_display'], $doFlush, $doFullFlush, intval($itemsPerPage)); |
@@ -750,14 +750,14 @@ discard block |
||
750 | 750 | + ($this->pObj->MOD_SETTINGS['log_resultLog'] ? -1 : 0) |
751 | 751 | + ($this->pObj->MOD_SETTINGS['log_feVars'] ? 3 : 0); |
752 | 752 | |
753 | - if (count($res)) { |
|
753 | + if (count($res)) { |
|
754 | 754 | // Traverse parameter combinations: |
755 | 755 | $c = 0; |
756 | - $content=''; |
|
757 | - foreach($res as $kk => $vv) { |
|
756 | + $content = ''; |
|
757 | + foreach ($res as $kk => $vv) { |
|
758 | 758 | |
759 | 759 | // Title column: |
760 | - if (!$c) { |
|
760 | + if (!$c) { |
|
761 | 761 | $titleClm = '<td rowspan="'.count($res).'">'.$titleString.'</td>'; |
762 | 762 | } else { |
763 | 763 | $titleClm = ''; |
@@ -774,16 +774,16 @@ discard block |
||
774 | 774 | |
775 | 775 | // Put data into array: |
776 | 776 | $rowData = array(); |
777 | - if ($this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
777 | + if ($this->pObj->MOD_SETTINGS['log_resultLog']) { |
|
778 | 778 | $rowData['result_log'] = $resLog; |
779 | 779 | } else { |
780 | - $rowData['scheduled'] = ($vv['scheduled']> 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate'); |
|
780 | + $rowData['scheduled'] = ($vv['scheduled'] > 0) ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']) : ' '.$GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.immediate'); |
|
781 | 781 | $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-'; |
782 | 782 | } |
783 | - $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus,50); |
|
783 | + $rowData['result_status'] = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($resStatus, 50); |
|
784 | 784 | $rowData['url'] = '<a href="'.htmlspecialchars($parameters['url']).'" target="_newWIndow">'.htmlspecialchars($parameters['url']).'</a>'; |
785 | 785 | $rowData['feUserGroupList'] = $parameters['feUserGroupList']; |
786 | - $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ',$parameters['procInstructions']) : ''; |
|
786 | + $rowData['procInstructions'] = is_array($parameters['procInstructions']) ? implode('; ', $parameters['procInstructions']) : ''; |
|
787 | 787 | $rowData['set_id'] = $vv['set_id']; |
788 | 788 | |
789 | 789 | if ($this->pObj->MOD_SETTINGS['log_feVars']) { |
@@ -794,34 +794,34 @@ discard block |
||
794 | 794 | |
795 | 795 | $setId = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('setID')); |
796 | 796 | |
797 | - $refreshIcon = $GLOBALS['BACK_PATH'] . 'gfx/refresh_n.gif'; |
|
798 | - if (version_compare(TYPO3_version,'7.0','>=')) { |
|
799 | - $refreshIcon = $GLOBALS['BACK_PATH'] . 'sysext/t3skin/extjs/images/grid/refresh.gif'; |
|
797 | + $refreshIcon = $GLOBALS['BACK_PATH'].'gfx/refresh_n.gif'; |
|
798 | + if (version_compare(TYPO3_version, '7.0', '>=')) { |
|
799 | + $refreshIcon = $GLOBALS['BACK_PATH'].'sysext/t3skin/extjs/images/grid/refresh.gif'; |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | // Put rows together: |
803 | - $content.= ' |
|
804 | - <tr class="bgColor'.($c%2 ? '-20':'-10').'"> |
|
803 | + $content .= ' |
|
804 | + <tr class="bgColor'.($c % 2 ? '-20' : '-10').'"> |
|
805 | 805 | '.$titleClm.' |
806 | - <td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)) . '">'.htmlspecialchars($vv['qid']).'</a></td> |
|
807 | - <td><a href="' . $this->getModuleUrl(array('qid_read' => $vv['qid'], 'setID' => $setId)) . '"><img src="' . $refreshIcon . '" width="14" hspace="1" vspace="2" height="14" border="0" title="'.htmlspecialchars('Read').'" alt="" /></a></td>'; |
|
808 | - foreach($rowData as $fKey => $value) { |
|
806 | + <td><a href="' . $this->getModuleUrl(array('qid_details' => $vv['qid'], 'setID' => $setId)).'">'.htmlspecialchars($vv['qid']).'</a></td> |
|
807 | + <td><a href="' . $this->getModuleUrl(array('qid_read' => $vv['qid'], 'setID' => $setId)).'"><img src="'.$refreshIcon.'" width="14" hspace="1" vspace="2" height="14" border="0" title="'.htmlspecialchars('Read').'" alt="" /></a></td>'; |
|
808 | + foreach ($rowData as $fKey => $value) { |
|
809 | 809 | |
810 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url',$fKey)) { |
|
811 | - $content.= ' |
|
810 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('url', $fKey)) { |
|
811 | + $content .= ' |
|
812 | 812 | <td>'.$value.'</td>'; |
813 | 813 | } else { |
814 | - $content.= ' |
|
814 | + $content .= ' |
|
815 | 815 | <td>'.nl2br(htmlspecialchars($value)).'</td>'; |
816 | 816 | } |
817 | 817 | } |
818 | - $content.= ' |
|
818 | + $content .= ' |
|
819 | 819 | </tr>'; |
820 | 820 | $c++; |
821 | 821 | |
822 | - if ($this->CSVExport) { |
|
822 | + if ($this->CSVExport) { |
|
823 | 823 | // Only for CSV (adding qid and scheduled/exec_time if needed): |
824 | - $rowData['result_log'] = implode('// ',explode(chr(10),$resLog)); |
|
824 | + $rowData['result_log'] = implode('// ', explode(chr(10), $resLog)); |
|
825 | 825 | $rowData['qid'] = $vv['qid']; |
826 | 826 | $rowData['scheduled'] = \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['scheduled']); |
827 | 827 | $rowData['exec_time'] = $vv['exec_time'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($vv['exec_time']) : '-'; |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @return string Table header |
866 | 866 | */ |
867 | - function drawLog_printTableHeader() { |
|
867 | + function drawLog_printTableHeader() { |
|
868 | 868 | |
869 | 869 | $content = ' |
870 | 870 | <tr class="bgColor5 tableheader"> |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | } |
916 | 916 | |
917 | 917 | function getResStatus($vv) { |
918 | - if ($vv['result_data']) { |
|
918 | + if ($vv['result_data']) { |
|
919 | 919 | $requestContent = unserialize($vv['result_data']); |
920 | 920 | $requestResult = unserialize($requestContent['content']); |
921 | 921 | if (is_array($requestResult)) { |
@@ -924,9 +924,9 @@ discard block |
||
924 | 924 | } else { |
925 | 925 | $resStatus = implode("\n", $requestResult['errorlog']); |
926 | 926 | } |
927 | - $resLog = is_array($requestResult['log']) ? implode(chr(10),$requestResult['log']) : ''; |
|
927 | + $resLog = is_array($requestResult['log']) ? implode(chr(10), $requestResult['log']) : ''; |
|
928 | 928 | } else { |
929 | - $resStatus = 'Error: '.substr(preg_replace('/\s+/',' ',strip_tags($requestContent['content'])),0,10000).'...'; |
|
929 | + $resStatus = 'Error: '.substr(preg_replace('/\s+/', ' ', strip_tags($requestContent['content'])), 0, 10000).'...'; |
|
930 | 930 | } |
931 | 931 | } else { |
932 | 932 | $resStatus = '-'; |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | * @param void |
955 | 955 | * @return string |
956 | 956 | */ |
957 | - protected function drawProcessOverviewAction(){ |
|
957 | + protected function drawProcessOverviewAction() { |
|
958 | 958 | |
959 | 959 | $this->runRefreshHooks(); |
960 | 960 | |
@@ -968,20 +968,20 @@ discard block |
||
968 | 968 | $this->addErrorMessage($e->getMessage()); |
969 | 969 | } |
970 | 970 | |
971 | - $offset = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset')); |
|
972 | - $perpage = 20; |
|
971 | + $offset = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('offset')); |
|
972 | + $perpage = 20; |
|
973 | 973 | |
974 | - $processRepository = new tx_crawler_domain_process_repository(); |
|
975 | - $queueRepository = new tx_crawler_domain_queue_repository(); |
|
974 | + $processRepository = new tx_crawler_domain_process_repository(); |
|
975 | + $queueRepository = new tx_crawler_domain_queue_repository(); |
|
976 | 976 | |
977 | 977 | $mode = $this->pObj->MOD_SETTINGS['processListMode']; |
978 | 978 | if ($mode == 'detail') { |
979 | 979 | $where = ''; |
980 | - } elseif($mode == 'simple') { |
|
980 | + } elseif ($mode == 'simple') { |
|
981 | 981 | $where = 'active = 1'; |
982 | 982 | } |
983 | 983 | |
984 | - $allProcesses = $processRepository->findAll('ttl','DESC', $perpage, $offset,$where); |
|
984 | + $allProcesses = $processRepository->findAll('ttl', 'DESC', $perpage, $offset, $where); |
|
985 | 985 | $allCount = $processRepository->countAll($where); |
986 | 986 | |
987 | 987 | $listView = new tx_crawler_view_process_list(); |
@@ -993,10 +993,10 @@ discard block |
||
993 | 993 | $listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems()); |
994 | 994 | $listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems()); |
995 | 995 | $listView->setActiveProcessCount($processRepository->countActive()); |
996 | - $listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'],1,99,1)); |
|
996 | + $listView->setMaxActiveProcessCount(\TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->extensionSettings['processLimit'], 1, 99, 1)); |
|
997 | 997 | $listView->setMode($mode); |
998 | 998 | |
999 | - $paginationView = new tx_crawler_view_pagination(); |
|
999 | + $paginationView = new tx_crawler_view_pagination(); |
|
1000 | 1000 | $paginationView->setCurrentOffset($offset); |
1001 | 1001 | $paginationView->setPerPage($perpage); |
1002 | 1002 | $paginationView->setTotalItemCount($allCount); |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | |
1034 | 1034 | $exitCode = 0; |
1035 | 1035 | $out = array(); |
1036 | - exec(escapeshellcmd($this->extensionSettings['phpPath'] . ' -v'), $out, $exitCode); |
|
1036 | + exec(escapeshellcmd($this->extensionSettings['phpPath'].' -v'), $out, $exitCode); |
|
1037 | 1037 | if ($exitCode > 0) { |
1038 | 1038 | $this->addErrorMessage(sprintf($LANG->sL('LLL:EXT:crawler/modfunc1/locallang.xml:message.phpBinaryNotFound'), htmlspecialchars($this->extensionSettings['phpPath']))); |
1039 | 1039 | } |
@@ -1096,7 +1096,7 @@ discard block |
||
1096 | 1096 | * @param void |
1097 | 1097 | * @return void |
1098 | 1098 | */ |
1099 | - protected function handleProcessOverviewActions(){ |
|
1099 | + protected function handleProcessOverviewActions() { |
|
1100 | 1100 | |
1101 | 1101 | $crawler = $this->findCrawler(); |
1102 | 1102 | |
@@ -1129,8 +1129,8 @@ discard block |
||
1129 | 1129 | * @return tx_crawler_lib crawler object |
1130 | 1130 | * @author Timo Schmidt <[email protected]> |
1131 | 1131 | */ |
1132 | - protected function findCrawler(){ |
|
1133 | - if(!$this->crawlerObj instanceof tx_crawler_lib){ |
|
1132 | + protected function findCrawler() { |
|
1133 | + if (!$this->crawlerObj instanceof tx_crawler_lib) { |
|
1134 | 1134 | $this->crawlerObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_lib'); |
1135 | 1135 | } |
1136 | 1136 | return $this->crawlerObj; |
@@ -1232,15 +1232,15 @@ discard block |
||
1232 | 1232 | * |
1233 | 1233 | * @return string HTML select element |
1234 | 1234 | */ |
1235 | - function selectorBox($optArray, $name, $value, $multiple) { |
|
1235 | + function selectorBox($optArray, $name, $value, $multiple) { |
|
1236 | 1236 | |
1237 | 1237 | $options = array(); |
1238 | - foreach($optArray as $key => $val) { |
|
1238 | + foreach ($optArray as $key => $val) { |
|
1239 | 1239 | $options[] = ' |
1240 | - <option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value,$key)) || ($multiple && in_array($key,(array)$value))?' selected="selected"':'').'>'.htmlspecialchars($val).'</option>'; |
|
1240 | + <option value="'.htmlspecialchars($key).'"'.((!$multiple && !strcmp($value, $key)) || ($multiple && in_array($key, (array) $value)) ? ' selected="selected"' : '').'>'.htmlspecialchars($val).'</option>'; |
|
1241 | 1241 | } |
1242 | 1242 | |
1243 | - $output = '<select name="'.htmlspecialchars($name.($multiple?'[]':'')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('',$options).'</select>'; |
|
1243 | + $output = '<select name="'.htmlspecialchars($name.($multiple ? '[]' : '')).'"'.($multiple ? ' multiple="multiple" size="'.count($options).'"' : '').'>'.implode('', $options).'</select>'; |
|
1244 | 1244 | |
1245 | 1245 | return $output; |
1246 | 1246 | } |
@@ -1279,6 +1279,6 @@ discard block |
||
1279 | 1279 | } |
1280 | 1280 | } |
1281 | 1281 | |
1282 | -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']) { |
|
1282 | +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']) { |
|
1283 | 1283 | include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/modfunc1/class.tx_crawler_modfunc1.php']); |
1284 | 1284 | } |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php if (!defined('TYPO3_MODE')) die ('Access denied.'); ?> |
2 | 2 | |
3 | 3 | Page: |
4 | -<?php for($currentPageOffset = 0; $currentPageOffset < $this->getTotalPagesCount(); $currentPageOffset++ ){ ?> |
|
4 | +<?php for ($currentPageOffset = 0; $currentPageOffset < $this->getTotalPagesCount(); $currentPageOffset++) { ?> |
|
5 | 5 | <a href="index.php?offset=<?php echo htmlspecialchars($currentPageOffset * $this->getPerPage()); ?>"> |
6 | 6 | <?php echo htmlspecialchars($this->getLabelForPageOffset($currentPageOffset)); ?> |
7 | 7 | </a> |
8 | - <?php if($currentPageOffset+1 < $this->getTotalPagesCount()){ ?> |
|
8 | + <?php if ($currentPageOffset + 1 < $this->getTotalPagesCount()) { ?> |
|
9 | 9 | | |
10 | 10 | <?php } ?> |
11 | 11 |
@@ -1,4 +1,7 @@ |
||
1 | -<?php if (!defined('TYPO3_MODE')) die ('Access denied.'); ?> |
|
1 | +<?php if (!defined('TYPO3_MODE')) { |
|
2 | + die ('Access denied.'); |
|
3 | +} |
|
4 | +?> |
|
2 | 5 | |
3 | 6 | Page: |
4 | 7 | <?php for($currentPageOffset = 0; $currentPageOffset < $this->getTotalPagesCount(); $currentPageOffset++ ){ ?> |
@@ -5,11 +5,11 @@ |
||
5 | 5 | <?php echo $this->getRefreshLink(); ?> |
6 | 6 | <?php echo $this->getEnableDisableLink(); ?> |
7 | 7 | <?php |
8 | - // Check if ActiveProcess is reached |
|
9 | - if (\TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($this->getActiveProcessCount()) < \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($this->getMaxActiveProcessCount())) { |
|
10 | - echo $this->getAddLink(); |
|
11 | - } |
|
12 | - ?> |
|
8 | + // Check if ActiveProcess is reached |
|
9 | + if (\TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($this->getActiveProcessCount()) < \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($this->getMaxActiveProcessCount())) { |
|
10 | + echo $this->getAddLink(); |
|
11 | + } |
|
12 | + ?> |
|
13 | 13 | <?php echo $this->getModeLink(); ?> |
14 | 14 | </div> |
15 | 15 |
@@ -50,17 +50,17 @@ |
||
50 | 50 | </tr> |
51 | 51 | </thead> |
52 | 52 | <tbody> |
53 | - <?php foreach($this->getProcessCollection() as $process): /* @var $process tx_crawler_domain_process */ ?> |
|
54 | - <tr class="<?php echo (++$count % 2 == 0) ? 'odd': 'even' ?>"> |
|
53 | + <?php foreach ($this->getProcessCollection() as $process): /* @var $process tx_crawler_domain_process */ ?> |
|
54 | + <tr class="<?php echo (++$count % 2 == 0) ? 'odd' : 'even' ?>"> |
|
55 | 55 | <td><?php echo $this->getIconForState(htmlspecialchars($process->getState())); ?></td> |
56 | 56 | <td><?php echo htmlspecialchars($process->getProcess_id()); ?></td> |
57 | 57 | <td><?php echo htmlspecialchars($this->asDate($process->getTimeForFirstItem())); ?></td> |
58 | 58 | <td><?php echo htmlspecialchars($this->asDate($process->getTimeForLastItem())); ?></td> |
59 | - <td><?php echo htmlspecialchars(floor($process->getRuntime()/ 60)); ?> min. <?php echo htmlspecialchars($process->getRuntime()) % 60 ?> sec.</td> |
|
59 | + <td><?php echo htmlspecialchars(floor($process->getRuntime() / 60)); ?> min. <?php echo htmlspecialchars($process->getRuntime()) % 60 ?> sec.</td> |
|
60 | 60 | <td><?php echo htmlspecialchars($this->asDate($process->getTTL())); ?></td> |
61 | 61 | <td><?php echo htmlspecialchars($process->countItemsProcessed()); ?></td> |
62 | 62 | <td><?php echo htmlspecialchars($process->countItemsAssigned()); ?></td> |
63 | - <td><?php echo htmlspecialchars($process->countItemsToProcess()+$process->countItemsProcessed()); ?></td> |
|
63 | + <td><?php echo htmlspecialchars($process->countItemsToProcess() + $process->countItemsProcessed()); ?></td> |
|
64 | 64 | <td> |
65 | 65 | <?php if ($process->getState() == 'running'): ?> |
66 | 66 | <div class="crawlerprocessprogress" style="width: 200px;"> |
@@ -1,4 +1,7 @@ discard block |
||
1 | -<?php if (!defined('TYPO3_MODE')) die ('Access denied.'); ?> |
|
1 | +<?php if (!defined('TYPO3_MODE')) { |
|
2 | + die ('Access denied.'); |
|
3 | +} |
|
4 | +?> |
|
2 | 5 | |
3 | 6 | <br /> |
4 | 7 | <div id="controll-panel"> |
@@ -69,8 +72,11 @@ discard block |
||
69 | 72 | </div> |
70 | 73 | <?php elseif ($process->getState() == 'cancelled'): ?> |
71 | 74 | <?php echo $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.cancelled'); ?> |
72 | - <?php else: ?> |
|
73 | - <?php echo $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.success'); ?> |
|
75 | + <?php else { |
|
76 | + : ?> |
|
77 | + <?php echo $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.process.success'); |
|
78 | +} |
|
79 | +?> |
|
74 | 80 | <?php endif; ?> |
75 | 81 | </td> |
76 | 82 | </tr> |
@@ -1,24 +1,24 @@ |
||
1 | 1 | <?php |
2 | 2 | $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler'); |
3 | 3 | return array( |
4 | - 'tx_crawler_lib' => $extensionPath . 'class.tx_crawler_lib.php', |
|
5 | - 'tx_crawler_cli_flush' => $extensionPath . 'cli/class.tx_crawler_cli_flush.php', |
|
6 | - 'tx_crawler_cli' => $extensionPath . 'cli/class.tx_crawler_cli.php', |
|
7 | - 'tx_crawler_cli_im' => $extensionPath . 'cli/class.tx_crawler_cli_im.php', |
|
8 | - 'tx_crawler_domain_events_dispatcher' => $extensionPath . 'domain/events/class.tx_crawler_domain_events_dispatcher.php', |
|
9 | - 'tx_crawler_domain_events_observer' => $extensionPath . 'domain/events/interface.tx_crawler_domain_events_observer.php', |
|
10 | - 'tx_crawler_domain_lib_abstract_dbobject' => $extensionPath . 'domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php', |
|
11 | - 'tx_crawler_domain_process_manager' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_manager.php', |
|
12 | - 'tx_crawler_domain_process' => $extensionPath . 'domain/process/class.tx_crawler_domain_process.php', |
|
13 | - 'tx_crawler_domain_process_collection' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_collection.php', |
|
14 | - 'tx_crawler_domain_process_repository' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_repository.php', |
|
15 | - 'tx_crawler_domain_queue_entry' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_entry.php', |
|
16 | - 'tx_crawler_domain_queue_repository' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_repository.php', |
|
17 | - 'tx_crawler_domain_reason' => $extensionPath . 'domain/reason/class.tx_crawler_domain_reason.php', |
|
18 | - 'tx_crawler_hooks_tsfe' => $extensionPath . 'hooks/class.tx_crawler_hooks_tsfe.php', |
|
19 | - 'tx_crawler_hooks_staticFileCacheCreateUri' => $extensionPath . 'hooks/class.tx_crawler_hooks_staticFileCacheCreateUri.php', |
|
20 | - 'tx_crawler_hooks_processCleanUp' => $extensionPath . 'hooks/class.tx_crawler_hooks_processCleanUp.php', |
|
21 | - 'tx_crawler_modfunc1' => $extensionPath . 'modfunc1/class.tx_crawler_modfunc1.php', |
|
22 | - 'tx_crawler_view_pagination' => $extensionPath . 'view/class.tx_crawler_view_pagination.php', |
|
23 | - 'tx_crawler_view_process_list' => $extensionPath . 'view/process/class.tx_crawler_view_process_list.php', |
|
4 | + 'tx_crawler_lib' => $extensionPath . 'class.tx_crawler_lib.php', |
|
5 | + 'tx_crawler_cli_flush' => $extensionPath . 'cli/class.tx_crawler_cli_flush.php', |
|
6 | + 'tx_crawler_cli' => $extensionPath . 'cli/class.tx_crawler_cli.php', |
|
7 | + 'tx_crawler_cli_im' => $extensionPath . 'cli/class.tx_crawler_cli_im.php', |
|
8 | + 'tx_crawler_domain_events_dispatcher' => $extensionPath . 'domain/events/class.tx_crawler_domain_events_dispatcher.php', |
|
9 | + 'tx_crawler_domain_events_observer' => $extensionPath . 'domain/events/interface.tx_crawler_domain_events_observer.php', |
|
10 | + 'tx_crawler_domain_lib_abstract_dbobject' => $extensionPath . 'domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php', |
|
11 | + 'tx_crawler_domain_process_manager' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_manager.php', |
|
12 | + 'tx_crawler_domain_process' => $extensionPath . 'domain/process/class.tx_crawler_domain_process.php', |
|
13 | + 'tx_crawler_domain_process_collection' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_collection.php', |
|
14 | + 'tx_crawler_domain_process_repository' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_repository.php', |
|
15 | + 'tx_crawler_domain_queue_entry' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_entry.php', |
|
16 | + 'tx_crawler_domain_queue_repository' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_repository.php', |
|
17 | + 'tx_crawler_domain_reason' => $extensionPath . 'domain/reason/class.tx_crawler_domain_reason.php', |
|
18 | + 'tx_crawler_hooks_tsfe' => $extensionPath . 'hooks/class.tx_crawler_hooks_tsfe.php', |
|
19 | + 'tx_crawler_hooks_staticFileCacheCreateUri' => $extensionPath . 'hooks/class.tx_crawler_hooks_staticFileCacheCreateUri.php', |
|
20 | + 'tx_crawler_hooks_processCleanUp' => $extensionPath . 'hooks/class.tx_crawler_hooks_processCleanUp.php', |
|
21 | + 'tx_crawler_modfunc1' => $extensionPath . 'modfunc1/class.tx_crawler_modfunc1.php', |
|
22 | + 'tx_crawler_view_pagination' => $extensionPath . 'view/class.tx_crawler_view_pagination.php', |
|
23 | + 'tx_crawler_view_process_list' => $extensionPath . 'view/process/class.tx_crawler_view_process_list.php', |
|
24 | 24 | ); |
@@ -1,24 +1,24 @@ |
||
1 | 1 | <?php |
2 | 2 | $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('crawler'); |
3 | 3 | return array( |
4 | - 'tx_crawler_lib' => $extensionPath . 'class.tx_crawler_lib.php', |
|
5 | - 'tx_crawler_cli_flush' => $extensionPath . 'cli/class.tx_crawler_cli_flush.php', |
|
6 | - 'tx_crawler_cli' => $extensionPath . 'cli/class.tx_crawler_cli.php', |
|
7 | - 'tx_crawler_cli_im' => $extensionPath . 'cli/class.tx_crawler_cli_im.php', |
|
8 | - 'tx_crawler_domain_events_dispatcher' => $extensionPath . 'domain/events/class.tx_crawler_domain_events_dispatcher.php', |
|
9 | - 'tx_crawler_domain_events_observer' => $extensionPath . 'domain/events/interface.tx_crawler_domain_events_observer.php', |
|
10 | - 'tx_crawler_domain_lib_abstract_dbobject' => $extensionPath . 'domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php', |
|
11 | - 'tx_crawler_domain_process_manager' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_manager.php', |
|
12 | - 'tx_crawler_domain_process' => $extensionPath . 'domain/process/class.tx_crawler_domain_process.php', |
|
13 | - 'tx_crawler_domain_process_collection' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_collection.php', |
|
14 | - 'tx_crawler_domain_process_repository' => $extensionPath . 'domain/process/class.tx_crawler_domain_process_repository.php', |
|
15 | - 'tx_crawler_domain_queue_entry' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_entry.php', |
|
16 | - 'tx_crawler_domain_queue_repository' => $extensionPath . 'domain/queue/class.tx_crawler_domain_queue_repository.php', |
|
17 | - 'tx_crawler_domain_reason' => $extensionPath . 'domain/reason/class.tx_crawler_domain_reason.php', |
|
18 | - 'tx_crawler_hooks_tsfe' => $extensionPath . 'hooks/class.tx_crawler_hooks_tsfe.php', |
|
19 | - 'tx_crawler_hooks_staticFileCacheCreateUri' => $extensionPath . 'hooks/class.tx_crawler_hooks_staticFileCacheCreateUri.php', |
|
20 | - 'tx_crawler_hooks_processCleanUp' => $extensionPath . 'hooks/class.tx_crawler_hooks_processCleanUp.php', |
|
21 | - 'tx_crawler_modfunc1' => $extensionPath . 'modfunc1/class.tx_crawler_modfunc1.php', |
|
22 | - 'tx_crawler_view_pagination' => $extensionPath . 'view/class.tx_crawler_view_pagination.php', |
|
23 | - 'tx_crawler_view_process_list' => $extensionPath . 'view/process/class.tx_crawler_view_process_list.php', |
|
4 | + 'tx_crawler_lib' => $extensionPath.'class.tx_crawler_lib.php', |
|
5 | + 'tx_crawler_cli_flush' => $extensionPath.'cli/class.tx_crawler_cli_flush.php', |
|
6 | + 'tx_crawler_cli' => $extensionPath.'cli/class.tx_crawler_cli.php', |
|
7 | + 'tx_crawler_cli_im' => $extensionPath.'cli/class.tx_crawler_cli_im.php', |
|
8 | + 'tx_crawler_domain_events_dispatcher' => $extensionPath.'domain/events/class.tx_crawler_domain_events_dispatcher.php', |
|
9 | + 'tx_crawler_domain_events_observer' => $extensionPath.'domain/events/interface.tx_crawler_domain_events_observer.php', |
|
10 | + 'tx_crawler_domain_lib_abstract_dbobject' => $extensionPath.'domain/lib/class.tx_crawler_domain_lib_abstract_dbobject.php', |
|
11 | + 'tx_crawler_domain_process_manager' => $extensionPath.'domain/process/class.tx_crawler_domain_process_manager.php', |
|
12 | + 'tx_crawler_domain_process' => $extensionPath.'domain/process/class.tx_crawler_domain_process.php', |
|
13 | + 'tx_crawler_domain_process_collection' => $extensionPath.'domain/process/class.tx_crawler_domain_process_collection.php', |
|
14 | + 'tx_crawler_domain_process_repository' => $extensionPath.'domain/process/class.tx_crawler_domain_process_repository.php', |
|
15 | + 'tx_crawler_domain_queue_entry' => $extensionPath.'domain/queue/class.tx_crawler_domain_queue_entry.php', |
|
16 | + 'tx_crawler_domain_queue_repository' => $extensionPath.'domain/queue/class.tx_crawler_domain_queue_repository.php', |
|
17 | + 'tx_crawler_domain_reason' => $extensionPath.'domain/reason/class.tx_crawler_domain_reason.php', |
|
18 | + 'tx_crawler_hooks_tsfe' => $extensionPath.'hooks/class.tx_crawler_hooks_tsfe.php', |
|
19 | + 'tx_crawler_hooks_staticFileCacheCreateUri' => $extensionPath.'hooks/class.tx_crawler_hooks_staticFileCacheCreateUri.php', |
|
20 | + 'tx_crawler_hooks_processCleanUp' => $extensionPath.'hooks/class.tx_crawler_hooks_processCleanUp.php', |
|
21 | + 'tx_crawler_modfunc1' => $extensionPath.'modfunc1/class.tx_crawler_modfunc1.php', |
|
22 | + 'tx_crawler_view_pagination' => $extensionPath.'view/class.tx_crawler_view_pagination.php', |
|
23 | + 'tx_crawler_view_process_list' => $extensionPath.'view/process/class.tx_crawler_view_process_list.php', |
|
24 | 24 | ); |
@@ -4,10 +4,10 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | $processManager = new tx_crawler_domain_process_manager(); |
7 | -$timeout = isset($_SERVER['argv'][1] ) ? intval($_SERVER['argv'][1]) : 10000; |
|
7 | +$timeout = isset($_SERVER['argv'][1]) ? intval($_SERVER['argv'][1]) : 10000; |
|
8 | 8 | |
9 | 9 | try { |
10 | 10 | $processManager->multiProcess($timeout); |
11 | 11 | } catch (Exception $e) { |
12 | - echo PHP_EOL . $e->getMessage(); |
|
12 | + echo PHP_EOL.$e->getMessage(); |
|
13 | 13 | } |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | if (!defined('TYPO3_REQUESTTYPE')) { |
3 | - die('You cannot run this script directly!'); |
|
3 | + die('You cannot run this script directly!'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | $processManager = new tx_crawler_domain_process_manager(); |
7 | 7 | $timeout = isset($_SERVER['argv'][1] ) ? intval($_SERVER['argv'][1]) : 10000; |
8 | 8 | |
9 | 9 | try { |
10 | - $processManager->multiProcess($timeout); |
|
10 | + $processManager->multiProcess($timeout); |
|
11 | 11 | } catch (Exception $e) { |
12 | - echo PHP_EOL . $e->getMessage(); |
|
12 | + echo PHP_EOL . $e->getMessage(); |
|
13 | 13 | } |
@@ -37,29 +37,29 @@ |
||
37 | 37 | */ |
38 | 38 | class tx_crawler_cli extends \TYPO3\CMS\Core\Controller\CommandLineController { |
39 | 39 | |
40 | - /** |
|
41 | - * Constructor |
|
42 | - * |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - function __construct() { |
|
46 | - parent::__construct(); |
|
40 | + /** |
|
41 | + * Constructor |
|
42 | + * |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + function __construct() { |
|
46 | + parent::__construct(); |
|
47 | 47 | |
48 | - $this->cli_options[] = array('-h', 'Show the help', ''); |
|
49 | - $this->cli_options[] = array('--help', 'Same as -h', ''); |
|
50 | - $this->cli_options[] = array('--countInARun count', 'Amount of pages', 'How many pages should be crawled during that run.'); |
|
51 | - $this->cli_options[] = array('--sleepTime milliseconds', 'Millisecounds to relax system during crawls', 'Amount of millisecounds which the system should use to relax between crawls.'); |
|
52 | - $this->cli_options[] = array('--sleepAfterFinish seconds', 'Secounds to relax system after all crawls.', 'Amount of secounds which the system should use to relax after all crawls are done.'); |
|
48 | + $this->cli_options[] = array('-h', 'Show the help', ''); |
|
49 | + $this->cli_options[] = array('--help', 'Same as -h', ''); |
|
50 | + $this->cli_options[] = array('--countInARun count', 'Amount of pages', 'How many pages should be crawled during that run.'); |
|
51 | + $this->cli_options[] = array('--sleepTime milliseconds', 'Millisecounds to relax system during crawls', 'Amount of millisecounds which the system should use to relax between crawls.'); |
|
52 | + $this->cli_options[] = array('--sleepAfterFinish seconds', 'Secounds to relax system after all crawls.', 'Amount of secounds which the system should use to relax after all crawls are done.'); |
|
53 | 53 | |
54 | - // Setting help texts: |
|
55 | - $this->cli_help['name'] = 'crawler CLI interface -- Crawling the URLs from the queue'; |
|
56 | - $this->cli_help['synopsis'] = '###OPTIONS###'; |
|
57 | - $this->cli_help['description'] = ""; |
|
58 | - $this->cli_help['examples'] = "/.../cli_dispatch.phpsh crawler\nWill trigger the crawler which starts to process the queue entires\n"; |
|
59 | - $this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2010'; |
|
60 | - } |
|
54 | + // Setting help texts: |
|
55 | + $this->cli_help['name'] = 'crawler CLI interface -- Crawling the URLs from the queue'; |
|
56 | + $this->cli_help['synopsis'] = '###OPTIONS###'; |
|
57 | + $this->cli_help['description'] = ""; |
|
58 | + $this->cli_help['examples'] = "/.../cli_dispatch.phpsh crawler\nWill trigger the crawler which starts to process the queue entires\n"; |
|
59 | + $this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2010'; |
|
60 | + } |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli.php']) { |
64 | - include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli.php']); |
|
64 | + include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli.php']); |
|
65 | 65 | } |
@@ -37,41 +37,41 @@ |
||
37 | 37 | */ |
38 | 38 | class tx_crawler_cli_im extends \TYPO3\CMS\Core\Controller\CommandLineController { |
39 | 39 | |
40 | - /** |
|
41 | - * Constructor |
|
42 | - * |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - function __construct() { |
|
46 | - parent::__construct(); |
|
40 | + /** |
|
41 | + * Constructor |
|
42 | + * |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + function __construct() { |
|
46 | + parent::__construct(); |
|
47 | 47 | |
48 | - // Adding options to help archive: |
|
49 | - /** |
|
50 | - * 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 |
|
51 | - * this is completely ok. Since configuration records were introduced to configure "what should be done" additionally to page ts the way to setup jobs |
|
52 | - * has drifted from selecting filtering processing instructions to selecting/filtering configuration keys (you can configure the processing instructions there). |
|
53 | - * This is also reflected in the backend modules and allows you a much clearer and powerful way to work with the crawler extension. |
|
54 | - */ |
|
55 | - // $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).'); |
|
56 | - // TODO: cleanup here! |
|
57 | - $this->cli_options[] = array('-d depth', 'Tree depth, 0-99', "How many levels under the 'page_id' to include."); |
|
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 | - $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'); |
|
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"); |
|
48 | + // Adding options to help archive: |
|
49 | + /** |
|
50 | + * 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 |
|
51 | + * this is completely ok. Since configuration records were introduced to configure "what should be done" additionally to page ts the way to setup jobs |
|
52 | + * has drifted from selecting filtering processing instructions to selecting/filtering configuration keys (you can configure the processing instructions there). |
|
53 | + * This is also reflected in the backend modules and allows you a much clearer and powerful way to work with the crawler extension. |
|
54 | + */ |
|
55 | + // $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).'); |
|
56 | + // TODO: cleanup here! |
|
57 | + $this->cli_options[] = array('-d depth', 'Tree depth, 0-99', "How many levels under the 'page_id' to include."); |
|
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 | + $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'); |
|
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 | - // Setting help texts: |
|
64 | - $this->cli_help['name'] = 'crawler CLI interface -- Submitting URLs to be crawled via CLI interface.'; |
|
65 | - $this->cli_help['synopsis'] = 'page_id ###OPTIONS###'; |
|
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 | - $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"; |
|
69 | - $this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2009'; |
|
70 | - } |
|
63 | + // Setting help texts: |
|
64 | + $this->cli_help['name'] = 'crawler CLI interface -- Submitting URLs to be crawled via CLI interface.'; |
|
65 | + $this->cli_help['synopsis'] = 'page_id ###OPTIONS###'; |
|
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 | + $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"; |
|
69 | + $this->cli_help['author'] = 'Kasper Skaarhoj, Daniel Poetzinger, Fabrizio Branca, Tolleiv Nietsch, Timo Schmidt - AOE media 2009'; |
|
70 | + } |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli_im.php']) { |
74 | - include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli_im.php']); |
|
74 | + include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/crawler/cli/class.tx_crawler_cli_im.php']); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | ?> |
@@ -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 | } |