Store/replaced code of a specified ClassDomain.


@param string $domainName
@param string $data
@param bool $force : allows to define if overwrite file or not
@return bool|int
2900
public function storeDomainCode(string $domainName, string $data, bool $force = false)
    {
        $domainClassName = DomainActionNameGenerator::getDomainClassName($domainName);
        $domainClassCodeFullPath = $this->domainsPath . "/" . $domainClassName.".php";

        if (file_exists($domainClassCodeFullPath) && !$force) {
            return false;
        }

        return $this->store($domainClassCodeFullPath, $data);
    }
217390
public function getData($force = false)
    {
        if ($this->data === null || $force === true) {
            $route  = $this->getRoute();
            $action = $route->getAction();
            $method = false;

            $this->action($action);

            // Check for concrete method call
            if (method_exists($this, '__data'.ucfirst($action))) {
                // Concrete integration ...
                $method = '__data'.ucfirst($action);
            } elseif (method_exists($this, '__data')) {
                // custom generic overload solution
                $method = '__data';
            }

            // Call if method detected ...
            if ($method !== false) {
                $arguments = func_get_args();

                if (count($arguments) > 0) {
                    $result = call_user_func_array([$this, $method], $arguments);
                } else {
                    $result = call_user_func([$this, $method]);
                }

                if (true !== $result) {
                    throw new Doozr_Base_Model_Exception(
                        sprintf(
                            '%s() (if set) MUST return TRUE. %s() is set but it returned: "%s"',
                            $method,
                            $method,
                            var_export($result, true)
                        )
                    );
                }
            }
        }

        return $this->data;
    }
1264875
public function setDn($dn, $force = false)
    {
        if (($this->isHydrated) && (! $force)) {
            throw new \InvalidArgumentException('Dn cannot be updated manually');
        }
        $this->dn = $dn;
    }
658262
public function store($data, $domain)
	{
		$messages   = (array) $this->retrieve($domain);
		$messages[] = $data;

		$this->session->set($this->key($domain), $messages);
	}
541707
public static function createFromData(array $data)
    {
        if (!isset($data['method'])) {
            throw new DomainException(self::REQUIRED_METHOD);
        }

        switch ($data['method']) {
            case self::AUTO:
                $scheduleInstruction = new AutoType($data);

                break;
            case self::DATE_INTERVAL:
                $scheduleInstruction = new DateIntervalType($data);

                break;
            case self::DAY_OF_MONTH:
                $scheduleInstruction = new DayOfMonthType($data);

                break;
            case self::DAY_OF_WEEK:
                $scheduleInstruction = new DayOfWeekType($data);

                break;
            case self::IMMEDIATELY:
                $scheduleInstruction = new ImmediatelyType($data);

                break;
            case self::INTELLIGENT:
                $scheduleInstruction = new IntelligentType($data);

                break;
            default:
                throw new DomainException(
                    sprintf(self::UNSUPPORTED_METHOD, implode(',', self::$availableMethods))
                );
        }

        return $scheduleInstruction;
    }
680411
public function save($key, $data, $force = false, $ttl = 1440) {
        $ttl = $ttl * 60; // Minutes to Seconds
        // Store result from last query for checking if cache is existing
        // This will avoid locked database error for sqlite3
        $cache_exists = $this->exists($key);

        if (!$cache_exists || $force) {
            $key = $this->_encrypt($key);
            $this->_memcached->set($key, $data, $ttl);
            
            return true;
        }
        
        return false;
    }
536966
public function store($data, $domain)
	{
		$messages   = (array) $this->retrieve($domain);
		$messages[] = $data;

		Monster::bake($this->key($domain), $this->expires($this->lifetime), $messages);
	}
133546
public function addDomain($data)
    {
        if ($data instanceof Domain) {
            $domain = $data; // alias
            $domain->setDatabase($this);
            $this->domainMap[$domain->getName()] = $domain;

            return $domain;
        } else {
            $domain = new Domain();
            $domain->setDatabase($this);
            $domain->loadFromXML($data);

            return $this->addDomain($domain); // call self w/ different param
        }
    }
1281751
public function loadDomainCode(string $domainName)
    {
        $domainClassName = DomainActionNameGenerator::getDomainClassName($domainName);

        return $this->load($this->domainsPath . "/" . $domainClassName.".php");
    }
164844
private function fetchDomainId(string $domainName, string $recordName): ?int
    {
        if (!isset($this->domainRecords[$domainName])) {
            $this->domainRecords[$domainName] = $this->domainRecordApi->getAll($domainName);
        }

        foreach ($this->domainRecords[$domainName] as $domainRecord) {
            if ($recordName === $domainRecord->name && Record::TYPE_ADDRESS === $domainRecord->type) {
                return $domainRecord->id;
            }
        }

        return null;
    }
41397
private function isActionMethodAlreadyPresent(string $actionName, string $domainClassCode): bool
    {
        $functionPattern = '/public function[ \t\n\r]+' . $actionName . '[ \t\n\r]*\([ \t\r\n]*.*[ \t\r\n]*\)/';

        return preg_match($functionPattern, $domainClassCode) > 0 ? true : false;
    }
1041532
public function store( $id, $data, $attributes = array() )
    {
        $this->forceStoreRegistry = true;
        $storeResult = parent::store( $id, $data, $attributes );

        // Update clustered expiry timestamp
        $expiryTime = time() + $this->properties['options']['ttl'];
        $this->expiryHandler->setTimestamp( ezpRestRouter::ROUTE_CACHE_KEY, $expiryTime );

        return $storeResult;
    }
840910
public static function mapXDomainUser($domain_username, $domain, $uidNumber)
	{
		$db = \App::get('db');

		if (empty($domain))
		{
			return 0;
		}

		$query = 'SELECT domain_id FROM `#__xdomains` WHERE ' .
				 '#__xdomains.domain=' . $db->quote($domain);

		$db->setQuery($query);

		$result = $db->loadObject();

		if (empty($result))
		{
			$query = 'INSERT INTO `#__xdomains` (domain) VALUES (' . $db->quote($domain) . ')';

			$db->setQuery($query);

			$db->query();

			$domain_id = $db->insertid();
		}
		else
		{
			$domain_id = $result->domain_id;
		}

		$query = 'INSERT INTO `#__xdomain_users` (domain_id,domain_username,uidNumber) ' .
			' VALUES (' . $db->quote($domain_id) . ',' .
			$db->quote($domain_username) . ',' . $db->quote($uidNumber) . ')';

		$db->setQuery($query);

		if (!$db->query())
		{
			return false;
		}

		return true;
	}
1046034
public static function getConfigFromDomainClass($className) {
		$definition = ClassHelper::normalizeComponentConfig($className);
		/** @var Domain $domain */
		$domain = Yii::createObject($definition);
		$config = $domain->config();
		return $config;
	}
1165923
private void writeToFile(List<DomainControllerData> data, String domainName) throws IOException {
        if(domainName == null || data == null) {
            return;
        }

        if (conn == null) {
            init();
        }

        try {
            String key = S3Util.sanitize(domainName) + "/" + S3Util.sanitize(DC_FILE_NAME);
            byte[] buf = S3Util.domainControllerDataToByteBuffer(data);
            S3Object val = new S3Object(buf, null);
            if (usingPreSignedUrls()) {
                Map headers = new TreeMap();
                headers.put("x-amz-acl", Arrays.asList("public-read"));
                conn.put(pre_signed_put_url, val, headers).connection.getResponseMessage();
            } else {
                Map headers = new TreeMap();
                headers.put("Content-Type", Arrays.asList("text/plain"));
                conn.put(location, key, val, headers).connection.getResponseMessage();
            }
        }
        catch(Exception e) {
            throw HostControllerLogger.ROOT_LOGGER.cannotWriteToS3File(e.getLocalizedMessage());
        }
    }
311362
protected function getDataValue($data, $field)
    {
        if (!isset($this->dataNamesMap[$field]['get'])) {
            throw new \DomainException('Field have not mapping with Data instance (field: ' . $field . ')');
        }

        $method = $this->dataNamesMap[$field]['get'];

        return $data->{$method}();
    }
916652
function setDomain(domain) {
    checkIsObject('domain', domain);
    checkIsString('doamin.name', domain.name);
    //test domain, domain.name
    domainsMap = domainsMap.set(domain.name, domain);
}