class Export (View source)

PhpMyAdmin\Export class

Properties

$dumpBuffer
$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 $line)

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

string
getHtmlForDisplayedExportFooter(string $exportType, string $db, string $table)

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

string
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 $errorUrl, string $exportType, bool $doRelation, bool $doComments, bool $doMime, bool $doDates, array $aliases, string $separateFiles)

Export at the server level

void
exportDatabase(DatabaseName $db, array $tables, string $whatStrucOrData, array $tableStructure, array $tableData, ExportPlugin $exportPlugin, 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 $errorUrl, string|null $db, string $sqlQuery, string $exportType)

Export a raw query

void
exportTable(string $db, string $table, string $whatStrucOrData, ExportPlugin $exportPlugin, 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(DatabaseName $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

array
getExportSchemaInfo(DatabaseName $db, string $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

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

bool outputHandler(string $line)

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

Parameters

string $line

the insert statement

Return Value

bool

string getHtmlForDisplayedExportFooter(string $exportType, string $db, string $table)

Returns HTML containing the footer for a displayed export

Parameters

string $exportType

the export type

string $db

the database name

string $table

the table name

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

string 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

string

the generated HTML and back button

void exportServer(string|array $dbSelect, string $whatStrucOrData, ExportPlugin $exportPlugin, 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 $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(DatabaseName $db, array $tables, string $whatStrucOrData, array $tableStructure, array $tableData, ExportPlugin $exportPlugin, string $errorUrl, string $exportType, bool $doRelation, bool $doComments, bool $doMime, bool $doDates, array $aliases, string $separateFiles)

Export at the database level

Parameters

DatabaseName $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 $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 $errorUrl, string|null $db, 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 $errorUrl

the URL in case of error

string|null $db

the database where the query is executed

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 $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 $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(DatabaseName $db, array $tables, string $lockType = 'WRITE')

Locks tables

Parameters

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

array getExportSchemaInfo(DatabaseName $db, string $exportType)

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

Parameters

DatabaseName $db
string $exportType

Return Value

array

Exceptions

ExportException