From 7ecb943f14656f87cb15736e976f5d93422ddfe2 Mon Sep 17 00:00:00 2001 From: andris-sevcenko Date: Tue, 21 Mar 2017 22:51:37 +0200 Subject: [PATCH] Asset Indexing. --- src/elements/Asset.php | 11 +++++++++++ src/services/AssetIndexer.php | 5 +---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/elements/Asset.php b/src/elements/Asset.php index 5d13ed7aa11..17491d0b9c6 100644 --- a/src/elements/Asset.php +++ b/src/elements/Asset.php @@ -555,6 +555,17 @@ public function rules() return $rules; } + /** + * @inheritdoc + */ + public function scenarios() + { + $scenarios = parent::scenarios(); + $scenarios[self::SCENARIO_INDEX] = []; + + return $scenarios; + } + /** * @inheritdoc */ diff --git a/src/services/AssetIndexer.php b/src/services/AssetIndexer.php index 007acd8a051..c5238db0924 100644 --- a/src/services/AssetIndexer.php +++ b/src/services/AssetIndexer.php @@ -520,10 +520,7 @@ private function _indexFileByIndexData(AssetIndexData $indexEntryModel, bool $ca $asset->dateModified = $timeModified; - // Make sure there are no double spaces, if the filename had a space followed by a - // capital letter because of Yii's "word" logic. - $asset->title = str_replace(' ', ' ',StringHelper::toTitleCase(pathinfo($filename, PATHINFO_FILENAME))); - Craft::$app->getAssets()->saveAsset($asset, false); + Craft::$app->getElements()->saveElement($asset); return $asset; }