-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Add Asset Indexing as a cli action #2980
Comments
Converting the indexing process to a Yii queue is pretty critical for any site with a sizeable amount of assets. We've run into all sort of problems with indexing (latest being #2876 (comment)), which makes indexing basically a "cross your fingers" operation, that's nearly impossible to debug. |
Is there a way to index assets from a migration script? |
Not currently. |
This works for me inside of a migration script for indexing assets on a specific volume: try {
if ($volume = Craft::$app->getVolumes()->getVolumeByHandle('VOLUME_HANDLE')) {
foreach (Craft::$app->getAssetIndexer()->getIndexListOnVolume($volume) as $item) {
Craft::$app->getAssetIndexer()->indexFile(
$volume,
$item['path'],
'',
false
);
}
} else {
return false;
}
return true;
} catch (\Throwable $e) {
echo $e->getMessage();
return false;
} |
It would be great to be able to run Asset Indexing via the
craft cli
.The text was updated successfully, but these errors were encountered: