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/sale/lib/ |
Upload File : |
<?php /** * Bitrix Framework * @package bitrix * @subpackage sale * @copyright 2001-2014 Bitrix */ namespace Bitrix\Sale; use Bitrix\Main\Entity, Bitrix\Main\Application; class SiteCurrencyTable extends Entity\DataManager { public static function getFilePath() { return __FILE__; } public static function getTableName() { return 'b_sale_lang'; } public static function getMap() { return array( 'LID' => array( 'data_type' => 'string', 'primary' => true, 'format' => '/^[A-Za-z0-9_]{2}$/' ), 'CURRENCY' => array( 'data_type' => 'string', 'format' => '/^[A-Z]{3}$/' ) ); } private static $cache = array(); /** * @param string $siteId - LID * @return array - LID, CURRENCY */ public static function getCurrency($siteId) { if (! self::$cache) { $managed = Application::getInstance()->getManagedCache(); $key = self::getTableName(); if ($managed->read(3600, $key)) self::$cache = $managed->get($key); else { $result = self::getList(array( 'select' => array('*') )); while ($row = $result->fetch()) self::$cache[$row['LID']] = $row; $managed->set($key, self::$cache); } } return self::$cache[$siteId]; } public static function onAfterAdd(Entity\Event $event) { Application::getInstance()->getManagedCache()->clean(self::getTableName()); self::$cache = array(); } public static function onAfterUpdate(Entity\Event $event) { Application::getInstance()->getManagedCache()->clean(self::getTableName()); self::$cache = array(); } public static function onAfterDelete(Entity\Event $event) { Application::getInstance()->getManagedCache()->clean(self::getTableName()); self::$cache = array(); } }