/** * Validates the additional fields' values * * @param array $submittedData * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule * @return bool */ public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule) { $isValid = FALSE; if (tx_crawler_api::convertToPositiveInteger($submittedData['timeOut']) > 0) { $isValid = TRUE; } else { $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidTimeOut'), t3lib_FlashMessage::ERROR); } return $isValid; }
/** * This method checks any additional data that is relevant to the specific task * If the task class is not relevant, the method is expected to return true * * @param array $submittedData: reference to the array containing the data submitted by the user * @param tx_scheduler_Module $schedulerModule * * @internal param \tx_scheduler_module1 $parentObject : reference to the calling object (Scheduler's BE module) * @return boolean True if validation was ok (or selected class is not relevant), false otherwise */ public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $schedulerModule) { $isValid = false; //!TODO add validation to validate the $submittedData['configuration'] wich is normally a comma seperated string if (is_array($submittedData['configuration'])) { $isValid = true; } else { $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidConfiguration'), t3lib_FlashMessage::ERROR); } if ($submittedData['depth'] < 0) { $isValid = false; $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidDepth'), t3lib_FlashMessage::ERROR); } if (!tx_crawler_api::canBeInterpretedAsInteger($submittedData['startPage']) || $submittedData['startPage'] < 0) { $isValid = false; $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidStartPage'), t3lib_FlashMessage::ERROR); } return $isValid; }
/** * This method is used to show an overview about the active an the finished crawling processes * * @author Timo Schmidt * @param void * @return string */ protected function drawProcessOverviewAction() { global $BACK_PATH; $this->makeCrawlerProcessableChecks(); $crawler = $this->findCrawler(); try { $this->handleProcessOverviewActions(); } catch (Exception $e) { $this->addErrorMessage($e->getMessage()); } $offset = intval(t3lib_div::_GP('offset')); $perpage = 20; $processRepository = new tx_crawler_domain_process_repository(); $queueRepository = new tx_crawler_domain_queue_repository(); $mode = $this->pObj->MOD_SETTINGS['processListMode']; if ($mode == 'detail') { $where = ''; } elseif ($mode == 'simple') { $where = 'active = 1'; } $allProcesses = $processRepository->findAll('ttl', 'DESC', $perpage, $offset, $where); $allCount = $processRepository->countAll($where); $listView = new tx_crawler_view_process_list(); $listView->setPageId($this->pObj->id); $listView->setIconPath($BACK_PATH . '../typo3conf/ext/crawler/template/process/res/img/'); $listView->setProcessCollection($allProcesses); $listView->setCliPath($this->processManager->getCrawlerCliPath()); $listView->setIsCrawlerEnabled(!$crawler->getDisabled() && !$this->isErrorDetected); $listView->setTotalUnprocessedItemCount($queueRepository->countAllPendingItems()); $listView->setAssignedUnprocessedItemCount($queueRepository->countAllAssignedPendingItems()); $listView->setActiveProcessCount($processRepository->countActive()); $listView->setMaxActiveProcessCount(tx_crawler_api::forceIntegerInRange($this->extensionSettings['processLimit'], 1, 99, 1)); $listView->setMode($mode); $paginationView = new tx_crawler_view_pagination(); $paginationView->setCurrentOffset($offset); $paginationView->setPerPage($perpage); $paginationView->setTotalItemCount($allCount); $output = $listView->render(); if ($paginationView->getTotalPagesCount() > 1) { $output .= ' <br />' . $paginationView->render(); } return $output; }
/** * Function executed by crawler_im.php cli script. * * @return bool */ function CLI_main_flush() { $this->setAccessMode('cli_flush'); $cliObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_crawler_cli_flush'); // Force user to admin state and set workspace to "Live": $this->backendUser->user['admin'] = 1; $this->backendUser->setWorkspace(0); // Print help if (!isset($cliObj->cli_args['_DEFAULT'][1])) { $cliObj->cli_validateArgs(); $cliObj->cli_help(); exit; } $cliObj->cli_validateArgs(); $pageId = tx_crawler_api::forceIntegerInRange($cliObj->cli_args['_DEFAULT'][1], 0); $fullFlush = $pageId == 0; $mode = $cliObj->cli_argValue('-o'); switch ($mode) { case 'all': $result = $this->getLogEntriesForPageId($pageId, '', true, $fullFlush); break; case 'finished': case 'pending': $result = $this->getLogEntriesForPageId($pageId, $mode, true, $fullFlush); break; default: $cliObj->cli_validateArgs(); $cliObj->cli_help(); $result = false; } return $result !== false; }
/** * This method checks any additional data that is relevant to the specific task * If the task class is not relevant, the method is expected to return true * * @param array $submittedData: reference to the array containing the data submitted by the user * @param tx_scheduler_module1 $parentObject: reference to the calling object (Scheduler's BE module) * @return boolean True if validation was ok (or selected class is not relevant), false otherwise * @author Michael Klapper <*****@*****.**> */ public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $schedulerModule) { $isValid = false; if (tx_crawler_api::convertToPositiveInteger($submittedData['sleepTime']) > 0) { $isValid = true; } else { $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidSleepTime'), t3lib_FlashMessage::ERROR); } if (tx_crawler_api::convertToPositiveInteger($submittedData['sleepAfterFinish']) === 0) { $isValid = false; $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidSleepAfterFinish'), t3lib_FlashMessage::ERROR); } if (tx_crawler_api::convertToPositiveInteger($submittedData['countInARun']) === 0) { $isValid = false; $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidCountInARun'), t3lib_FlashMessage::ERROR); } return $isValid; }
/** * Validates the additional fields' values * * @param array $submittedData * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule * @return bool */ public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule) { $isValid = FALSE; if (tx_crawler_api::convertToPositiveInteger($submittedData['sleepTime']) > 0) { $isValid = TRUE; } else { $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidSleepTime'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); } if (tx_crawler_api::convertToPositiveInteger($submittedData['sleepAfterFinish']) === 0) { $isValid = FALSE; $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidSleepAfterFinish'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); } if (tx_crawler_api::convertToPositiveInteger($submittedData['countInARun']) === 0) { $isValid = FALSE; $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:crawler/locallang_db.xml:crawler_im.invalidCountInARun'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); } return $isValid; }