class Export (View source)

PhpMyAdmin\Export class

Properties

mixed $dumpBuffer
int $dumpBufferLength
array $dumpBufferObjects

Methods

__construct(DatabaseInterface $dbi)

No description

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 $this->dumpBuffer, otherwise it prints them out.

string
getHtmlForDisplayedExportFooter(string $backButton, string $refreshButton)

Returns HTML containing the footer for a displayed export

int
getMemoryLimit()

Computes the memory limit for export

array
getFinalFilenameAndMimetypeForFilename(ExportPlugin $exportPlugin, string $compression, string $filename)

Returns the filename and MIME type for a compression and an export plugin

array
getFilenameAndMimetype(string $exportType, string $rememberTemplate, ExportPlugin $exportPlugin, string $compression, string $filenameTemplate)

Return the filename and MIME type for export file

array
openFile(string $filename, bool $quickExport)

Open the export file

closeFile(resource $fileHandle, string $dumpBuffer, string $saveFilename)

Close the export file

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

Compress the export buffer

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

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

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

Returns HTML containing the header for a displayed export

void
exportServer(string|array $dbSelect, string $whatStrucOrData, ExportPlugin $exportPlugin, string $crlf, string $errorUrl, string $exportType, bool $doRelation, bool $doComments, bool $doMime, bool $doDates, array $aliases, string $separateFiles)

Export at the server level

void
exportDatabase(string $db, array $tables, string $whatStrucOrData, array $tableStructure, array $tableData, ExportPlugin $exportPlugin, string $crlf, string $errorUrl, string $exportType, bool $doRelation, bool $doComments, bool $doMime, bool $doDates, array $aliases, string $separateFiles)

Export at the database level

static void
exportRaw(string $whatStrucOrData, ExportPlugin $exportPlugin, string $crlf, string $errorUrl, string $sqlQuery, string $exportType)

Export a raw query

void
exportTable(string $db, string $table, string $whatStrucOrData, ExportPlugin $exportPlugin, string $crlf, string $errorUrl, string $exportType, bool $doRelation, bool $doComments, bool $doMime, bool $doDates, string|null $allrows, string $limitTo, string $limitFrom, string $sqlQuery, array $aliases)

Export at the table level

void
showPage(string $exportType)

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 $exportType)

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

Details

__construct(DatabaseInterface $dbi)

No description

Parameters

DatabaseInterface $dbi

DatabaseInterface instance

void shutdown()

Sets a session variable upon a possible fatal error during export

Return Value

void

bool isGzHandlerEnabled()

Detect ob_gzhandler

Return Value

bool

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

bool outputHandler(string|null $line)

Output handler for all exports, if needed buffering, it stores data into $this->dumpBuffer, otherwise it prints them out.

Parameters

string|null $line

the insert statement

Return Value

bool

Whether output succeeded

string getHtmlForDisplayedExportFooter(string $backButton, string $refreshButton)

Returns HTML containing the footer for a displayed export

Parameters

string $backButton

the link for going Back

string $refreshButton

the link for refreshing page

Return Value

string

the HTML output

int getMemoryLimit()

Computes the memory limit for export

Return Value

int

the memory limit

array getFinalFilenameAndMimetypeForFilename(ExportPlugin $exportPlugin, string $compression, string $filename)

Returns the filename and MIME type for a compression and an export plugin

Parameters

ExportPlugin $exportPlugin

the export plugin

string $compression

compression asked

string $filename

the filename

Return Value

array

the filename and mime type

array getFilenameAndMimetype(string $exportType, string $rememberTemplate, ExportPlugin $exportPlugin, string $compression, string $filenameTemplate)

Return the filename and MIME type for export file

Parameters

string $exportType

type of export

string $rememberTemplate

whether to remember template

ExportPlugin $exportPlugin

the export plugin

string $compression

compression asked

string $filenameTemplate

the filename template

Return Value

array

the filename template and mime type

array openFile(string $filename, bool $quickExport)

Open the export file

Parameters

string $filename

the export filename

bool $quickExport

whether it's a quick export or not

Return Value

array

