1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
TaskSaveBlocksHistory.php
См. документацию.
1<?php
2declare(strict_types=1);
3
4namespace Bitrix\Landing\Copilot\Generation\Step;
5
6use Bitrix\Landing\Copilot\Generation\GenerationException;
7use Bitrix\Landing\History;
8use Bitrix\Landing\Rights;
9
11{
18 public function execute(): bool
19 {
20 parent::execute();
21
22 $contentsBefore = $this->generation->getData(TaskPresaveBlocksHistory::DATA_KEY);
23 if (
24 !is_array($contentsBefore)
25 || empty($contentsBefore)
26 )
27 {
28 return true;
29 }
30
32 $historyState = History::isActive();
33 History::activate();
34
35 if ($this->saveHistory($contentsBefore))
36 {
37 $this->generation->deleteData(TaskPresaveBlocksHistory::DATA_KEY);
38 }
39
41 if (!$historyState)
42 {
43 History::deactivate();
44 }
45
46 return true;
47 }
48
49 private function saveHistory(array $contentsBefore): bool
50 {
51 $landing = $this->siteData->getLandingInstance();
52 if (!$landing)
53 {
54 return false;
55 }
56
57 $history = new History($landing->getId(), History::ENTITY_TYPE_LANDING);
58
59 foreach ($contentsBefore as $blockId => $contentBefore)
60 {
61 $block = $landing->getBlockById($blockId);
62 if (!$block)
63 {
64 continue;
65 }
66
67 $history->push('UPDATE_CONTENT', [
68 'block' => $blockId,
69 'contentBefore' => $contentBefore,
70 'contentAfter' => $block->getContent(),
71 ]);
72 }
73
74 return true;
75 }
76}
static setGlobalOn()
Определения rights.php:116
static setGlobalOff()
Определения rights.php:107
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804