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