Migrate
extends CLICommands
in package
Migrate CLI class.
Table of Contents
Properties
- $notices : array<string|int, array{type: string, message: string}>
- WP CLI notices.
- $upload_path : string
- Upload path
- $upload_url : string
- Upload URL
Methods
- __construct() : mixed
- Construct
- add_notice() : void
- Adds a notice to be displayed at the end of the command.
- display_notices() : void
- Display the notices. The output is WP_CLI.
- get_notices() : array<string|int, array{type: string, message: string}>
- Get all notices.
- get_upload_path() : string
- Get the upload path.
- get_upload_url() : string
- Get the upload URL.
- register_commands() : void
- Register the commands.
- reset_notices() : void
- Reset all notices.
- set_upload_path() : void
- Set the upload path.
- set_upload_url() : void
- Set the upload URL.
- export_csv() : void
- Create and write to a CSV file
Properties
$notices
WP CLI notices.
public
array<string|int, array{type: string, message: string}>
$notices
= array()
$upload_path
Upload path
public
string
$upload_path
$upload_url
Upload URL
public
string
$upload_url
Methods
__construct()
Construct
public
__construct() : mixed
add_notice()
Adds a notice to be displayed at the end of the command.
public
add_notice([string $message = '' ][, string $type = 'log' ]) : void
Parameters
- $message : string = ''
-
The message to display.
- $type : string = 'log'
-
The type of notice. One of 'log', 'success', 'warning', 'error'. Default is 'log'.
display_notices()
Display the notices. The output is WP_CLI.
public
display_notices() : void
get_notices()
Get all notices.
public
get_notices() : array<string|int, array{type: string, message: string}>
Return values
array<string|int, array{type: string, message: string}> —The array of notices.
get_upload_path()
Get the upload path.
public
get_upload_path() : string
Return values
string —The full path.
get_upload_url()
Get the upload URL.
public
get_upload_url() : string
Return values
string —The full URL.
register_commands()
Register the commands.
public
static register_commands() : void
reset_notices()
Reset all notices.
public
reset_notices() : void
set_upload_path()
Set the upload path.
public
set_upload_path([string $path = '' ]) : void
If the path is a directory, it will create it if it does not exist.
Parameters
- $path : string = ''
-
The complete path to use.
set_upload_url()
Set the upload URL.
public
set_upload_url([string $url = '' ]) : void
Parameters
- $url : string = ''
-
The full URL to use.
export_csv()
Create and write to a CSV file
protected
export_csv(string $filename, array<int|string, mixed> $rows[, array<int|string, string> $headers = array() ]) : void
Parameters
- $filename : string
-
the full name of the file.
- $rows : array<int|string, mixed>
-
array of data.
- $headers : array<int|string, string> = array()
-
(default: array()).