Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
account.php
1<?
2
4
6
7abstract class Account extends BaseApiObject
8{
9 const PROFILE_INFO_CACHE_TTL = 86400;
10
11 protected static $listRowMap = array(
12 'ID' => 'ID',
13 'NAME' => 'NAME',
14 );
15
21 public function getProfileCached()
22 {
23 $cache = Application::getInstance()->getManagedCache();
24
25 $cacheId = $this->getCacheId();
26 if ($cache->read(static::PROFILE_INFO_CACHE_TTL, $cacheId))
27 {
28 $profile = $cache->get($cacheId);
29 }
30 else
31 {
32 $profile = $this->getProfile();
33 $cache->set($cacheId, $profile);
34 }
35
36 if ($profile)
37 {
38 $authProvider = Service::getAuthAdapter(static::TYPE_CODE);
39 $authProvider->setService($this->service);
40 $profile['CLIENT_ID'] = $authProvider->getClientId();
41 }
42 return $profile;
43 }
44
50 public function clearCache()
51 {
52 $cacheId = $this->getCacheId();
53 $cache = Application::getInstance()->getManagedCache();
54 $cache->Clean($cacheId);
55 }
56
61 protected function getCacheId()
62 {
63 $cacheId = 'seo|account_profile|';
65 $cacheId .= $service ? $service::getEngineCode(static::TYPE_CODE) : static::TYPE_CODE;
66 if ($service instanceof \Bitrix\Seo\Retargeting\IMultiClientService)
67 {
68 $cacheId .= '|' . $service->getClientId();
69 }
70 return $cacheId;
71 }
72
76 abstract public function getList();
77
81 abstract public function getProfile();
82
83 public function getRegionsList()
84 {
85 return [];
86 }
87
88 public function checkNewAuthInfo(): bool
89 {
90 return false;
91 }
92}