Class WPDA_Import

Imports a script file that contains exactly one insert into statement (can insert multiple records). Only insert statements are allowed. Insert is only allowed into the table name provided in constructor. Subqueries are not allowed (checked with explain).

author Peter Schulz
since 1.0.0
package WPDataAccess\Utilities

 Methods

WPDA_Import constructor

__construct(string $page, string $schema_name, string $table_name) 

Checks if imports are allowed. Throws an exception if imports are not allowed.

since 1.0.0

Parameters

$page

string

Page where to post data (url).

$schema_name

string

Database schema name.

$table_name

string

Database table name.

Exceptions

\Exception Throws exception if export is disabled.

Adds an import button

add_button(string $label = '', string $class = 'page-title-action'
since 1.0.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::add_button() is clicked, the container is shown.

since 1.0.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.0.0

 Properties

 

Indicates where imports are allowed

$allow_imports : string

Default

 

Database schema name

$schema_name : string

Default

 

Database table name

$table_name : string

Default

 

URL where to post data

$url : string

Default