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/rospirotorg.ru/bitrix/modules/iblock/lib/inheritedproperty/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/iblock/lib/inheritedproperty/valuesqueue.php
<?php
/**
 * Bitrix Framework
 * @package bitrix
 * @subpackage iblock
 */
namespace Bitrix\Iblock\InheritedProperty;

class ValuesQueue
{
	/** var array[intger][integer]false|array */
	protected $db_values = array();

	/** @var array[string]ValuesQueue */
	protected static $queues = array();

	/**
	 * Returns a queue instance by the key provided.
	 * Creates new instance if first time called for the given key.
	 *
	 * @param string $key Queue identifier.
	 *
	 * @return ValuesQueue
	 */
	public static function getInstance($key)
	{
		if (!isset(self::$queues[$key]))
			self::$queues[$key] = new ValuesQueue();
		return self::$queues[$key];
	}

	/**
	 * Clears all the queues.
	 *
	 * @return void
	 */
	public static function deleteAll()
	{
		foreach (self::$queues as $queue)
		{
			$queue->db_values = array();
		}
	}

	/**
	 * Returns the queue elements for the given iblock
	 * which were not queried from the database.
	 *
	 * @param integer $iblockId Iblock identifier.
	 *
	 * @return array[integer]integer
	 */
	public function get($iblockId)
	{
		$ids = array();
		foreach ($this->db_values[$iblockId] as $id => $loaded)
		{
			if ($loaded === false)
				$ids[$id] = intval($id);
		}
		return $ids;
	}

	/**
	 * Stores the values for queue elements for future reference.
	 * Missing elements are assigned empty arrays.
	 *
	 * @param integer $iblockId Iblock identifier.
	 * @param array[integer]array $values Values from the database.
	 *
	 * @return void
	 */
	public function set($iblockId, $values)
	{
		foreach ($this->db_values[$iblockId] as $id => $loaded)
		{
			if (isset($values[$id]))
				$this->db_values[$iblockId][$id] = $values[$id];
			else
				$this->db_values[$iblockId][$id] = array();
		}
	}

	/**
	 * Puts an element into the queue.
	 *
	 * @param integer $iblockId Iblock identifier.
	 * @param integer $id Element identifier.
	 *
	 * @return void
	 */
	public function addElement($iblockId, $id)
	{
		if (!isset($this->db_values[$iblockId]))
		{
			$this->db_values[$iblockId] = array();
		}

		if (!isset($this->db_values[$iblockId][$id]))
		{
			$this->db_values[$iblockId][$id] = false;
		}
	}

	/**
	 * Removes an element from the queue.
	 *
	 * @param integer $iblockId Iblock identifier.
	 * @param integer $id Element identifier.
	 *
	 * @return void
	 */
	public function deleteElement($iblockId, $id)
	{
		unset($this->db_values[$iblockId][$id]);
	}

	/**
	 * Returns data of the element from the queue.
	 * False when element was not queried from the database.
	 * And null when element was not queued.
	 *
	 * @param integer $iblockId Iblock identifier.
	 * @param integer $id Element identifier.
	 *
	 * @return false|null|array
	 */
	public function getElement($iblockId, $id)
	{
		return $this->db_values[$iblockId][$id];
	}

	/**
	 * Stores the data for the element in the queue.
	 * Rewrites any existing value.
	 *
	 * @param integer $iblockId Iblock identifier.
	 * @param integer $id Element identifier.
	 * @param array   $value A Value to be stored.
	 *
	 * @return void
	 */
	public function setElement($iblockId, $id, $value)
	{
		$this->db_values[$iblockId][$id] = $value;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit