Esempio n. 1
0
 /**
  * Returns metadata from a given file.
  *
  * @param string $fileName
  * @param bool $fullExtract
  * @return array
  */
 public static function getMetadata($fileName, $fullExtract = false)
 {
     $metadata = static::getBasicMetadata($fileName);
     if ($fullExtract) {
         $virtualFileObject = static::getVirtualFileObject($fileName, $metadata);
         $extractorRegistry = \TYPO3\CMS\Core\Resource\Index\ExtractorRegistry::getInstance();
         $extractionServices = $extractorRegistry->getExtractorsWithDriverSupport('Local');
         $newMetadata = array(0 => $metadata);
         foreach ($extractionServices as $service) {
             if ($service->canProcess($virtualFileObject)) {
                 $newMetadata[$service->getPriority()] = $service->extractMetaData($virtualFileObject, $newMetadata);
             }
         }
         ksort($newMetadata);
         foreach ($newMetadata as $data) {
             $metadata = array_merge($metadata, $data);
         }
     }
     return $metadata;
 }
Esempio n. 2
0
 /**
  * Returns an instance of the FileIndexRepository
  *
  * @return ExtractorRegistry
  */
 protected function getExtractorRegistry()
 {
     return ExtractorRegistry::getInstance();
 }
Esempio n. 3
0
 /**
  * Returns a field configuration telling about the status of registered extractors.
  *
  * @param FileStorageExtractionTask $task When editing, reference to the current task object. NULL when adding.
  * @return array Array containing all the information pertaining to the additional fields
  */
 protected function getRegisteredExtractorsField(FileStorageExtractionTask $task = null)
 {
     $extractors = ExtractorRegistry::getInstance()->getExtractors();
     if (empty($extractors)) {
         $labelKey = 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.fileStorageExtraction.registeredExtractors.without_extractors';
         $content = '<span class="label label-warning">' . htmlspecialchars($this->getLanguageService()->sL($labelKey)) . '</span>';
     } else {
         // Assemble the extractor bullet list first.
         $labelKey = 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.fileStorageExtraction.registeredExtractors.extractor';
         $bullets = [];
         foreach ($extractors as $extractor) {
             $bullets[] = sprintf('<li title="%s">%s</li>', get_class($extractor), sprintf($this->getLanguageService()->sL($labelKey), $this->formatExtractorClassName($extractor), $extractor->getPriority()));
         }
         // Finalize content assembling.
         $labelKey = 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.fileStorageExtraction.registeredExtractors.with_extractors';
         $title = $this->getLanguageService()->sL($labelKey);
         $content = '<p>' . htmlspecialchars($title) . '</p>';
         $content .= '<ul>' . implode(LF, $bullets) . '</ul>';
     }
     $fieldConfiguration = ['code' => $content, 'label' => 'LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.fileStorageExtraction.registeredExtractors', 'cshKey' => '_MOD_system_txschedulerM1', 'cshLabel' => 'scheduler_fileStorageIndexing_registeredExtractors'];
     return $fieldConfiguration;
 }
Esempio n. 4
0
<?php

