62 public function addContent(
string $code, $content, $type =
false): bool
67 if (is_null($content))
79 $subFolder = $folder->getChild(
82 '=TYPE' => FolderTable::TYPE_FOLDER,
87 $folder = $folder->addSubFolder(
90 'CREATED_BY' => SystemUser::SYSTEM_USER_ID,
102 $file = $folder->uploadFile(
105 'content' => $content,
106 'type' =>
'application/json',
110 'CREATED_BY' => SystemUser::SYSTEM_USER_ID,
131 public function get(
string $path,
int $step): ?array
137 $folder = $folder->getChild(
146 $fakeSecurityContext = Driver::getInstance()->getFakeSecurityContext();
147 $fileList = $folder->getChildren(
148 $fakeSecurityContext,
151 '=TYPE' => ObjectTable::TYPE_FILE,
156 foreach ($fileList as $child)
158 if ($i == $step && $child instanceof \
Bitrix\Disk\
File)
161 $documentRoot = $server->getDocumentRoot();
162 $filePath = $documentRoot . \CFile::GetPath(
165 $file =
new File($filePath);
169 'DATA' => $file->getContents(),
170 'FILE_NAME' => $child->getName(),
182 $result[
'COUNT'] = count($fileList);
209 $folder = $storage->addFolder(
212 'CREATED_BY' => SystemUser::SYSTEM_USER_ID,
217 $subFolder = $folder->getChild(
220 '=TYPE' => FolderTable::TYPE_FOLDER,
225 $subFolder = $folder->addSubFolder(
228 'CREATED_BY' => SystemUser::SYSTEM_USER_ID,
235 foreach ($files as $file)
239 $id = (int) $file[
'ID'];
240 $structure->saveFile($id, $file);
242 $fileData = \CFile::MakeFileArray($id);
243 $res = $subFolder->uploadFile(
247 'CREATED_BY' => SystemUser::SYSTEM_USER_ID,
252 $result[
'success'] =
true;
253 $result[
'result'][$id] =
true;
257 $result[
'result'][$id] =
false;