/** * Given a set of asset manipulations, trigger any necessary publish, protect, or * delete actions on each asset. * * @param AssetManipulationList $manipulations */ protected function processManipulation(AssetManipulationList $manipulations) { // When deleting from stage then check if we should archive assets $archive = $this->owner->config()->keep_archived_assets; // Publish assets $this->publishAll($manipulations->getPublicAssets()); // Protect assets $this->protectAll($manipulations->getProtectedAssets()); // Check deletion policy $deletedAssets = $manipulations->getDeletedAssets(); if ($archive && $this->isVersioned()) { // Archived assets are kept protected $this->protectAll($deletedAssets); } else { // Otherwise remove all assets $this->deleteAll($deletedAssets); } }
/** * Helper to count all items in a set * * @param AssetManipulationList $set * @return int */ protected function countItems(AssetManipulationList $set) { return count($set->getPublicAssets()) + count($set->getProtectedAssets()) + count($set->getDeletedAssets()); }