class Export

PhpMyAdmin\Export class

Methods

__construct(DatabaseInterface $dbi)

Export constructor.

void
shutdown()

Sets a session variable upon a possible fatal error during export

bool
isGzHandlerEnabled()

Detect ob_gzhandler

bool
gzencodeNeeded()

Detect whether gzencode is needed; it might not be needed if the server is already compressing by itself

bool
outputHandler(string|null $line)

Output handler for all exports, if needed buffering, it stores data into $dump_buffer, otherwise it prints them out.

string
getHtmlForDisplayedExportFooter(string $back_button, string $refreshButton)

Returns HTML containing the footer for a displayed export

int
getMemoryLimit()

Computes the memory limit for export

array
getFilenameAndMimetype(string $export_type, string $remember_template, ExportPlugin $export_plugin, string $compression, string $filename_template)

Return the filename and MIME type for export file

array
openFile(string $filename, bool $quick_export)

Open the export file

closeFile(resource $file_handle, string $dump_buffer, string $save_filename)

Close the export file

array|string|bool
compress(array|string $dump_buffer, string $compression, string $filename)

Compress the export buffer

void
saveObjectInBuffer(string $object_name, bool $append = false)

Saves the dump_buffer for a particular table in an array Used in separate files export

array
getHtmlForDisplayedExportHeader(string $export_type, string $db, string $table)

Returns HTML containing the header for a displayed export

void
exportServer(string|array $db_select, string $whatStrucOrData, ExportPlugin $export_plugin, string $crlf, string $err_url, string $export_type, bool $do_relation, bool $do_comments, bool $do_mime, bool $do_dates, array $aliases, string $separate_files)

Export at the server level

void
exportDatabase(string $db, array $tables, string $whatStrucOrData, array $table_structure, array $table_data, ExportPlugin $export_plugin, string $crlf, string $err_url, string $export_type, bool $do_relation, bool $do_comments, bool $do_mime, bool $do_dates, array $aliases, string $separate_files)

Export at the database level

void
exportTable(string $db, string $table, string $whatStrucOrData, ExportPlugin $export_plugin, string $crlf, string $err_url, string $export_type, bool $do_relation, bool $do_comments, bool $do_mime, bool $do_dates, string|null $allrows, string $limit_to, string $limit_from, string $sql_query, array $aliases)

Export at the table level

void
showPage(string $db, string $table, string $export_type)

Loads correct page after doing export

array
mergeAliases(array $aliases1, array $aliases2)

Merge two alias arrays, if array1 and array2 have conflicting alias then array2 value is used if it is non empty otherwise array1 value.

mixed
lockTables(string $db, array $tables, string $lockType = "WRITE")

Locks tables

mixed
unlockTables()

Releases table locks

array
getMetadataTypes()

Returns all the metadata types that can be exported with a database or a table

string
getCheckedClause(string $key, array $array)

Returns the checked clause, depending on the presence of key in array

void
processExportSchema(string|null $export_type)

get all the export options and verify call and include the appropriate Schema Class depending on $export_type

Details

at line 30
__construct(DatabaseInterface $dbi)

Export constructor.

Parameters

DatabaseInterface $dbi DatabaseInterface instance

at line 40
void shutdown()

Sets a session variable upon a possible fatal error during export

Return Value

void

at line 54
bool isGzHandlerEnabled()

Detect ob_gzhandler

Return Value

bool

at line 65
bool gzencodeNeeded()

Detect whether gzencode is needed; it might not be needed if the server is already compressing by itself

Return Value

bool Whether gzencode is needed

at line 92
bool outputHandler(string|null $line)

Output handler for all exports, if needed buffering, it stores data into $dump_buffer, otherwise it prints them out.

Parameters

string|null $line the insert statement

Return Value

bool Whether output succeeded

at line 199
string getHtmlForDisplayedExportFooter(string $back_button, string $refreshButton)

Returns HTML containing the footer for a displayed export

Parameters

string $back_button the link for going Back
string $refreshButton the link for refreshing page

Return Value

string the HTML output

at line 228
int getMemoryLimit()

Computes the memory limit for export

Return Value

int the memory limit

at line 269
array getFilenameAndMimetype(string $export_type, string $remember_template, ExportPlugin $export_plugin, string $compression, string $filename_template)

Return the filename and MIME type for export file

Parameters

string $export_type type of export
string $remember_template whether to remember template
ExportPlugin $export_plugin the export plugin
string $compression compression asked
string $filename_template the filename template

Return Value

array the filename template and mime type

at line 346
array openFile(string $filename, bool $quick_export)

Open the export file

Parameters

string $filename the export filename
bool $quick_export whether it's a quick export or not

Return Value

array the full save filename, possible message and the file handle

at line 404
Message closeFile(resource $file_handle, string $dump_buffer, string $save_filename)

Close the export file

Parameters

