MATCH
MATCH
Indexes children of a given FedoraResource in a file system
$parent : \acdhOeaw\fedora\FedoraResource
FedoraResource which children are created by the Indexer
$metaLookup : \acdhOeaw\util\metaLookup\MetaLookupInterface
An object providing metadata when given a resource file path
$fedora : \acdhOeaw\fedora\Fedora
Repository connection
__construct(\acdhOeaw\fedora\FedoraResource $resource = null)
Creates an indexer object for a given Fedora resource.
\acdhOeaw\fedora\FedoraResource | $resource |
setParent(\acdhOeaw\fedora\FedoraResource $resource)
Sets the parent resource for the indexed files
\acdhOeaw\fedora\FedoraResource | $resource |
setPaths(array $paths) : \acdhOeaw\util\Indexer
Overrides file system paths to look into for child resources.
array | $paths |
setAutoCommit(integer $count) : \acdhOeaw\util\Indexer
Controls the automatic commit behaviour.
Even when you use autocommit, you should commit your transaction after
Indexer::index()
(the only exception is when you set auto commit to 1
forcing commiting each and every resource separately but you probably
don't want to do that for performance reasons).
integer | $count | number of resource automatically triggering a commit (0 - no auto commit) |
setSkip(integer $skipMode) : \acdhOeaw\util\Indexer
Defines if (and how) resources should be skipped from indexing based on their (not)existance in Fedora.
integer | $skipMode | mode either Indexer::SKIP_NONE (default), Indexer::SKIP_NOT_EXIST, Indexer::SKIP_EXIST or Indexer::SKIP_BINARY_EXIST |
setVersioning(integer $versioningMode, integer $migratePid = self::PID_KEEP) : \acdhOeaw\util\Indexer
Defines if new versions of binary resources should be created or if they should be simply overwritten with a new binary payload.
integer | $versioningMode | mode either Indexer::VERSIONING_NONE, Indexer::VERSIONING_ALWAYS, Indexer::VERSIONING_CHECKSUM or Indexer::VERSIONING_DATE |
integer | $migratePid | should PIDs (epic handles) be migrated to the new version - either Indexer::MIGRATE_NO or Indexer::MIGRATE_YES |
setCollectionClass(string $class) : \acdhOeaw\util\Indexer
Sets default RDF class for imported collections.
Overrides setting read form the cfg::indexerDefaultCollectionClass
configuration property.
string | $class |
setBinaryClass(string $class) : \acdhOeaw\util\Indexer
Sets default RDF class for imported binary resources.
Overrides setting read form the cfg::indexerDefaultBinaryClass
configuration property.
string | $class |
setFilter(string $filter, integer $type = self::MATCH) : \acdhOeaw\util\Indexer
Sets file name filter for child resources.
You can choose if file names must match or must not match (skip) the
filter using the $type parameter. You can set both match and skip
filters by calling setFilter() two times (once with
$type = Indexer::MATCH
and second time with $type = Indexer::SKIP
).
Filter is applied only to file names but NOT to directory names.
string | $filter | regular expression conformant with preg_replace() |
integer | $type | decides if $filter is a match or skip filter (can be one of Indexer::MATCH and Indexer::SKIP) |
setFlatStructure(boolean $ifFlat) : \acdhOeaw\util\Indexer
Sets if child resources be directly attached to the indexed FedoraResource (`$ifFlat` equals to `true`) or a separate collection Fedora resource be created for each subdirectory (`$ifFlat` equals to `false`).
boolean | $ifFlat |
setFedoraLocation(string $fedoraLoc) : \acdhOeaw\util\Indexer
Sets a location where the resource will be placed.
Can be absolute (but will be sanitized anyway) or relative to the repository root.
Given location must already exist.
Note that this parameter is used ONLY if the resource DOES NOT EXISTS. If it exists already, its location is not changed.
string | $fedoraLoc | fedora location |
setUploadSizeLimit(boolean $limit) : \acdhOeaw\util\Indexer
Sets size treshold for uploading child resources as binary resources.
For files bigger then this treshold a "pure RDF" Fedora resources will be created containing full metadata but no binary content.
boolean | $limit | maximum size in bytes; 0 will cause no files upload, special value of -1 (default) will cause all files to be uploaded no matter their size |
setDepth(integer $depth) : \acdhOeaw\util\Indexer
Sets maximum indexing depth.
integer | $depth | maximum indexing depth (0 - only initial Resource dir, 1 - also its direct subdirectories, etc.) |
setIncludeEmptyDirs(boolean $include) : \acdhOeaw\util\Indexer
Sets if Fedora resources should be created for empty directories.
Note this setting is skipped when the $flatStructure
is set to true
.
boolean | $include | should resources be created for empty directories |
setMetaLookup(\acdhOeaw\util\metaLookup\MetaLookupInterface $metaLookup, boolean $require = false) : \acdhOeaw\util\Indexer
Sets a class providing metadata for indexed files.
\acdhOeaw\util\metaLookup\MetaLookupInterface | $metaLookup | |
boolean | $require | should files lacking external metadata be skipped |
performUpdate(\DirectoryIterator $iter, \acdhOeaw\schema\file\File $file, string $parent, boolean $upload) : \acdhOeaw\fedora\FedoraResource
Performs file upload taking care of versioning.
\DirectoryIterator | $iter | |
\acdhOeaw\schema\file\File | $file | |
string | $parent | |
boolean | $upload |
isSkippedExisting(\acdhOeaw\schema\file\File $file) : boolean
Checks if a given file should be skipped because it already exists in the repository while the Indexer skip mode is set to SKIP_EXIST or SKIP_BINARY_EXIST.
\acdhOeaw\schema\file\File | $file | file to be checked |