AssetIndexer ​
- Type
- Class
- Namespace
- craft\services
- Inherits
- craft\services\AssetIndexer » yii\base\Component » yii\base\BaseObject
- Implements
- yii\base\Configurable
- Since
- 3.0.0
Asset Indexer service.
An instance of the service is available via Craft::$app->assetIndexer.
Public Properties ​
| Property | Description |
|---|---|
| behaviors | yii\base\Behavior – List of behaviors attached to this component. |
| indexingSessionId | string |
indexingSessionId ​
- Type
- string
- Default value
null- Access
- Read-only
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 a component property. |
| __isset() | Checks if a property is set, i.e. defined and not null. |
| __set() | Sets the value of a component property. |
| __unset() | Sets a component property to be 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 for this component. |
| indexFile() | Index a single file by its 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.
Throws ​
extractFolderItemsFromIndexList() ​
Remove folder items from an index list and return their paths.
Arguments ​
$indexList(array) – Index list generated byAssetIndexer::getIndexListOnVolume()
Returns ​
extractSkippedItemsFromIndexList() ​
Remove skipped items from an index list and return their paths.
Arguments ​
$indexList(array) – Index list generated byAssetIndexer::getIndexListOnVolume()
Returns ​
getIndexListOnVolume() ​
Returns a sorted list of files on a volume.
Arguments ​
$volume(craft\base\VolumeInterface) – The Volume to perform indexing on.$directory(string) – Optional path to get index list on a subfolder.
Returns ​
getIndexingSessionId() ​
Returns a unique indexing session ID.
Returns ​
getMissingFiles() ​
Return a list of missing files for an indexing session.
Arguments ​
Returns ​
getNextIndexEntry() ​
Returns the next item to index in an indexing session.
Arguments ​
Returns ​
craft\models\AssetIndexData, null
indexFile() ​
Index a single file by its volume and path.
Arguments ​
$volume(craft\base\VolumeInterface)$path(string)$sessionId(string) – The indexing session ID (optional).$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 ​
Throws ​
- craft\errors\MissingAssetException
if the asset record doesn't exist and $createIfMissing is false - craft\errors\VolumeObjectNotFoundException
If the file to be indexed cannot be found.
indexFileByEntry() ​
Indexes a file by its index entry.
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 ​
Throws ​
- craft\errors\MissingAssetException
if the asset record doesn't exist and $createIfMissing is false - craft\errors\VolumeObjectNotFoundException
If the file to be indexed cannot be found. - craft\errors\AssetDisallowedExtensionException
If the file being indexed has a disallowed extension
prepareIndexList() ​
Gets the index list for a volume.
Arguments ​
$sessionId(string) – The indexing session ID.$volumeId(integer) – The volume ID.$directory(string) – Optional path to get index list on a subfolder.
Returns ​
processIndexForVolume() ​
Process index for a volume.
Arguments ​
$sessionId(string) – The indexing session ID.$volumeId(integer) – The 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.
Arguments ​
$indexList(array) – Index list generated byAssetIndexer::getIndexListOnVolume()$sessionId(string) – The indexing session ID.$volumeId(integer) – The volume ID.
updateIndexEntry() ​
Update indexing-process related data on an index entry.