if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
// Register basic metadata extractor. Will feed the file with a "title" when indexing, e.g. upload, through scheduler
\TYPO3\CMS\Core\Resource\Index\ExtractorRegistry::getInstance()->registerExtractionService('Fab\\Media\\Index\\TitleMetadataExtractor');
// Hook for traditional file upload, trigger metadata indexing as well.
// Could be done at the Core level in the future...
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_extfilefunc.php']['processData'][] = 'Fab\\Media\\Hook\\FileUploadHook';
if (TYPO3_MODE == 'BE') {
    // Special process to fill column "usage" which indicates the total number of file reference including soft references.
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'Fab\\Media\\Hook\\DataHandlerHook';
    # Configuration for RTE
    //    $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['LinkCreator'] = array();
    //    $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['LinkCreator']['objectReference'] = 'EXT:media/Resources/Private/HtmlArea/LinkCreator/class.tx_rtehtmlarea_linkcreator.php:&tx_rtehtmlarea_linkcreator';
    //    $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['LinkCreator']['addIconsToSkin'] = 1;
    //    $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['LinkCreator']['disableInFE'] = 1;
    //
    //    $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['ImageEditor'] = array();
    //    $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['ImageEditor']['objectReference'] = 'EXT:media/Resources/Private/HtmlArea/ImageEditor/class.tx_rtehtmlarea_imageeditor.php:&tx_rtehtmlarea_imageeditor';
    //    $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['ImageEditor']['addIconsToSkin'] = 1;
    //    $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['ImageEditor']['disableInFE'] = 1;
    // Setting up scripts that can be run from the cli_dispatch.phpsh script.
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'Fab\\Media\\Command\\FileCacheCommandController';
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'Fab\\Media\\Command\\MissingFilesCommandController';
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'Fab\\Media\\Command\\DuplicateFilesCommandController';
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'Fab\\Media\\Command\\DuplicateRecordsCommandController';
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'Fab\\Media\\Command\\ThumbnailCommandController';
    $configuration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['media']);
    $hasMediaFilePicker = isset($configuration['has_media_file_picker']) ? $configuration['has_media_file_picker'] : FALSE;
 /**
  * Returns a field configuration telling about the status of registered extractors.
  *
  * @param FileStorageExtractionTask $task When editing, reference to the current task object. NULL when adding.
  * @return array Array containing all the information pertaining to the additional fields
  */
 protected function getRegisteredExtractorsField(FileStorageExtractionTask $task = NULL)
 {
     $extractors = ExtractorRegistry::getInstance()->getExtractors();
     if (empty($extractors)) {
         $labelKey = 'LLL:EXT:scheduler/mod1/locallang.xlf:label.fileStorageExtraction.registeredExtractors.without_extractors';
         /** @var FlashMessage $flashMessage */
         $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $this->getLanguageService()->sL($labelKey), '', FlashMessage::WARNING);
         $content = $flashMessage->render();
     } else {
         // Assemble the extractor bullet list first.
         $labelKey = 'LLL:EXT:scheduler/mod1/locallang.xlf:label.fileStorageExtraction.registeredExtractors.extractor';
         $bullets = array();
         foreach ($extractors as $extractor) {
             $bullets[] = sprintf('<li title="%s">%s</li>', get_class($extractor), sprintf($this->getLanguageService()->sL($labelKey), $this->formatExtractorClassName($extractor), $extractor->getPriority()));
         }
         // Finalize content assembling.
         $labelKey = 'LLL:EXT:scheduler/mod1/locallang.xlf:label.fileStorageExtraction.registeredExtractors.with_extractors';
         /** @var FlashMessage $flashMessage */
         $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', '<ul>' . implode(LF, $bullets) . '</ul>', $this->getLanguageService()->sL($labelKey), FlashMessage::INFO);
         $content = $flashMessage->render();
     }
     $fieldConfiguration = array('code' => $content, 'label' => 'LLL:EXT:scheduler/mod1/locallang.xlf:label.fileStorageExtraction.registeredExtractors', 'cshKey' => '_MOD_system_txschedulerM1', 'cshLabel' => 'scheduler_fileStorageIndexing_registeredExtractors');
     return $fieldConfiguration;
 }
Esempio n. 6
0
<?php

if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
$metaDataExtractorRegistry = \TYPO3\CMS\Core\Resource\Index\ExtractorRegistry::getInstance();
$metaDataExtractorRegistry->registerExtractionService('ApacheSolrForTypo3\\Tika\\Service\\Extractor\\MetaDataExtractor');
$metaDataExtractorRegistry->registerExtractionService('ApacheSolrForTypo3\\Tika\\Service\\Extractor\\LanguageDetector');