コード例 #1
0
ファイル: AppService.php プロジェクト: AndreasA/ext-tika
 /**
  * Service initialization
  *
  * @return void
  */
 protected function initializeService()
 {
     if (!is_file(GeneralUtility::getFileAbsFileName($this->configuration['tikaPath'], FALSE))) {
         throw new \RuntimeException('Invalid path or filename for Tika application jar: ' . $this->configuration['tikaPath'], 1266864929);
     }
     if (!CommandUtility::checkCommand('java')) {
         throw new \RuntimeException('Could not find Java', 1421208775);
     }
 }
コード例 #2
0
ファイル: AppService.php プロジェクト: neufeind/ext-tika
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     if (!is_file(GeneralUtility::getFileAbsFileName($this->configuration['tikaPath'], FALSE))) {
         throw new \RuntimeException('Invalid path or filename for Tika application jar: ' . $this->configuration['tikaPath'], 1266864929);
     }
     if (!CommandUtility::checkCommand('java')) {
         throw new \RuntimeException('Could not find Java', 1421208775);
     }
 }
コード例 #3
0
 /**
  * Check if a given service is available, based on the executable files it depends on
  *
  * @param string $serviceType Type of service
  * @param string $serviceKey Specific key of the service
  * @param array $serviceDetails Information about the service
  * @return bool Service availability
  */
 public static function isServiceAvailable($serviceType, $serviceKey, $serviceDetails)
 {
     // If the service depends on external programs - check if they exists
     if (trim($serviceDetails['exec'])) {
         $executables = GeneralUtility::trimExplode(',', $serviceDetails['exec'], true);
         foreach ($executables as $executable) {
             // If at least one executable file is not available, exit early returning FALSE
             if (!CommandUtility::checkCommand($executable)) {
                 self::deactivateService($serviceType, $serviceKey);
                 return false;
             }
         }
     }
     // The service is available
     return true;
 }
コード例 #4
0
ファイル: StatusCheck.php プロジェクト: bauschan/tika
 /**
  * Checks whether the extension is configured to use a local Tika
  * application, and if so whether it's correctly configured.
  *
  * @return boolean TRUE if the extension is configured to use a local Tika app and if it's correctly configured, FALSE otherwise
  */
 protected function hasCompleteLocalTikaConfiguration()
 {
     $localConfigurationComplete = FALSE;
     if ($this->tikaConfiguration['extractor'] == 'tika' && is_file(GeneralUtility::getFileAbsFileName($this->tikaConfiguration['tikaPath'], FALSE)) && CommandUtility::checkCommand('java')) {
         $localConfigurationComplete = TRUE;
     }
     if ($this->tikaConfiguration['logging']) {
         $registry = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
         $registryStatus = $registry->get('Tx_Tika', 'available');
         GeneralUtility::devLog('Has complete local Tika configuration: ' . ($localConfigurationComplete == TRUE ? 'yes' : 'no'), 'tika', 0, array('configuration' => $this->tikaConfiguration, 'javaFound' => CommandUtility::checkCommand('java'), 'tikaPath' => $this->tikaConfiguration['tikaPath'], 'absoluteTikaPath' => GeneralUtility::getFileAbsFileName($this->tikaConfiguration['tikaPath'], FALSE), 'absoluteTikaExists' => is_file(GeneralUtility::getFileAbsFileName($this->tikaConfiguration['tikaPath'], FALSE)) == TRUE ? 'yes' : 'no', 'registryStatus' => $registryStatus));
     }
     return $localConfigurationComplete;
 }
コード例 #5
0
 /**
  * check the availability of external programs
  *
  * @param string $progList Comma list of programs 'perl,python,pdftotext'
  * @return boolean Return FALSE if one program was not found
  * @todo Define visibility
  */
 public function checkExec($progList)
 {
     $ret = TRUE;
     $progList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $progList, TRUE);
     foreach ($progList as $prog) {
         if (!\TYPO3\CMS\Core\Utility\CommandUtility::checkCommand($prog)) {
             // Program not found
             $this->errorPush(T3_ERR_SV_PROG_NOT_FOUND, 'External program not found: ' . $prog);
             $ret = FALSE;
         }
     }
     return $ret;
 }