AssetIndexer

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

Class AssetIndexer

See also http://craftcms.com

View source

Public Properties

PropertyDescription
$behaviorsyii\base\Behavior – List of behaviors attached to this component
$indexingSessionIdstring

$indexingSessionId

Type
string
Access
Read-only

View source

Signature

public string getIndexingSessionId ( )

Public Methods

MethodDescription
__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.
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()Get a sorted list of files on a volume by it's id and an optional directory filter indexed by path.
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.
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.

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

Signature

public array extractFolderItemsFromIndexList ( array &$indexList )

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

Signature

public array extractSkippedItemsFromIndexList ( array &$indexList )

getIndexListOnVolume()

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

View source

Arguments

Returns

array

Signature

public array getIndexListOnVolume ( craft\base\VolumeInterface $volume, \craft\services\string $directory = '' )

getIndexingSessionId()

Returns a unique indexing session id.

View source

Returns

string

Signature

public string getIndexingSessionId ( )

getMissingFiles()

Return a list of missing files for an indexing session.

View source

Arguments

  • $sessionId (string) – Session id.

Returns

array

Signature

public array getMissingFiles ( \craft\services\string $sessionId )

getNextIndexEntry()

Returns the next item to index in an indexing session.

View source

Arguments

  • $sessionId (string) – Session id.
  • $volumeId (integer) – Volume id.

Returns

craft\models\AssetIndexData, null

Signature

public craft\models\AssetIndexData, null getNextIndexEntry ( \craft\services\string $sessionId, \craft\services\int $volumeId )

indexFile()

Index a single file by Volume and path.

View source

Arguments

  • $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.

Returns

boolean, craft\elements\Asset

Throws

Signature

public boolean, craft\elements\Asset indexFile ( craft\base\Volume $volume, \craft\services\string $path, \craft\services\string $sessionId = '', \craft\services\bool $cacheImages = false )

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

Signature

public array prepareIndexList ( \craft\services\string $sessionId, \craft\services\int $volumeId, \craft\services\string $directory = '' )

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

Signature

public mixed processIndexForVolume ( \craft\services\string $sessionId, \craft\services\int $volumeId, \craft\services\bool $cacheImages = false )

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.

Signature

public void storeIndexList ( array $indexList, \craft\services\string $sessionId, \craft\services\int $volumeId )

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.

Signature

public void updateIndexEntry ( \craft\services\int $entryId, array $data )