403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/yandex.market/lib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/yandex.market/lib/state.php
<?php

namespace Yandex\Market;

use Yandex\Market;

class State
{
	protected static $cache = [];

	public static function get($name, $default = null)
	{
		$stored = static::load($name);

		return $stored !== null ? $stored : $default;
	}

	public static function set($name, $value)
	{
		$value = (string)$value;
		$stored = static::load($name);

		if ((string)$stored === $value) { return; }

		if ($value === '')
		{
			$queryResult = Reference\StateTable::delete($name);
			$value = null;
		}
		else if ($stored === null)
		{
			$queryResult = Reference\StateTable::add([
				'NAME' => $name,
				'VALUE' => $value,
			]);
		}
		else
		{
			$queryResult = Reference\StateTable::update($name, [
				'VALUE' => $value,
			]);
		}

		Market\Result\Facade::handleException($queryResult);
		static::$cache[$name] = $value;
	}

	public static function remove($name)
	{
		static::set($name, null);
	}

	protected static function load($name)
	{
		if (isset(static::$cache[$name]))
		{
			$result = static::$cache[$name];
		}
		else if (!array_key_exists($name, static::$cache))
		{
			$result = static::query($name);
			static::$cache[$name] = $result;
		}
		else
		{
			$result = null;
		}

		return $result;
	}

	protected static function query($name)
	{
		$result = null;

		$query = Reference\StateTable::getList([
			'filter' => [ '=NAME' => $name ],
			'select' => [ 'VALUE' ],
		]);

		if ($row = $query->fetch())
		{
			$result = (string)$row['VALUE'];
		}

		return $result;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit