private static function conditionalAssetLocalFileSyncsDelete(FileSync $fileSync, asset $asset) { $unClosedStatuses = array(asset::ASSET_STATUS_QUEUED, asset::ASSET_STATUS_CONVERTING, asset::ASSET_STATUS_WAIT_FOR_CONVERT, asset::ASSET_STATUS_EXPORTING); $unClosedAssets = assetPeer::retrieveReadyByEntryId($asset->getEntryId(), null, $unClosedStatuses); if (count($unClosedAssets)) { $asset->setFileSyncVersionsToDelete(array($fileSync->getVersion())); $asset->save(); return; } $assetsToDelete = assetPeer::retrieveReadyByEntryId($asset->getEntryId()); self::deleteAssetLocalFileSyncsByAssetArray($assetsToDelete); self::deleteAssetLocalFileSyncs($fileSync->getVersion(), $asset); }