Dectivate an existing entry point for a specific target

@param string $entryId
@param string $target
@throws \common_exception_InconsistentData
@return boolean success
179278
public function deactivateEntryPoint($entryId, $target = self::OPTION_POSTLOGIN)
    {
        $success = false;
        $entryPoints = $this->getOption(self::OPTION_ENTRYPOINTS);
        if (!isset($entryPoints[$entryId])) {
            throw new \common_exception_InconsistentData('Unknown entrypoint '.$entryId);
        }
        $actives = $this->hasOption($target) ? $this->getOption($target) : array();
        if (in_array($entryId, $actives)) {
            $actives = array_diff($actives, array($entryId));
            $this->setOption($target, $actives);
            $success = true;
        } else {
            \common_Logger::w('Tried to desactivate inactive entry point '.$entryId);
        }
        return $success;
    }
331221
private function checkNestedExpression($entryId, NestedExpression $nestedExpression)
    {
        $expressions = $nestedExpression->getExpressions();
        foreach ($expressions as $expression) {
            if ($expression->isNested()) {
                $expressionResult = $this->checkNestedExpression($entryId, $expression);
            } else {
                $expressionResult = $this->checkExpression($entryId, $expression);
            }

            if (false === $expressionResult && $nestedExpression->getExpressionOperator() === NestedExpression::AND_OPERATOR) {
                return $nestedExpression->isNegate();
            }
            if (true === $expressionResult && $nestedExpression->getExpressionOperator() === NestedExpression::OR_OPERATOR) {
                return !$nestedExpression->isNegate();
            }
        }


        if ($nestedExpression->getExpressionOperator() === NestedExpression::AND_OPERATOR) {
            return !$nestedExpression->isNegate();
        } elseif ($nestedExpression->getExpressionOperator() === NestedExpression::OR_OPERATOR) {
            return $nestedExpression->isNegate();
        }

        $errMsg = 'unknown field';
        throw new InvalidArgumentException($errMsg);
    }
665230
public static function update_entry($entryid, $data) {
        global $DB;

        $params = array('entryid' => $entryid, 'data' => $data);
        $params = self::validate_parameters(self::update_entry_parameters(), $params);
        $warnings = array();
        $fieldnotifications = array();
        $updated = false;

        $record = $DB->get_record('data_records', array('id' => $params['entryid']), '*', MUST_EXIST);
        list($database, $course, $cm, $context) = self::validate_database($record->dataid);
        // Check database is open in time.
        data_require_time_available($database, null, $context);

        if (!data_user_can_manage_entry($record, $database, $context)) {
            throw new moodle_exception('noaccess', 'data');
        }

        // Prepare the data as is expected by the API.
        $datarecord = new stdClass;
        foreach ($params['data'] as $data) {
            $subfield = ($data['subfield'] !== '') ? '_' . $data['subfield'] : '';
            // We ask for JSON encoded values because of multiple choice forms or checkboxes that use array parameters.
            $datarecord->{'field_' . $data['fieldid'] . $subfield} = json_decode($data['value']);
        }
        // Validate to ensure that enough data was submitted.
        $fields = $DB->get_records('data_fields', array('dataid' => $database->id));
        $processeddata = data_process_submission($database, $fields, $datarecord);

        // Format notifications.
        if (!empty($processeddata->fieldnotifications)) {
            foreach ($processeddata->fieldnotifications as $field => $notififications) {
                foreach ($notififications as $notif) {
                    $fieldnotifications[] = [
                        'fieldname' => $field,
                        'notification' => $notif,
                    ];
                }
            }
        }

        if ($processeddata->validated) {
            // Now update the fields contents.
            data_update_record_fields_contents($database, $record, $context, $datarecord, $processeddata);
            $updated = true;
        }

        $result = array(
            'updated' => $updated,
            'generalnotifications' => $processeddata->generalnotifications,
            'fieldnotifications' => $fieldnotifications,
            'warnings' => $warnings,
        );
        return $result;
    }
466750
public function addEntryPoint(Entrypoint $e, $target = null)
    {
        $entryPoints = $this->getOption(self::OPTION_ENTRYPOINTS);
        $entryPoints[$e->getId()] = $e;
        $this->setOption(self::OPTION_ENTRYPOINTS, $entryPoints);

        if (!is_null($target)) {
            $this->activateEntryPoint($e->getId(), $target);
        }
    }
1277598
public function setTarget(string $target): void
    {
        $path = realpath($target);
        if (false === $path) {
            if (@mkdir($target, 0755, true)) {
                $path = realpath($target);
            } else {
                throw new InvalidArgumentException(
                    'Target directory (' . $target . ') does not exist and could not be created'
                );
            }
        }

        if (!is_dir($path) || !is_writable($path)) {
            throw new InvalidArgumentException('Given target (' . $target . ') is not a writable directory');
        }

        $this->target = $path;
    }
