AssetIndexer

Type
Class
Namespace
craft\services
Inherits
craft\services\AssetIndexer » yii\base\Component (opens new window) » yii\base\BaseObject (opens new window)
Implements
yii\base\Configurable (opens new window)
Since
3.0.0

Asset Indexer service.

An instance of the service is available via Craft::$app->assetIndexer.

View source (opens new window)

# Public Properties

# existingIndexingSessions

Type
array (opens new window)
Default value
null

View source (opens new window)

# Public Methods

Method Description
__call() (opens new window) Calls the named method which is not a class method.
__clone() (opens new window) This method is called after the object is created by cloning an existing one.
__construct() (opens new window) Constructor.
__get() (opens new window) Returns the value of a component property.
__isset() (opens new window) Checks if a property is set, i.e. defined and not null.
__set() (opens new window) Sets the value of a component property.
__unset() (opens new window) Sets a component property to be null.
attachBehavior() (opens new window) Attaches a behavior to this component.
attachBehaviors() (opens new window) Attaches a list of behaviors to the component.
behaviors() (opens new window) Returns a list of behaviors that this component should behave as.
canGetProperty() (opens new window) Returns a value indicating whether a property can be read.
canSetProperty() (opens new window) Returns a value indicating whether a property can be set.
className() (opens new window) Returns the fully qualified name of this class.
createIndexingSession() Create a new indexing session.
detachBehavior() (opens new window) Detaches a behavior from the component.
detachBehaviors() (opens new window) Detaches all behaviors from the component.
ensureBehaviors() (opens new window) Makes sure that the behaviors declared in behaviors() (opens new window) are attached to this component.
getBehavior() (opens new window) Returns the named behavior object.
getBehaviors() (opens new window) Returns all behaviors attached to this component.
getExistingIndexingSessions() Return a list of currently active indexing sessions.
getIndexListOnVolume() Returns a sorted list of files on a volume.
getIndexingSessionById() Get an indexing session by its id.
getMissingEntriesForSession() Get missing entries after an indexing session.
getNextIndexEntry() Returns the next item to index in an indexing session.
getSkippedItemsForSession() Get skipped items for an indexing session.
hasEventHandlers() (opens new window) Returns a value indicating whether there is any handler attached to the named event.
hasMethod() (opens new window) Returns a value indicating whether a method is defined.
hasProperty() (opens new window) Returns a value indicating whether a property is defined for this component.
indexFile() Index a single file by Volume and path.
indexFileByEntry() Indexes a file by its index entry.
indexFileByListing()
indexFolderByEntry() Indexes a folder by its index entry.
indexFolderByListing()
init() (opens new window) Initializes the object.
off() (opens new window) Detaches an existing event handler from this component.
on() (opens new window) Attaches an event handler to an event.
processIndexSession() Process an indexing session step.
removeCliIndexingSessions() Remove all CLI-based indexing sessions.
startIndexingSession() Start an indexing session for an array of volumes. If first element of array is "all", all volumes wil be indexed.
stopIndexingSession() Stop an indexing session.
storeIndexList() Store the index list in the index data table.
trigger() (opens new window) Triggers an event.
updateIndexEntry() Update indexing-process related data on an index entry.

# createIndexingSession()

Since
4.0.0

Create a new indexing session.

View source (opens new window)

Arguments

Returns

craft\models\AssetIndexingSession

# getExistingIndexingSessions()

Since
4.0.0

Return a list of currently active indexing sessions.

View source (opens new window)

Returns

array (opens new window)

# getIndexListOnVolume()

Returns a sorted list of files on a volume.

View source (opens new window)

Arguments

Returns

Generator (opens new window)

Throws

# getIndexingSessionById()

Since
4.0.0

Get an indexing session by its id.

View source (opens new window)

Arguments

Returns

craft\models\AssetIndexingSession, null (opens new window)

# getMissingEntriesForSession()

Since
4.0.0

Get missing entries after an indexing session.

View source (opens new window)

Arguments

Returns

array (opens new window) – With files and folders keys, containing missing entries.

Throws

# getNextIndexEntry()

Returns the next item to index in an indexing session.

View source (opens new window)

Arguments

Returns

craft\models\AssetIndexData, null (opens new window)

# getSkippedItemsForSession()

Since
4.0.0

Get skipped items for an indexing session.

View source (opens new window)

Arguments

Returns

string (opens new window)[]

# indexFile()

Index a single file by Volume and path.

View source (opens new window)

Arguments

Returns

craft\elements\Asset

Throws

# indexFileByEntry()

Indexes a file by its index entry.

View source (opens new window)

Arguments

Returns

craft\elements\Asset

Throws

# indexFileByListing()

Since
4.0.0

View source (opens new window)

Arguments

Returns

craft\elements\Asset

Throws

# indexFolderByEntry()

Since
4.0.0

Indexes a folder by its index entry.

View source (opens new window)

Arguments

Returns

craft\models\VolumeFolder

Throws

# indexFolderByListing()

Since
4.0.0

View source (opens new window)

Arguments

Returns

craft\models\VolumeFolder

Throws

# processIndexSession()

Since
4.0.0

Process an indexing session step.

View source (opens new window)

Arguments

Returns

craft\models\AssetIndexingSession

Throws

# removeCliIndexingSessions()

Since
4.0.0

Remove all CLI-based indexing sessions.

View source (opens new window)

Returns

integer (opens new window)

Throws

# startIndexingSession()

Since
4.0.0

Start an indexing session for an array of volumes. If first element of array is "all", all volumes wil be indexed.

View source (opens new window)

Arguments

Returns

craft\models\AssetIndexingSession

# stopIndexingSession()

Since
4.0.0

Stop an indexing session.

View source (opens new window)

Arguments

Throws

# storeIndexList()

Store the index list in the index data table.

View source (opens new window)

Arguments

Returns

integer (opens new window) – Number of entries inserted

# updateIndexEntry()

Update indexing-process related data on an index entry.

View source (opens new window)

Arguments

# Protected Methods

Method Description
incrementProcessedEntryCount() Increment the processed entry count on a session.
storeIndexingSession() Store an indexing session to DB.

# incrementProcessedEntryCount()

Increment the processed entry count on a session.

View source (opens new window)

Arguments

Returns

craft\models\AssetIndexingSession

Throws

# storeIndexingSession()

Store an indexing session to DB.

View source (opens new window)

Arguments