Returns only updated language codes.

@param \eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct $contentUpdateStruct

@return array
559413
private function getUpdatedLanguageCodes(APIContentUpdateStruct $contentUpdateStruct)
    {
        $languageCodes = [
            $contentUpdateStruct->initialLanguageCode => true,
        ];

        foreach ($contentUpdateStruct->fields as $field) {
            if ($field->languageCode === null || isset($languageCodes[$field->languageCode])) {
                continue;
            }

            $languageCodes[$field->languageCode] = true;
        }

        return array_keys($languageCodes);
    }
915376
protected function getUpdateList()
    {
        $start = [];
        $updates = update_get_update_list();
        foreach ($updates as $module => $update) {
            $start[$module] = $update['start'];
        }

        return $start;
    }
1281732
public function actionUpdateAll()
    {
        
        // Scan the locales folder for languages in the wwextension and
        // launch actionUpdate for each of them.

    	// Get the list of languages that will be updated.
		$locales = $this->getLanguageList();

		// We now identified locales to be updated.
    	$this->outVerbose("Languages '" . implode(',', $locales) . "' will be updated for extension '" . $this->options['extension'] . "'.");
    	foreach ($locales as $l) {
    		$this->options['language'] = $l;
    		$this->checkUpdateInput();
    		$this->actionUpdate();
    		
    		$this->outVerbose("");
    	}
        
    }
508455
protected function getUpdatedEventAttributes(): array
    {
        $old = [];
        $new = [];

        foreach ($this->getDirty() as $attribute => $value) {
            if ($this->isAttributeAuditable($attribute)) {
                $old[$attribute] = Arr::get($this->original, $attribute);
                $new[$attribute] = Arr::get($this->attributes, $attribute);
            }
        }

        return [
            $old,
            $new,
        ];
    }
571375
public function setContentLanguages($contentLanguages)
    {
        $fileVersion = $this->getFileVersion();

        foreach ($contentLanguages as $locale) {
            $contentLanguage = new FileVersionContentLanguage();
            $contentLanguage->setFileVersion($fileVersion);
            $contentLanguage->setLocale($locale);
            if (!$fileVersion->getContentLanguages()->contains($contentLanguage)) {
                $fileVersion->addContentLanguage($contentLanguage);
            }
        }

        return $this;
    }
297113
public function loadContentInVersion($contentId, $versionNumber, Request $request)
    {
        $languages = Language::ALL;
        if ($request->query->has('languages')) {
            $languages = explode(',', $request->query->get('languages'));
        }

        $content = $this->repository->getContentService()->loadContent(
            $contentId,
            $languages,
            $versionNumber
        );
        $contentType = $this->repository->getContentTypeService()->loadContentType(
            $content->getVersionInfo()->getContentInfo()->contentTypeId
        );

        $versionValue = new Values\Version(
            $content,
            $contentType,
            $this->repository->getContentService()->loadRelations($content->getVersionInfo()),
            $request->getPathInfo()
        );

        if ($content->contentInfo->mainLocationId === null || $content->versionInfo->status === VersionInfo::STATUS_DRAFT) {
            return $versionValue;
        }

        return new Values\CachedValue(
            $versionValue,
            array('locationId' => $content->contentInfo->mainLocationId)
        );
    }
267608
public function getTranslatedContent(string $from, string $to, string $remoteServiceKey, Content $content): Content
    {
        $translatedFields = $this->getTranslatedFields($from, $to, $remoteServiceKey, $content);

        $contentService                           = $this->repository->getContentService();
        $contentDraft                             = $contentService->createContentDraft($content->contentInfo);
        $contentUpdateStruct                      = $contentService->newContentUpdateStruct();
        $contentUpdateStruct->initialLanguageCode = $to;

        $contentType = $this->repository->getContentTypeService()->loadContentType(
            $content->contentInfo->contentTypeId
        );

        foreach ($contentType->getFieldDefinitions() as $field) {
            /** @var FieldDefinition $field */
            $fieldName = $field->identifier;
            $newValue  = $translatedFields[$fieldName] ?? $content->getFieldValue($fieldName);
            $contentUpdateStruct->setField($fieldName, $newValue);
        }

        return $contentService->updateContent($contentDraft->versionInfo, $contentUpdateStruct);
    }
251101
public function createTypeFromUpdateStruct(UpdateStruct $updateStruct): Type
    {
        $type = new Type();

        $type->name = $updateStruct->name;
        $type->description = $updateStruct->description;
        $type->identifier = $updateStruct->identifier;
        $type->modified = $updateStruct->modified;
        $type->modifierId = $updateStruct->modifierId;
        $type->remoteId = $updateStruct->remoteId;
        $type->urlAliasSchema = $updateStruct->urlAliasSchema;
        $type->nameSchema = $updateStruct->nameSchema;
        $type->isContainer = $updateStruct->isContainer;
        $type->initialLanguageId = $updateStruct->initialLanguageId;
        $type->defaultAlwaysAvailable = $updateStruct->defaultAlwaysAvailable;
        $type->sortField = $updateStruct->sortField;
        $type->sortOrder = $updateStruct->sortOrder;
        $type->languageCodes = array_keys($updateStruct->name);

        return $type;
    }
