Zip writer wrapper.
More...
|
| __construct (\ZipStream\ZipStream $archive, stdClass $options=null) |
| zipwriter constructor.
|
|
| add_file_from_stored_file (context $context, string $filepathinzip, stored_file $file) |
| Add a file from the File Storage API.
|
|
| add_file_from_string (context $context, string $filepathinzip, string $content) |
| Add a file from string content.
|
|
| add_file_from_template (context $context, string $filepathinzip, string $template, stdClass $templatedata) |
| Create a file based on a Mustache Template and associated data.
|
|
| add_pluginfiles_for_content (context $context, string $subdir, string $content, string $component, string $filearea, int $fileitemid, ?int $pluginfileitemid) |
| Export files releating to this text area.
|
|
| finish () |
| Finish writing the zip footer.
|
|
| get_context_path (context $context, string $filepathinzip) |
| Get the full path to the context within the zip.
|
|
| get_file_path () |
| Get the file path for a file-based zip writer.
|
|
| get_relative_context_path (context $rootcontext, context $targetcontext, string $filepathinzip) |
| Get a relative path to the specified context path.
|
|
| is_file_in_archive (context $context, string $filepathinzip) |
| Check whether the file was actually added to the archive.
|
|
| set_root_context (context $rootcontext) |
| Set a root context for use during the export.
|
|
|
static | get_file_writer (string $filename, stdClass $exportoptions=null) |
| Get the file writer.
|
|
static | get_stream_writer (string $filename, stdClass $exportoptions=null) |
| Get the stream writer.
|
|
|
int const | MAX_CONTEXT_NAME_LENGTH = 32 |
| Maximum folder length name for a context.
|
|
|
ZipStream ZipStream | $archive |
|
stdClass | $course |
| The course relating to the root context.
|
|
context | $coursecontext |
| The context of the course for the root contect.
|
|
array | $filesinzip = [] |
| The files in the zip.
|
|
int | $maxfilesize = 1 * 1024 * 1024 * 10 |
| Max file size of an individual file in the archive.
|
|
bool | $pagerequirementsadded = false |
| Whether page requirements needed for HTML pages have been added.
|
|
context | $rootcontext = null |
| The context to use as a base for export.
|
|
resource | $zipfilehandle = null |
| File resource for the file handle for a file-based zip stream.
|
|
string | $zipfilepath = null |
| File path for a file-based zip stream.
|
|
◆ __construct()
core\content\export\zipwriter::__construct |
( |
\ZipStream\ZipStream | $archive, |
|
|
stdClass | $options = null ) |
zipwriter constructor.
- Parameters
-
◆ add_content_from_dirroot()
core\content\export\zipwriter::add_content_from_dirroot |
( |
string | $dirrootpath, |
|
|
string | $pathinzip ) |
|
protected |
Add content from the dirroot into the specified path in the zip file.
- Parameters
-
string | $dirrootpath | |
string | $pathinzip | |
◆ add_file_from_stored_file()
core\content\export\zipwriter::add_file_from_stored_file |
( |
context | $context, |
|
|
string | $filepathinzip, |
|
|
stored_file | $file ) |
Add a file from the File Storage API.
- Parameters
-
context | $context | |
string | $filepathinzip | |
stored_file | $file | The file to add |
◆ add_file_from_string()
core\content\export\zipwriter::add_file_from_string |
( |
context | $context, |
|
|
string | $filepathinzip, |
|
|
string | $content ) |
Add a file from string content.
- Parameters
-
context | $context | |
string | $filepathinzip | |
string | $content | |
◆ add_file_from_template()
core\content\export\zipwriter::add_file_from_template |
( |
context | $context, |
|
|
string | $filepathinzip, |
|
|
string | $template, |
|
|
stdClass | $templatedata ) |
Create a file based on a Mustache Template and associated data.
- Parameters
-
context | $context | |
string | $filepathinzip | |
string | $template | |
stdClass | $templatedata | |
◆ add_pluginfiles_for_content()
core\content\export\zipwriter::add_pluginfiles_for_content |
( |
context | $context, |
|
|
string | $subdir, |
|
|
string | $content, |
|
|
string | $component, |
|
|
string | $filearea, |
|
|
int | $fileitemid, |
|
|
?int | $pluginfileitemid ) |
Export files releating to this text area.
- Parameters
-
context | $context | |
string | $subdir | The sub directory to export any files to |
string | $content | |
string | $component | |
string | $filearea | |
int | $fileitemid | The itemid as used in the Files API |
null | int | $pluginfileitemid | The itemid to use in the pluginfile URL when composing any required URLs |
- Return values
-
◆ add_template_requirements()
core\content\export\zipwriter::add_template_requirements |
( |
| ) |
|
|
protected |
Ensure that all requirements for a templated page are present.
This includes CSS, and any other similar content.
◆ get_context_folder_name()
core\content\export\zipwriter::get_context_folder_name |
( |
context | $context | ) |
|
|
protected |
Get the name of the folder for the specified context.
- Parameters
-
- Return values
-
◆ get_context_path()
core\content\export\zipwriter::get_context_path |
( |
context | $context, |
|
|
string | $filepathinzip ) |
Get the full path to the context within the zip.
- Parameters
-
context | $context | |
string | $filepathinzip | |
- Return values
-
◆ get_course()
core\content\export\zipwriter::get_course |
( |
| ) |
|
|
protected |
Get the course object for the root context.
- Return values
-
◆ get_file_path()
core\content\export\zipwriter::get_file_path |
( |
| ) |
|
Get the file path for a file-based zip writer.
If this is not a file-based writer then no value is returned.
- Return values
-
◆ get_file_writer()
static core\content\export\zipwriter::get_file_writer |
( |
string | $filename, |
|
|
stdClass | $exportoptions = null ) |
|
static |
Get the file writer.
- Parameters
-
string | $filename | |
stdClass | null | $exportoptions | |
- Return values
-
◆ get_filepath_for_file()
static core\content\export\zipwriter::get_filepath_for_file |
( |
stored_file | $file, |
|
|
string | $parentdir, |
|
|
bool | $escape ) |
|
staticprotected |
Get the filepath for the specified stored_file.
- Parameters
-
stored_file | $file | |
string | $parentdir | Any parent directory to place this file in |
bool | $escape | |
- Return values
-
◆ get_relative_context_path()
core\content\export\zipwriter::get_relative_context_path |
( |
context | $rootcontext, |
|
|
context | $targetcontext, |
|
|
string | $filepathinzip ) |
Get a relative path to the specified context path.
- Parameters
-
context | $rootcontext | |
context | $targetcontext | |
string | $filepathinzip | |
- Return values
-
◆ get_stream_writer()
static core\content\export\zipwriter::get_stream_writer |
( |
string | $filename, |
|
|
stdClass | $exportoptions = null ) |
|
static |
Get the stream writer.
- Parameters
-
string | $filename | |
stdClass | null | $exportoptions | |
- Return values
-
◆ is_file_in_archive()
core\content\export\zipwriter::is_file_in_archive |
( |
context | $context, |
|
|
string | $filepathinzip ) |
Check whether the file was actually added to the archive.
- Parameters
-
context | $context | |
string | $filepathinzip | |
- Return values
-
◆ parse_options()
core\content\export\zipwriter::parse_options |
( |
stdClass | $options | ) |
|
|
protected |
Parse options.
- Parameters
-
◆ rewrite_other_pluginfile_urls()
core\content\export\zipwriter::rewrite_other_pluginfile_urls |
( |
context | $context, |
|
|
string | $content, |
|
|
string | $component, |
|
|
string | $filearea, |
|
|
?int | $pluginfileitemid ) |
|
protected |
Rewrite any pluginfile URLs in the content.
- Parameters
-
context | $context | |
string | $content | |
string | $component | |
string | $filearea | |
null | int | $pluginfileitemid | The itemid to use in the pluginfile URL when composing any required URLs |
- Return values
-
◆ set_root_context()
core\content\export\zipwriter::set_root_context |
( |
context | $rootcontext | ) |
|
Set a root context for use during the export.
This is primarily used for creating paths within the archive relative to the root context.
- Parameters
-
The documentation for this class was generated from the following file:
- lib/classes/content/export/zipwriter.php