Index Locations of the given Content Object.

@param int $contentId Content Object Id
@param \Symfony\Component\Console\Helper\ProgressBar $progress
483999
private function indexLocations($contentId, ProgressBar $progress)
    {
        $locationIds = $this->getContentLocationIds($contentId);
        foreach ($locationIds as $locationId) {
            try {
                $location = $this->persistenceHandler->locationHandler()->load($locationId);
                $this->searchHandler->indexLocation($location);
            } catch (NotFoundException $e) {
                $this->logWarning($progress, "Could not load Location with id $locationId, so skipped for indexing. Full exception: " . $e->getMessage());
            }
        }
    }
704052
public function deleteContent($contentId)
    {
        $this->repository->getContentService()->deleteContent(
            $this->repository->getContentService()->loadContentInfo($contentId)
        );

        return new Values\NoContent();
    }
395331
protected function publishAliases($locationId, $parentLocationId, $contentId)
    {
        $content = $this->contentService->loadContent($contentId);

        $urlAliasNames = $this->nameSchemaResolver->resolveUrlAliasSchema($content);

        foreach ($urlAliasNames as $languageCode => $name) {
            try {
                $this->setMigrationTable();
                $this->urlAliasHandler->publishUrlAliasForLocation(
                    $locationId,
                    $parentLocationId,
                    $name,
                    $languageCode,
                    $content->contentInfo->alwaysAvailable
                );
                $this->setDefaultTable();
            } catch (Exception $e) {
                $this->setDefaultTable();
                throw $e;
            }
        }

        return count($urlAliasNames);
    }
712508
public function indexContent(Content $content)
    {
        $fullTextValue = $this->mapper->mapContent($content);

        $this->indexerGateway->index($fullTextValue);
    }
556594
private void updatePinProgressContentDescription(ProgressButton button) {
    int progress = button.getProgress();
    if (progress <= 0) {
      button.setContentDescription(getString(
          button.isChecked() ? R.string.content_desc_pinned_not_downloaded
              : R.string.content_desc_unpinned_not_downloaded));
    } else if (progress >= button.getMax()) {
      button.setContentDescription(getString(
          button.isChecked() ? R.string.content_desc_pinned_downloaded
              : R.string.content_desc_unpinned_downloaded));
    } else {
      button.setContentDescription(getString(
          button.isChecked() ? R.string.content_desc_pinned_downloading
              : R.string.content_desc_unpinned_downloading));
    }
  }
41314
public function syncFiles($contentId)
    {
        $content = $this->repository->getById($contentId);
        if (empty($content)) {
            return $this->respondNotFound();
        }
        $this->authorize('update', $content);
        $input   = $this->validator->validate('syncFiles');
        $content = $this->fileRepository->syncWith($content, $this->buildSyncData($input));
        return $this->respondWithSuccess($content);
    }
1008291
public static function move_annotations_to_final($backupid, $itemname, \core\progress\base $progress) {
        global $DB;
        $progress->start_progress('move_annotations_to_final');
        $rs = $DB->get_recordset('backup_ids_temp', array('backupid' => $backupid, 'itemname' => $itemname));
        $progress->progress();
        foreach($rs as $annotation) {
            // If corresponding 'itemfinal' annotation does not exist, update 'item' to 'itemfinal'
            if (! $DB->record_exists('backup_ids_temp', array('backupid' => $backupid,
                                                              'itemname' => $itemname . 'final',
                                                              'itemid' => $annotation->itemid))) {
                $DB->set_field('backup_ids_temp', 'itemname', $itemname . 'final', array('id' => $annotation->id));
            }
            $progress->progress();
        }
        $rs->close();
        // All the remaining $itemname annotations can be safely deleted
        $DB->delete_records('backup_ids_temp', array('backupid' => $backupid, 'itemname' => $itemname));
        $progress->end_progress();
    }
149083
private function loadContent(int $contentId, string $language): Content
    {
        return $this->repository->getContentService()->loadContent($contentId, [$language]);
    }
1057242
public function getContentObjectWords($contentId)
    {
        $query = $this->dbHandler->createSelectQuery();

        $this->setContentObjectWordsSelectQuery($query);

        $stmt = $query->prepare();
        $stmt->execute(['contentId' => $contentId]);

        $wordIDList = [];

        while (false !== ($row = $stmt->fetch(PDO::FETCH_NUM))) {
            $wordIDList[] = $row[0];
        }

        return $wordIDList;
    }
371741
public function deleteContentTypeDraft($contentTypeId)
    {
        $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);
        $this->contentTypeService->deleteContentType($contentTypeDraft);

        return new Values\NoContent();
    }
556418
protected function findLocationsByContentIds(array $contentIds)
    {
        $locations = [];

        foreach ($contentIds as $contentId) {
            $content = $this->repository->getContentService()->loadContent($contentId);
            foreach($this->repository->getLocationService()->loadLocations($content->contentInfo) as $location) {
                $locations[$location->id] = $location;
            }
        }

        return $locations;
    }
148931
private function deleteTranslationFromContentObject($contentId, $languageId)
    {
        $query = $this->connection->createQueryBuilder();
        $query->update('ezcontentobject')
            // parameter for bitwise operation has to be placed verbatim (w/o binding) for this to work cross-DBMS
            ->set('language_mask', 'language_mask & ~ ' . $languageId)
            ->set('modified', ':now')
            ->where('id = :contentId')
            ->andWhere(
            // make sure removed translation is not the last one (incl. alwaysAvailable)
                $query->expr()->andX(
                    'language_mask & ~ ' . $languageId . ' <> 0',
                    'language_mask & ~ ' . $languageId . ' <> 1'
                )
            )
            ->setParameter(':now', time())
            ->setParameter(':contentId', $contentId)
        ;

        $rowCount = $query->execute();

        // no rows updated means that most likely somehow it was the last remaining translation
        if ($rowCount === 0) {
            throw new BadStateException(
                '$languageCode',
                'Specified translation is the only one Content Object Version has'
            );
        }
    }
917506
public function countLocationsByContentId($contentId)
    {
        try {
            return $this->innerGateway->countLocationsByContentId($contentId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
373032
public function setStatus($contentId, $version, $status)
    {
        try {
            return $this->innerGateway->setStatus($contentId, $version, $status);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
306104
public function deleteAction($contentId)
    {
        $repository = $this->get('open_orchestra_model.repository.content');
        $content = $repository->findOneByContentId($contentId);
        $this->denyAccessUnlessGranted(ContributionActionInterface::DELETE, $content);

        if (!$this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $content)) {
            throw new ContentNotDeletableException();
        }

        $repository->softDeleteContent($contentId);
        $this->dispatchEvent(ContentEvents::CONTENT_DELETE, new ContentDeleteEvent($contentId, $content->getSiteId()));

        return array();
    }
587289
public function delete($contentTypeId, $status)
    {
        if (Type::STATUS_DEFINED === $status && $this->contentTypeGateway->countInstancesOfType($contentTypeId)) {
            throw new BadStateException(
                '$contentTypeId',
                "ContentType with given id still has content instances and therefore can't be deleted"
            );
        }

        $this->contentTypeGateway->delete($contentTypeId, $status);

        // @todo FIXME: Return true only if deletion happened
        return true;
    }
1370572
private function getSectionId($locationId)
    {
        $location = $this->load($locationId);
        $locationContentInfo = $this->contentHandler->loadContentInfo($location->contentId);

        return $locationContentInfo->sectionId;
    }