AssetIndexer

Type
Class
Namespace
craft\services
Inherits
craft\services\AssetIndexer » yii\base\Component » yii\base\BaseObject
Implements
yii\base\Configurable
Since
3.0.0

Class AssetIndexer

See also http://craftcms.com

View source

# Public Properties

Property Description
behaviors yii\base\Behavior – List of behaviors attached to this component
indexingSessionId string

# indexingSessionId

Type
string
Access
Read-only

View source

# Public Methods

Method Description
__call() Calls the named method which is not a class method.
__clone() This method is called after the object is created by cloning an existing one.
__construct() Constructor.
__get() Returns the value of an object property.
__isset() Checks if a property is set, i.e. defined and not null.
__set() Sets value of an object property.
__unset() Sets an object property to null.
attachBehavior() Attaches a behavior to this component.
attachBehaviors() Attaches a list of behaviors to the component.
behaviors() Returns a list of behaviors that this component should behave as.
canGetProperty() Returns a value indicating whether a property can be read.
canSetProperty() Returns a value indicating whether a property can be set.
className() Returns the fully qualified name of this class.
deleteStaleIndexingData() Clean up stale asset indexing data. Stale indexing data is all session data for sessions that have all the recordIds set.
detachBehavior() Detaches a behavior from the component.
detachBehaviors() Detaches all behaviors from the component.
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component.
extractFolderItemsFromIndexList() Remove folder items from an index list and return their paths.
extractSkippedItemsFromIndexList() Remove skipped items from an index list and return their paths.
getBehavior() Returns the named behavior object.
getBehaviors() Returns all behaviors attached to this component.
getIndexListOnVolume() Returns a sorted list of files on a volume.
getIndexingSessionId() Returns a unique indexing session id.
getMissingFiles() Return a list of missing files for an indexing session.
getNextIndexEntry() Returns the next item to index in an indexing session.
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event.
hasMethod() Returns a value indicating whether a method is defined.
hasProperty() Returns a value indicating whether a property is defined.
indexFile() Index a single file by Volume and path.
indexFileByEntry() Indexes a file by its index entry.
init() Initializes the object.
off() Detaches an existing event handler from this component.
on() Attaches an event handler to an event.
prepareIndexList() Gets the index list for a volume.
processIndexForVolume() Process index for a volume.
storeIndexList() Store the index list in the index data table.
trigger() Triggers an event.
updateIndexEntry() Update indexing-process related data on an index entry.

# deleteStaleIndexingData()

Clean up stale asset indexing data. Stale indexing data is all session data for sessions that have all the recordIds set.

View source

Throws

# extractFolderItemsFromIndexList()

Remove folder items from an index list and return their paths.

View source

Arguments

  • $indexList (array) – Index list generated by AssetIndexer::getIndexListOnVolume()

Returns

array

# extractSkippedItemsFromIndexList()

Remove skipped items from an index list and return their paths.

View source

Arguments

  • $indexList (array) – Index list generated by AssetIndexer::getIndexListOnVolume()

Returns

array

# getIndexListOnVolume()

Returns a sorted list of files on a volume.

View source

Arguments

Returns

array

# getIndexingSessionId()

Returns a unique indexing session id.

View source

Returns

string

# getMissingFiles()

Return a list of missing files for an indexing session.

View source

Arguments

  • $sessionId (string) – Session id.

Returns

array

# getNextIndexEntry()

Returns the next item to index in an indexing session.

View source

Arguments

Returns

craft\models\AssetIndexData, null

# indexFile()

Index a single file by Volume and path.

View source

Arguments

  • $volume (craft\base\VolumeInterface)
  • $path (string)
  • $sessionId (string) – Optional indexing session id.
  • $cacheImages (boolean) – Whether remotely-stored images should be downloaded and stored locally, to speed up transform generation.
  • $createIfMissing (boolean) – Whether the asset record should be created if it doesn't exist yet

Returns

boolean, craft\elements\Asset

Throws

# indexFileByEntry()

Indexes a file by its index entry.

View source

Arguments

  • $indexEntry (craft\models\AssetIndexData)
  • $cacheImages (boolean) – Whether remotely-stored images should be downloaded and stored locally, to speed up transform generation.
  • $createIfMissing (boolean) – Whether the asset record should be created if it doesn't exist yet

Returns

boolean, craft\elements\Asset

Throws

# prepareIndexList()

Gets the index list for a volume.

View source

Arguments

  • $sessionId (string) – Session id.
  • $volumeId (integer) – Volume id.
  • $directory (string) – Optional path to get index list on a subfolder.

Returns

array

# processIndexForVolume()

Process index for a volume.

View source

Arguments

  • $sessionId (string) – Session id.
  • $volumeId (integer) – Volume id.
  • $cacheImages (boolean) – Whether remotely-stored images should be downloaded and stored locally, to speed up transform generation.

Returns

mixed

# storeIndexList()

Store the index list in the index data table.

View source

Arguments

  • $indexList (array) – Index list generated by AssetIndexer::getIndexListOnVolume()
  • $sessionId (string) – Session id.
  • $volumeId (integer) – Volume id.

# updateIndexEntry()

Update indexing-process related data on an index entry.

View source

Arguments

  • $entryId (integer) – Index entry id.
  • $data (array) – Key=>value array of data to update.