resource $file_handle the export file handle
string $dump_buffer the current dump buffer
string $save_filename the export filename

Return Value

Message a message object (or empty string)

at line 440
array|string|bool compress(array|string $dump_buffer, string $compression, string $filename)

Compress the export buffer

Parameters

array|string $dump_buffer the current dump buffer
string $compression the compression mode
string $filename the filename

Return Value

array|string|bool

at line 462
void saveObjectInBuffer(string $object_name, bool $append = false)

Saves the dump_buffer for a particular table in an array Used in separate files export

Parameters

string $object_name the name of current object to be stored
bool $append optional boolean to append to an existing index or not

Return Value

void

at line 488
array getHtmlForDisplayedExportHeader(string $export_type, string $db, string $table)

Returns HTML containing the header for a displayed export

Parameters

string $export_type the export type
string $db the database name
string $table the table name

Return Value

array the generated HTML and back button

at line 576
void exportServer(string|array $db_select, string $whatStrucOrData, ExportPlugin $export_plugin, string $crlf, string $err_url, string $export_type, bool $do_relation, bool $do_comments, bool $do_mime, bool $do_dates, array $aliases, string $separate_files)

Export at the server level

Parameters

string|array $db_select the selected databases to export
string $whatStrucOrData structure or data or both
ExportPlugin $export_plugin the selected export plugin
string $crlf end of line character(s)
string $err_url the URL in case of error
string $export_type the export type
bool $do_relation whether to export relation info
bool $do_comments whether to add comments
bool $do_mime whether to add MIME info
bool $do_dates whether to add dates
array $aliases alias information for db/table/column
string $separate_files whether it is a separate-files export

Return Value

void

at line 645
void exportDatabase(string $db, array $tables, string $whatStrucOrData, array $table_structure, array $table_data, ExportPlugin $export_plugin, string $crlf, string $err_url, string $export_type, bool $do_relation, bool $do_comments, bool $do_mime, bool $do_dates, array $aliases, string $separate_files)

Export at the database level

Parameters

string $db the database to export
array $tables the tables to export
string $whatStrucOrData structure or data or both
array $table_structure whether to export structure for each table
array $table_data whether to export data for each table
ExportPlugin $export_plugin the selected export plugin
string $crlf end of line character(s)
string $err_url the URL in case of error
string $export_type the export type
bool $do_relation whether to export relation info
bool $do_comments whether to add comments
bool $do_mime whether to add MIME info
bool $do_dates whether to add dates
array $aliases Alias information for db/table/column
string $separate_files whether it is a separate-files export

Return Value

void

at line 897
void exportTable(string $db, string $table, string $whatStrucOrData, ExportPlugin $export_plugin, string $crlf, string $err_url, string $export_type, bool $do_relation, bool $do_comments, bool $do_mime, bool $do_dates, string|null $allrows, string $limit_to, string $limit_from, string $sql_query, array $aliases)

Export at the table level

Parameters

string $db the database to export
string $table the table to export
string $whatStrucOrData structure or data or both
ExportPlugin $export_plugin the selected export plugin
string $crlf end of line character(s)
string $err_url the URL in case of error
string $export_type the export type
bool $do_relation whether to export relation info
bool $do_comments whether to add comments
bool $do_mime whether to add MIME info
bool $do_dates whether to add dates
string|null $allrows whether "dump all rows" was ticked
string $limit_to upper limit
string $limit_from starting limit
string $sql_query query for which exporting is requested
array $aliases Alias information for db/table/column

Return Value

void

at line 1049
void showPage(string $db, string $table, string $export_type)

Loads correct page after doing export

Parameters

string $db the database name
string $table the table name
string $export_type Export type

Return Value

void

at line 1075
array mergeAliases(array $aliases1, array $aliases2)

Merge two alias arrays, if array1 and array2 have conflicting alias then array2 value is used if it is non empty otherwise array1 value.

Parameters

array $aliases1 first array of aliases
array $aliases2 second array of aliases

Return Value

array resultant merged aliases info

at line 1128
mixed lockTables(string $db, array $tables, string $lockType = "WRITE")

Locks tables

Parameters

string $db database name
array $tables list of table names
string $lockType lock type; "[LOW_PRIORITY] WRITE" or "READ [LOCAL]"

Return Value

mixed result of the query

at line 1145
mixed unlockTables()

Releases table locks

Return Value

mixed result of the query

at line 1155
array getMetadataTypes()

Returns all the metadata types that can be exported with a database or a table

Return Value

array metadata types.

at line 1179
string getCheckedClause(string $key, array $array)

Returns the checked clause, depending on the presence of key in array

Parameters

string $key the key to look for
array $array array to verify

Return Value

string the checked clause

at line 1196
void processExportSchema(string|null $export_type)

get all the export options and verify call and include the appropriate Schema Class depending on $export_type

Parameters

string|null $export_type format of the export

Return Value

void