Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:start:filestore [2016/07/07 14:15] admin created |
en:start:filestore [2016/07/07 14:17] (current) admin [Разработчикам] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Хранилище файлов ===== | + | ===== Filestore ===== |
- | Начиная с версии 600.0801 реализована функция временного хранилища файлов. Вам больше не нужно сохранять файл в модуле Документы, если он нужен только для одной задачи. | + | Starting with version 600.0801 I implement a temporarily filestore, which could used by the actions to store files for later usage, without make use of the VtigerCRM integrated Documents/Attachments and waste a CRMID for a file, you need for only one task. |
- | Файлы хранятся в Локальных переменных выполняемого экземпляра Бизнес-Процесса. Это значит, что все временные файлы будут удалены после завершения Бизнес-Процесса. | + | The filestore is stored in an Environmental Variable or current execution. |
+ | This means, all files of one execution will be removed, after the complete workflow is finished. | ||
- | Хранилище файлов работает по принципу ассоциативного массива. Каждый файл имеет свой ID в хранилище файлов. Например, можно создать файл и сохранить его в хранилище с ID “file_xyz”. | + | The filestore works like a key-value storage. Every file will have a FileStore ID, which must used to reference the file. |
+ | For example one action will create a file and store this in the filestore with the ID “file_xyz”. | ||
- | Любая Задача во время текущего выполнения, если она поддерживает чтение файлов из хранилища, может открыть файл с ID “file_xyz”. | + | Every task in the same execution, which support filestore Input, could open the file with the ID “file_xyz”. |
- | ==== Разработчикам ==== | + | ==== Developers ==== |
- | Если вы хотите использовать хранилище файлов в собственных Задачах, используйте следующий интерфейс класса \Workflow\VTEntity, доступный | + | If you want to use the filestore in your own actions, use the following interface of the \Workflow\VTEntity class, given to the action in $context. \\ |
- | через переменную $context. \\ | + | |
- | Чтобы сохранить файл в хранилище файлов: | + | **To store a file inside the filestore:** |
<Code>$context->addTempFile($filepath, $filestoreid, $filename);</Code> | <Code>$context->addTempFile($filepath, $filestoreid, $filename);</Code> | ||
Line 23: | Line 24: | ||
<tr> | <tr> | ||
<td style="padding:5px;background-color:#D8D8D8;">$filepath</td> | <td style="padding:5px;background-color:#D8D8D8;">$filepath</td> | ||
- | <td style="padding:5px;">Строка</td> | + | <td style="padding:5px;">String</td> |
- | <td style="padding:5px;">Временный путь к файлу, который вы хотите поместить в хранилище. Этот файл будет перемещен в главную директорию временных файлов Дизайнера Бизнес-Процессов</td> | + | <td style="padding:5px;">The temporarily path to the file you create This file will be moved to the central tmp directory inside Workflow Designer</td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
<td style="padding:5px;background-color:#D8D8D8;">$filestoreid</td> | <td style="padding:5px;background-color:#D8D8D8;">$filestoreid</td> | ||
- | <td style="padding:5px;">Строка</td> | + | <td style="padding:5px;">String</td> |
- | <td style="padding:5px;">ID, который вы хотите использовать для идентификации файла</td> | + | <td style="padding:5px;">The ID you want to use, to store the File</td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
<td style="padding:5px;background-color:#D8D8D8;">$filename</td> | <td style="padding:5px;background-color:#D8D8D8;">$filename</td> | ||
- | <td style="padding:5px;">Строка</td> | + | <td style="padding:5px;">String</td> |
- | <td style="padding:5px;">Имя файла</td> | + | <td style="padding:5px;">The filename of this file. Could be used by tasks to use the correct filename</td> |
</tr> | </tr> | ||
</table> | </table> | ||
Line 48: | Line 49: | ||
<tr> | <tr> | ||
<td style="padding:5px;background-color:#D8D8D8;">$filestoreid</td> | <td style="padding:5px;background-color:#D8D8D8;">$filestoreid</td> | ||
- | <td style="padding:5px;">Строка</td> | + | <td style="padding:5px;">string</td> |
- | <td style="padding:5px;">ID файла, который вы хотите загрузить</td> | + | <td style="padding:5px;">The ID of the file you want to get</td> |
</tr> | </tr> | ||
</table> | </table> | ||
</html> | </html> | ||
- | Возвращает | + | Returns |
<Code> | <Code> | ||
array( | array( | ||
- | "path" => <абсолютный путь к файлу>, | + | "path" => <absolute path to the file>, |
- | "name" => <название файла, которое вы задали в функции addTempFile()> | + | "name" => <filename you set during addTempFile> |
) | ) | ||
</Code> | </Code> |