Properties

$config

$config : array

Clone configuration settings.

Type

array

$instance

$instance : mixed

Public static variable to hold the single instance of the class.

Type

mixed — Default null

$file

$file : string

The zip backup file path.

Type

string

$archiver

$archiver : object

Tar archiver.

Type

object

Methods

__construct()

__construct(string  $file = '') 

MainWP_Clone_Install constructor.

Run any time class is called.

Parameters

string $file

Archive file.

check_zip_support()

check_zip_support() : boolean

Check for default PHP zip support.

Returns

boolean —

true|false.

check_zip_console()

check_zip_console() : boolean

Check if we could run zip on console.

Returns

boolean —

true|false.

check_wp_zip()

check_wp_zip() : boolean

Check if unzip_file function exists.

Returns

boolean —

true|false.

remove_config_file()

remove_config_file() : boolean

Remove wp-config.php file.

Returns

boolean —

true|false.

test_download()

test_download() 

Test the download.

Throws

\Exception

Error message.

read_configuration_file()

read_configuration_file() 

Read configuration file.

Throws

\Exception

Error message on failure.

update_wp_config()

update_wp_config() 

Update wp-config.php file.

update_option()

update_option(string  $name, string  $value) 

Update DB options by name.

Parameters

string $name

Option name.

string $value

Option value to update.

install()

install() : boolean

Database Installation.

Throws

\Exception

Error message on failure.

Returns

boolean —

true|false.

get_config_contents()

get_config_contents() : boolean|false|mixed|string

Get config contents.

Returns

boolean|false|mixed|string

extract_backup()

extract_backup() : boolean|null

Extract backup file.

Throws

\Exception

Error message on failure.

Returns

boolean|null —

true or null.

extract_zip_backup()

extract_zip_backup() : boolean

Extract backup using default PHP zip library.

Returns

boolean —

true|false.

extract_wp_zip_backup()

extract_wp_zip_backup() : boolean

Extract with unzip_file.

Returns

boolean —

true|false.

extract_zip_pcl_backup()

extract_zip_pcl_backup() : boolean

Extract PCLZIP.

Throws

\Exception

Error on failure.

Returns

boolean —

true|false.

extract_zip_console_backup()

extract_zip_console_backup() : boolean

Extract backup using zip on console.

Returns

boolean —

true|false.

recurse_chmod()

recurse_chmod(string  $mypath, string  $arg) 

Recursively chmod file structure.

Parameters

string $mypath

Path to files.

string $arg

chmod arguments.

icit_srdb_replacer()

icit_srdb_replacer(\MainWP\Child\mysql  $connection, string  $search = '', string  $replace = '', array  $tables = array()) : array

The main loop triggered in step 5. Up here to keep it out of the way of the HTML. This walks every table in the db that was selected in step 3 and then walks every row and column replacing all occurrences of a string with another.

We split large tables into 50,000 row blocks when dealing with them to save on memory consumption.

Parameters

\MainWP\Child\mysql $connection

The db connection object.

string $search

What we want to replace.

string $replace

What we want to replace it with.

array $tables

The tables we want to look at.

Returns

array —

Collection of information gathered during the run.

recursive_unserialize_replace()

recursive_unserialize_replace(string  $from = '', string  $to = '', array  $data = '', boolean  $serialised = false) : array

Take a serialised array and un-serialize it replacing elements as needed and un-serializing any subordinate arrays and performing the replace on those too.

Parameters

string $from

String we're looking to replace.

string $to

What we want it to be replaced with.

array $data

Used to pass any subordinate arrays back.

boolean $serialised

Does the array passed via $data need serialising.

Returns

array —

The original array with all elements replaced as needed.

replace_define()

replace_define(string  $constant, string  $value, string  $content) : string

Replace define statement to work with wp-config.php.

Parameters

string $constant

The constant name.

string $value

The new value.

string $content

The PHP file content.

Returns

string —

Replaced define statement with new value.

replace_var()

replace_var(string  $varname, string  $value, string  $content) : string

Replace variable value to work with wp-config.php.

Parameters

string $varname

The variable name.

string $value

The new value.

string $content

The PHP file content.

Returns

string —

Replaced variable value with new value.

file_exists()

file_exists(string  $file) : boolean|string

Check if clone config.txt exists.

Parameters

string $file

Config.txt file path.

Returns

boolean|string —

False or True on success. Return config.txt content on true.