PHP code example of centertap / tika-all-the-files
1. Go to this page and download the library: Download centertap/tika-all-the-files library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
centertap / tika-all-the-files example snippets
...
wfLoadExtension( 'TikaAllTheFiles' );
...
[
'defaults' => [
'handler_strategy' => 'fallback',
'allow_ocr' => false,
'ocr_languages' => '',
'content_strategy' => 'combine',
'content_composition' => 'text',
'metadata_strategy' => 'prefer_other',
'ignore_content_service_errors' => false,
'ignore_content_parsing_errors' => false,
'ignore_metadata_service_errors' => false,
'ignore_metadata_parsing_errors' => false,
'cache_expire_success_before': false,
'cache_expire_failure_before': false,
'cache_file_backend': false,
],
'*' => 'defaults',
]
$wgTikaAllTheFiles_MimeTypeProfiles['*'] = [
'inherit' => 'defaults',
'handler_strategy' => 'wrapping',
'allow_ocr' => true,
'content_composition' => 'text_and_metadata',
'metadata_strategy' => 'combine',
'cache_file_backend' => 'my-tatf-cache',
];
$wgTikaAllTheFiles_MimeTypeProfiles['application/pdf'] = [
'inherit' => '*',
'allow_ocr' => false,
];
$wgTikaAllTheFiles_PropertyMap['dc:language'] = true;
$wgTikaAllTheFiles_PropertyMap['!'] = false;
$wgLockManagers[] = [
'name' => 'my-tatf-lock-manager',
'class' => FSLockManager::class,
'lockDirectory' => "/somewhere/on/disk/amazing-tatf-cache/lockdir",
];
$wgFileBackends[] = [
'name' => 'my-tatf-cache',
'class' => FSFileBackend::class,
'domainId' => '',
'lockManager' => 'my-tatf-lock-manager',
'basePath' => "/somewhere/on/disk/amazing-tatf-cache",
'fileMode' => 0644,
'directoryMode' => 0755,
];
$ cd YOUR-WIKI-INSTALL-DIRECTORY/maintenance
$ php refreshImageMetadata.php --force
$ cd YOUR-WIKI-INSTALL-DIRECTORY/extensions/CirrusSearch/maintenance/
$ php ForceSearchIndex.php
unset( $wgPdftoText )