the full save filename, possible message and the file handle

Message closeFile(resource $fileHandle, string $dumpBuffer, string $saveFilename)

Close the export file

Parameters

resource $fileHandle

the export file handle

string $dumpBuffer

the current dump buffer

string $saveFilename

the export filename

Return Value

Message

a message object (or empty string)

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

Compress the export buffer

Parameters

array|string $dumpBuffer

the current dump buffer

string $compression

the compression mode

string $filename

the filename

Return Value

array|string|bool

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

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

Parameters

string $objectName

the name of current object to be stored

bool $append

optional boolean to append to an existing index or not

Return Value

void

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

Returns HTML containing the header for a displayed export

Parameters

string $exportType

the export type

string $db

the database name

string $table

the table name

Return Value

array

the generated HTML and back button

void exportServer(string|array $dbSelect, string $whatStrucOrData, ExportPlugin $exportPlugin, string $crlf, string $errorUrl, string $exportType, bool $doRelation, bool $doComments, bool $doMime, bool $doDates, array $aliases, string $separateFiles)

Export at the server level

Parameters

string|array $dbSelect

the selected databases to export

string $whatStrucOrData

structure or data or both

ExportPlugin $exportPlugin

the selected export plugin

string $crlf

end of line character(s)

string $errorUrl

the URL in case of error

string $exportType

the export type

bool $doRelation

whether to export relation info

bool $doComments

whether to add comments

bool $doMime

whether to add MIME info

bool $doDates

whether to add dates

array $aliases

alias information for db/table/column

string $separateFiles

whether it is a separate-files export

Return Value

void

void exportDatabase(string $db, array $tables, string $whatStrucOrData, array $tableStructure, array $tableData, ExportPlugin $exportPlugin, string $crlf, string $errorUrl, string $exportType, bool $doRelation, bool $doComments, bool $doMime, bool $doDates, array $aliases, string $separateFiles)

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 $tableStructure

whether to export structure for each table

array $tableData

whether to export data for each table

ExportPlugin $exportPlugin

the selected export plugin

string $crlf

end of line character(s)

string $errorUrl

the URL in case of error

string $exportType

the export type

bool $doRelation

whether to export relation info

bool $doComments

whether to add comments

bool $doMime

whether to add MIME info

bool $doDates

whether to add dates

array $aliases

Alias information for db/table/column

string $separateFiles

whether it is a separate-files export

Return Value

void

static void exportRaw(string $whatStrucOrData, ExportPlugin $exportPlugin, string $crlf, string $errorUrl, string $sqlQuery, string $exportType)

Export a raw query

Parameters

string $whatStrucOrData

whether to export structure for each table or raw

ExportPlugin $exportPlugin

the selected export plugin

string $crlf

end of line character(s)

string $errorUrl

the URL in case of error

string $sqlQuery

the query to be executed

string $exportType

the export type

Return Value

void

void exportTable(string $db, string $table, string $whatStrucOrData, ExportPlugin $exportPlugin, string $crlf, string $errorUrl, string $exportType, bool $doRelation, bool $doComments, bool $doMime, bool $doDates, string|null $allrows, string $limitTo, string $limitFrom, string $sqlQuery, 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 $exportPlugin

the selected export plugin

string $crlf

end of line character(s)

string $errorUrl

the URL in case of error

string $exportType

the export type

bool $doRelation

whether to export relation info

bool $doComments

whether to add comments

bool $doMime

whether to add MIME info

bool $doDates

whether to add dates

string|null $allrows

whether "dump all rows" was ticked

string $limitTo

upper limit

string $limitFrom

starting limit

string $sqlQuery

query for which exporting is requested

array $aliases

Alias information for db/table/column

Return Value

void

void showPage(string $exportType)

Loads correct page after doing export

Parameters

string $exportType

Return Value

void

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

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

mixed unlockTables()

Releases table locks

Return Value

mixed

result of the query

array getMetadataTypes()

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

Return Value

array

metadata types.

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

void processExportSchema(string|null $exportType)

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

Parameters

string|null $exportType

format of the export

Return Value

void