1321294
public function removeContentTypeTranslation(int $contentTypeId, string $languageCode): Type
    {
        $type = $this->load($contentTypeId, Type::STATUS_DRAFT);

        unset($type->name[$languageCode]);
        unset($type->description[$languageCode]);

        foreach ($type->fieldDefinitions as $fieldDefinition) {
            $this->contentTypeGateway->removeFieldDefinitionTranslation(
                $fieldDefinition->id,
                $languageCode,
                Type::STATUS_DRAFT
            );

            //Refresh FieldDefinition object after removing translation data.
            $fieldDefinition = $this->getFieldDefinition(
                $fieldDefinition->id,
                Type::STATUS_DRAFT
            );
            unset($fieldDefinition->name[$languageCode]);
            unset($fieldDefinition->description[$languageCode]);
            $storageFieldDefinition = new StorageFieldDefinition();
            $this->mapper->toStorageFieldDefinition($fieldDefinition, $storageFieldDefinition);
            $this->contentTypeGateway->updateFieldDefinition(
                $contentTypeId,
                Type::STATUS_DRAFT,
                $fieldDefinition,
                $storageFieldDefinition
            );
        }

        $updateStruct = $this->mapper->createUpdateStructFromType($type);

        return $this->update($type->id, Type::STATUS_DRAFT, $updateStruct);
    }
632349
public function needsUpdate()
    {
        $new = $this->getContent();
        $old = $this->getFileContent();

        $normalize = function($content) {
            return str_replace("\r\n", "\n", $content);
        };

        return $normalize($new) !== $normalize($old);
    }
743229
public function getEncodings($refresh = false)
    {
        if (empty($this->detection['acceptEncoding']) || $refresh) {
            $this->detectEncoding($this->acceptEncoding);
        }

        return $this->encodings;
    }
408800
protected function updateDefaultListable(array $contentTypeDefaultListable)
    {
        $defaultListable = $this->getDefaultListableColumns();

        $toKeep = array_intersect_key($contentTypeDefaultListable, $defaultListable);
        $toAdd = array_diff_key($defaultListable, $toKeep);

        return array_merge($toKeep, $toAdd);
    }
97412
public function update(UpdateStruct $updateStruct, $tagId)
    {
        $query = $this->handler->createUpdateQuery();
        $query
            ->update($this->handler->quoteTable('eztags'))
            ->set(
                $this->handler->quoteColumn('modified'),
                $query->bindValue(time(), null, PDO::PARAM_INT)
            )->set(
                $this->handler->quoteColumn('keyword'),
                $query->bindValue($updateStruct->keywords[$updateStruct->mainLanguageCode], null, PDO::PARAM_STR)
            )->set(
                $this->handler->quoteColumn('remote_id'),
                $query->bindValue($updateStruct->remoteId, null, PDO::PARAM_STR)
            )->set(
                $this->handler->quoteColumn('main_language_id'),
                $query->bindValue(
                    $this->languageHandler->loadByLanguageCode(
                        $updateStruct->mainLanguageCode
                    )->id,
                    null,
                    PDO::PARAM_INT
                )
            )->set(
                $this->handler->quoteColumn('language_mask'),
                $query->bindValue(
                    $this->generateLanguageMask(
                        $updateStruct->keywords,
                        is_bool($updateStruct->alwaysAvailable) ? $updateStruct->alwaysAvailable : true
                    ),
                    null,
                    PDO::PARAM_INT
                )
            )->where(
                $query->expr->eq(
                    $this->handler->quoteColumn('id'),
                    $query->bindValue($tagId, null, PDO::PARAM_INT)
                )
            );

        $query->prepare()->execute();

        $query = $this->handler->createDeleteQuery();
        $query
            ->deleteFrom($this->handler->quoteTable('eztags_keyword'))
            ->where(
                $query->expr->in(
                    $this->handler->quoteColumn('keyword_id'),
                    $tagId
                )
            );

        $query->prepare()->execute();

        $this->insertTagKeywords(
            $tagId,
            $updateStruct->keywords,
            $updateStruct->mainLanguageCode,
            $updateStruct->alwaysAvailable
        );
    }
1035899
protected function getConfigForContentType(ContentType $contentType)
    {
        if ($this->hasConfigForContentType($contentType)) {
            return $this->config['override_by_type'][$contentType->identifier];
        }

        return [];
    }
482083
protected function getMappingContentType($language, ContentTypeInterface $contentType)
    {
        $mapping = array(
            'name' => 'name',
            'status_label' => 'status.labels.' . $language,
            'linked_to_site' => 'linkedToSite',
            'created_at' => 'createdAt',
            'created_by' => 'createdBy',
            'updated_at' => 'updatedAt',
            'updated_by' => 'updatedBy',
        );
        foreach ($contentType->getDefaultListable() as $column => $isListable) {
            if (!$isListable) {
                unset($mapping[$column]);
            }
        }
        foreach ($contentType->getFields() as $field) {
            $mapping['fields.' . $field->getFieldId() . '.string_value'] = 'attributes.' . $field->getFieldId() . '.stringValue';
        }

        return $mapping;
    }
1104673
protected function getLanguageCodes(Content $content, $versionNo = null)
    {
        $version = $this->contentService->loadVersionInfo($content->contentInfo, $versionNo);

        return $version->languageCodes;
    }
935197
public function updateContentTypeDraft($contentTypeId, Request $request)
    {
        $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);
        $contentTypeUpdateStruct = $this->inputDispatcher->parse(
            new Message(
                array(
                    'Content-Type' => $request->headers->get('Content-Type'),
                ),
                $request->getContent()
            )
        );

        try {
            $this->contentTypeService->updateContentTypeDraft(
                $contentTypeDraft,
                $contentTypeUpdateStruct
            );
        } catch (InvalidArgumentException $e) {
            throw new ForbiddenException($e->getMessage());
        }

        return new Values\RestContentType(
            // Reload the content type draft to get the updated values
            $this->contentTypeService->loadContentTypeDraft(
                $contentTypeDraft->id
            )
        );
    }