1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
albumsdelete.php
См. документацию.
1<?php
2
3namespace Bitrix\Sale\TradingPlatform\Vk\Feed\Data\Processors;
4
5use Bitrix\Sale\TradingPlatform\Vk;
6use Bitrix\Sale\TradingPlatform\Timer;
7use Bitrix\Sale\TradingPlatform\TimeIsOverException;
8
14{
21 public function process($data = NULL, Timer $timer = NULL)
22 {
23 $apiHelper = new Vk\Api\ApiHelper($this->exportId);
24 $albumsFromVk = $apiHelper->getALbumsFromVk($this->vkGroupId);
25 $albumsMapped = Vk\Map::getMappedAlbums($this->exportId);
26// remove from mapping albums which not exist in VK
27 $albumsMappedToRemove = array();
28 foreach ($albumsMapped as $key => $albumMapped)
29 {
30 if (!isset($albumsFromVk[$albumMapped["ALBUM_VK_ID"]]))
31 {
32 $albumsMappedToRemove[] = array("VALUE_EXTERNAL" => $albumMapped["ALBUM_VK_ID"]);
33 unset($albumsMapped[$key]);
34 }
35 }
36// remove not exists in VK items
37 if (!empty($albumsMappedToRemove))
38 Vk\Map::removeAlbumMapping($albumsMappedToRemove, $this->exportId);
39
40// In delete procedure we not need http file upload.
41// It means that we can not limit max items by settings and using max possible count.
42 $albumsMapped = array_chunk($albumsMapped, Vk\Vk::MAX_EXECUTION_ITEMS); // max 25 items in execute()
43 foreach ($albumsMapped as $chunk)
44 {
45 $resDelete = $this->executer->executeMarketAlbumDelete(array(
46 "owner_id" => $this->vkGroupId,
47 "data" => $chunk,
48 "count" => count($chunk),
49 ));
50
51 foreach ($resDelete as $res)
52 {
53 if ($res["flag_album_delete_result"])
54 $albumsMappedToRemove[] = array("VALUE_EXTERNAL" => $res["ALBUM_VK_ID"]);
55 }
56
57// remove success deleted items
58 if (!empty($albumsMappedToRemove))
59 Vk\Map::removeAlbumMapping($albumsMappedToRemove, $this->exportId);
60
61// abstract start position - only for continue export, not for rewind to position
62 if ($timer !== NULL && !$timer->check())
63 throw new TimeIsOverException("Timelimit for export is over", '1');
64 }
65
66// remove products from cache
67 $vkExportedData = new Vk\VkExportedData($this->exportId, 'PRODUCTS');
68 $vkExportedData->removeData();
69
70 return true;
71 }
72
73
74}
process($data=NULL, Timer $timer=NULL)
Определения albumsdelete.php:21
static removeAlbumMapping($values, $exportId, $flagKeys='')
Определения map.php:133
static getMappedAlbums($exportId)
Определения map.php:368
const MAX_EXECUTION_ITEMS
Определения vk.php:33
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
if(empty($signedUserToken)) $key
Определения quickway.php:257
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936