Class WPDA_Import_Multi

Imports a script file that might contain multiple SQL statement including create table and insert into statements.

author Peter Schulz
since 1.6.0
package WPDataAccess\Utilities

 Methods

WPDA_Import constructor

__construct(string $page, string $schema_name, array $args = null

Checks if ZipArchive is installed to support the import of ZIP files.

since 1.6.0

Parameters

$page

string

Page where to post data (url).

$schema_name

string

Database schema name.

$args

array

Extra arguments.

Adds an import button

add_button(string $label = '', string $class = 'page-title-action'
since 1.6.0

Parameters

$label

string

Button label.

$class

string

Button CSS class.

Adds an import container

add_container() 

The container contains an upload form. The container is hidden by default. When the button created in \WPDataAccess\Utilities\WPDA_Import_Multi::add_button() is clicked, the container is shown.

since 1.6.0

Checks if request is valid and allowed

check_post() 

If the requested import is valid and allowed, the import file is loaded and its content imported.

since 1.6.0

Perform import

import(string $file_name) 

Import file is read in chunks to allow imports of large files without resource limitations. An indicator is maintained to follow the progress of the import. The indicator is used to show a message at the end whether the import succeeded or failed.

since 1.6.0

Parameters

$file_name

string

Import file name

Inform user that an error occured

import_failed(string $msg) 
since 1.6.0

Parameters

$msg

string

Error message text

Inform user that the import failed

upload_failed() 
since 1.6.0

 Properties

 

Content of import file

$file_content : string

Default

 

Pointer to import file

$file_pointer : string

Default

 

Text to inform user (line 1).

$info_text : string

Default

''
 

Text to inform user (line 1).

$info_title : string

Default

''
 

Indicicates whether ZipArchive is installed.

$isinstalled_ziparchive : boolean

Default

false
 

Database schema name

$schema_name : string

Default

 

URL where to post data

$url : string

Default

 Constants

 

SOLUTIONS

SOLUTIONS = '(<a href="https://wpdataaccess.com/docs/documentation/getting-started/known-limitations/" target="_blank">see solutions</a>)'