Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
yandexdirectcampaign.php
1
<?php
2
3
namespace
Bitrix\Seo\Update
;
4
5
use
Bitrix\Main\Loader
;
6
use
Bitrix\Seo\Engine\YandexDirect
;
7
use
Bitrix\Seo\Engine\YandexDirectException
;
8
use
Bitrix\Seo\Service
;
9
10
class
YandexDirectCampaign
11
{
18
public
static
function
updateSettingsAgent
()
19
{
20
if
(Loader::includeModule(
'seo'
) && Loader::includeModule(
'socialservices'
))
21
{
22
$engine =
new
YandexDirect
();
23
if
(!
Service::isRegistered
())
24
{
25
return
;
26
}
27
28
$authInfo =
Service::getAuth
($engine->getCode());
29
if
(!is_array($authInfo) || empty($authInfo) || $authInfo[
'expires_in'
] <= time())
30
{
31
return
;
32
}
33
34
try
35
{
36
self::clearData
();
37
$engine->updateCampaignManual();
38
}
39
catch
(
YandexDirectException
$e)
40
{
41
}
42
}
43
}
44
45
protected
static
function
clearData
()
46
{
47
global $DB;
48
$DB->Query(
"TRUNCATE TABLE b_seo_adv_campaign"
);
49
$DB->Query(
"TRUNCATE TABLE b_seo_adv_banner"
);
50
$DB->Query(
"TRUNCATE TABLE b_seo_adv_group"
);
51
}
52
}
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Seo\Engine\YandexDirectException
Definition
yandexdirectexception.php:7
Bitrix\Seo\Engine\YandexDirect
Definition
yandexdirect.php:32
Bitrix\Seo\Service
Definition
service.php:33
Bitrix\Seo\Service\getAuth
static getAuth(string $engineCode)
Definition
service.php:72
Bitrix\Seo\Service\isRegistered
static isRegistered()
Definition
service.php:59
Bitrix\Seo\Update\YandexDirectCampaign
Definition
yandexdirectcampaign.php:11
Bitrix\Seo\Update\YandexDirectCampaign\clearData
static clearData()
Definition
yandexdirectcampaign.php:45
Bitrix\Seo\Update\YandexDirectCampaign\updateSettingsAgent
static updateSettingsAgent()
Definition
yandexdirectcampaign.php:18
Bitrix\Seo\Update
Definition
yandexdirectcampaign.php:3
modules
seo
lib
update
yandexdirectcampaign.php
Создано системой
1.10.0