1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
configuration.php
См. документацию.
1<?php
2
3namespace Bitrix\Rest\Controller;
4
5use Bitrix\Main\Engine\Controller;
6use Bitrix\Main\Engine\ActionFilter;
7use Bitrix\Main\Engine\Response\AjaxJson;
8use Bitrix\Main\Engine\Response\Zip;
9use Bitrix\Main\Engine\Response\Zip\Archive;
10use Bitrix\Main\Error;
11use Bitrix\Main\Errorable;
12use Bitrix\Main\ErrorCollection;
13use Bitrix\Main\Localization\Loc;
14use Bitrix\Main\Response;
15use Bitrix\Main\Web\HttpClient;
16use Bitrix\Main\Web\Json;
17use Bitrix\Main\Web\Uri;
18use Bitrix\Rest\Configuration\Helper;
19use Bitrix\Rest\Configuration\Setting;
20use Bitrix\Rest\Configuration\Structure;
21use Bitrix\Rest\Configuration\Manifest;
22
23Loc::loadLanguageFile(__FILE__);
24
25class Configuration extends Controller implements Errorable
26{
31 public function downloadAction()
32 {
33 if (Helper::getInstance()->enabledZipMod())
34 {
35 $postfix = $this->getRequest()->getQuery('postfix');
36 if (!empty($postfix))
37 {
38 $context = Helper::getInstance()->getContextUser($postfix);
39 $setting = new Setting($context);
40 $access = Manifest::checkAccess(Manifest::ACCESS_TYPE_EXPORT, $setting->get(Setting::MANIFEST_CODE));
41 if ($access['result'] === true)
42 {
43 $structure = new Structure($context);
44
45 $name = $structure->getArchiveName();
46 if(empty($name))
47 {
48 $name = Helper::DEFAULT_ARCHIVE_NAME;
49 }
50 $name .= '.' . Helper::DEFAULT_ARCHIVE_FILE_EXTENSIONS;
51
52 $archive = new Archive($name);
53
54 $files = [];
55 $fileList = $structure->getFileList();
56 $archiveEntryBuilder = new Zip\EntryBuilder();
57 if (is_array($fileList))
58 {
59 $folderName = Helper::STRUCTURE_FILES_NAME;
60 foreach ($fileList as $file)
61 {
62 $id = (int)$file['ID'];
63 $fileArray = \CFile::getFileArray($id);
64 if ($fileArray)
65 {
66 $entry = $archiveEntryBuilder->createFromFileArray($fileArray, $folderName . '/' . $id);
67 $files[$id] = array_merge(
68 [
69 'NAME' => $fileArray['ORIGINAL_NAME'],
70 ],
71 $file
72 );
73 $archive->addEntry($entry);
74 }
75 }
76 }
77
78 if ($files)
79 {
80 $structure->saveContent(false, Helper::STRUCTURE_FILES_NAME, $files);
81 }
82
83 $smallFilesList = $structure->listSmallFile();
84 if ($smallFilesList)
85 {
86 $structure->saveContent(false, Helper::STRUCTURE_SMALL_FILES_NAME, $smallFilesList);
87 }
88
89 $folderFiles = $structure->getConfigurationFileList();
90 foreach ($folderFiles as $file)
91 {
92 $entry = $archiveEntryBuilder->createFromFileId((int)$file['ID'], $file['NAME']);
93 if ($entry)
94 {
95 $archive->addEntry($entry);
96 }
97 }
98
99 return $archive;
100 }
101 }
102 }
103
104 return null;
105 }
106
107 public function getDefaultPreFilters()
108 {
109 return [
112 ];
113 }
114}
Определения entrybuilder.php:11
$context
Определения csv_new_setup.php:223
if(!is_array($deviceNotifyCodes)) $access
Определения options.php:174
$name
Определения menu_edit.php:35
$files
Определения mysql_to_pgsql.php:30