Craft 3 Class Reference

Class craft\services\AssetIndexer

Inheritance
craft\services\AssetIndexer » yii\base\Component » yii\base\BaseObject
Implements
yii\base\Configurable
Available since version
3.0
Source Code
https://github.com/craftcms/cms/blob/master/src/services/AssetIndexer.php

Class AssetIndexer

See also http://craftcms.com.

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

Method Details

extractFolderItemsFromIndexList() public method #

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

public array extractFolderItemsFromIndexList ( array &$indexList )
$indexList array Index list generated by AssetIndexer::getIndexListOnVolume()

extractSkippedItemsFromIndexList() public method #

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

public array extractSkippedItemsFromIndexList ( array &$indexList )
$indexList array Index list generated by AssetIndexer::getIndexListOnVolume()

getIndexListOnVolume() public method #

Get a sorted list of files on a volume by it's id and an optional directory filter indexed by path.

public array getIndexListOnVolume ( craft\base\VolumeInterface $volume, \craft\services\string $directory '' )
$volume craft\base\VolumeInterface The Volume to perform indexing on.
$directory string Optional path to get index list on a subfolder.

getIndexingSessionId() public method #

Returns a unique indexing session id.

public string getIndexingSessionId ( )

getMissingFiles() public method #

Return a list of missing files for an indexing session.

public array getMissingFiles ( \craft\services\string $sessionId )
$sessionId string Session id.

getNextIndexEntry() public method #

Returns the next item to index in an indexing session.

public craft\models\AssetIndexData, null getNextIndexEntry ( \craft\services\string $sessionId, \craft\services\int $volumeId )
$sessionId string Session id.
$volumeId integer Volume id.

indexFile() public method #

Index a single file by Volume and path.

public boolean, craft\elements\Asset indexFile ( craft\base\Volume $volume, \craft\services\string $path, \craft\services\string $sessionId '', \craft\services\bool $cacheImages false )
$volume craft\base\Volume
$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.
throws craft\errors\VolumeObjectNotFoundException If the file to be indexed cannot be found.

prepareIndexList() public method #

Gets the index list for a volume.

public array prepareIndexList ( \craft\services\string $sessionId, \craft\services\int $volumeId, \craft\services\string $directory '' )
$sessionId string Session id.
$volumeId integer Volume id.
$directory string Optional path to get index list on a subfolder.

processIndexForVolume() public method #

Process index for a volume.

public mixed processIndexForVolume ( \craft\services\string $sessionId, \craft\services\int $volumeId, \craft\services\bool $cacheImages false )
$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.

storeIndexList() public method #

Store the index list in the index data table.

public void storeIndexList ( array $indexList, \craft\services\string $sessionId, \craft\services\int $volumeId )
$indexList array Index list generated by AssetIndexer::getIndexListOnVolume()
$sessionId string Session id.
$volumeId integer Volume id.

updateIndexEntry() public method #

Update indexing-process related data on an index entry.

public void updateIndexEntry ( \craft\services\int $entryId, array $data )
$entryId integer Index entry id.
$data array Key=>value array of data to update.