313347
public void createSubSitemap(final CmsUUID entryId) {

        CmsRpcAction<CmsSitemapChange> subSitemapAction = new CmsRpcAction<CmsSitemapChange>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                start(0, true);
                getService().createSubSitemap(entryId, this);
            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(CmsSitemapChange result) {

                stop(false);
                applyChange(result);
            }
        };
        subSitemapAction.execute();
    }
1340326
public void cancel(int entryId) {
        NotificationEntry entry = mCenter.getEntry(ID, entryId);
        if (entry != null) {
            cancel(entry);
        }
    }
915861
public function setEntrypoint(?array $entrypoint)
    {
        $this->entrypoint = $entrypoint;

        $this->raw = array_merge($this->raw, ['Entrypoint' => $entrypoint]);

        return $this;
    }
678146
private static function enforceValidTarget($target)
    {
        if (!is_string($target)) {
            throw new \InvalidArgumentException('Parameter $type must be a string.');
        }
        if (!isset(self::$map[ $target ])) {
            throw new \InvalidArgumentException("Type {$target} is invalid.");
        }
    }
299518
protected function get_entry($entryid) {
        global $DB;

        if (empty($this->entriesdata[$entryid])) {
            $this->entriesdata[$entryid] = $DB->get_record_sql("SELECT ge.*, g.course, g.defaultapproval FROM {glossary_entries} ge
                                                                  JOIN {glossary} g ON g.id = ge.glossaryid
                                                                WHERE ge.id = ?", array('id' => $entryid), MUST_EXIST);
        }
        return $this->entriesdata[$entryid];
    }
638253
protected function cacheViaTrait(string $entryIdentifier, callable $callback, string $cacheIdentifier, int $lifetime = 0, array $tags = [])
    {
        try {
            /** @var AbstractFrontend $cache */
            $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache($cacheIdentifier);
        } catch (\Exception $ex) {
            $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
            $logger->error($ex->getMessage(), ['entryIdentifier' => $entryIdentifier, 'cacheIdentifier' => $cacheIdentifier]);

            return \call_user_func_array($callback, []);
        }

        // Do not use "has" because the cache is a shared resource
        $result = $cache->get($entryIdentifier);
        if (false !== $result) {
            return $result;
        }
        $result = \call_user_func_array($callback, []);
        $cache->set($entryIdentifier, $result, $tags, 0 === $lifetime ? null : $lifetime);

        return $result;
    }
1350373
private function findTargetCompiler($target, $mode): CompilationTarget
    {
        /** @var CompilationTarget $targetCompiler */
        foreach ($this->compilationTargets as $targetCompiler) {
            if ($targetCompiler->supports($target, $mode)) {
                return $targetCompiler;
            }
        }

        throw new TargetUnsupportedException('The given target is not supported.');
    }
208337
public function requireOnce(string $entryIdentifier)
    {
        $pathAndFilename = $this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension;
        if ($entryIdentifier !== basename($entryIdentifier)) {
            throw new \InvalidArgumentException('The specified entry identifier (' . $entryIdentifier . ') must not contain a path segment.', 1282073036);
        }

        if (is_file($pathAndFilename)) {
            return include_once($pathAndFilename);
        }
        return false;
    }
510535
public function canExtract($source, $target, ExtractionContextInterface $extractionContext)
    {
        if (!$target instanceof SupportedTarget) {
            return false;
        }

        if (is_null(self::getPrimitiveType($source))) {
            return false;
        }

        return true;
    }
1051280
private function throwExceptionsOnBadTarget( $target ) {
		if( !$target instanceof EntityId && !$target instanceof Item && !$target instanceof Property && ! $target instanceof SiteLink ) {
			throw new UnexpectedValueException( '$target needs to be an EntityId, Item, Property or SiteLink' );
		}
		if( ( $target instanceof Item || $target instanceof Property ) && is_null( $target->getId() ) ) {
			throw new UnexpectedValueException( '$target Entity object needs to have an Id set' );
		}
	}
247482
protected function setStatus(
            string $entryId,
            EntryInterface $entry,
            $response
    ) {
        if ($response === false) {
            $this->monitor->setStatus($entryId, false);
        } else {
            $this->monitor->setStatus($entryId, $entry::succeeded($response));
        }
    }
1023729
function setTarget($target = null, $preserveHost = true)
    {
        $target = (string) $target;
        if (empty($target) && $target !== "0")
            $target = '/';
        
        // validate uri
        if (parse_url($target) === false)
        {
            $target = rawurlencode($target);

            /*
            throw new \InvalidArgumentException(sprintf(
                'Malformed URI: (%s).'
                , $target
            ));
            */
        }

        
        $this->target_uri = (string) $target;
        return $this;
    }