PHP 클래스 WP_Background_Process, wp-background-processing

상속: extends WP_Async_Request
파일 보기 프로젝트 열기: A5hleyRich/wp-background-processing 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$action string (default value: 'background_process')
$cron_hook_identifier mixed Cron_hook_identifier
$cron_interval_identifier mixed Cron_interval_identifier
$start_time integer (default value: 0)

공개 메소드들

메소드 설명
__construct ( ) Initiate new background process
cancel_process ( ) Cancel Process
delete ( string $key ) Delete queue
dispatch ( ) : void Dispatch
handle_cron_healthcheck ( ) Handle cron healthcheck
maybe_handle ( ) Maybe process queue
push_to_queue ( mixed $data ) Push to queue
save ( ) Save queue
schedule_cron_healthcheck ( mixed $schedules ) : mixed Schedule cron healthcheck
update ( string $key, array $data ) Update queue

보호된 메소드들

메소드 설명
clear_scheduled_event ( ) Clear scheduled event
complete ( ) Complete.
generate_key ( integer $length = 64 ) : string Generate key
get_batch ( ) : stdClass Get batch
get_memory_limit ( ) : integer Get memory limit
handle ( ) Handle
is_process_running ( ) Is process running
is_queue_empty ( ) : boolean Is queue empty
lock_process ( ) Lock process
memory_exceeded ( ) : boolean Memory exceeded
schedule_event ( ) Schedule event
task ( mixed $item ) : mixed Task
time_exceeded ( ) : boolean Time exceeded.
unlock_process ( ) Unlock process

메소드 상세

__construct() 공개 메소드

Initiate new background process
public __construct ( )

cancel_process() 공개 메소드

Stop processing queue items, clear cronjob and delete batch.
public cancel_process ( )

clear_scheduled_event() 보호된 메소드

Clear scheduled event
protected clear_scheduled_event ( )

complete() 보호된 메소드

Override if applicable, but ensure that the below actions are performed, or, call parent::complete().
protected complete ( )

delete() 공개 메소드

Delete queue
public delete ( string $key )
$key string Key.

dispatch() 공개 메소드

Dispatch
public dispatch ( ) : void
리턴 void

generate_key() 보호된 메소드

Generates a unique key based on microtime. Queue items are given a unique key so that they can be merged upon save.
protected generate_key ( integer $length = 64 ) : string
$length integer Length.
리턴 string

get_batch() 보호된 메소드

Get batch
protected get_batch ( ) : stdClass
리턴 stdClass Return the first batch from the queue

get_memory_limit() 보호된 메소드

Get memory limit
protected get_memory_limit ( ) : integer
리턴 integer

handle() 보호된 메소드

Pass each queue item to the task handler, while remaining within server memory and time limit constraints.
protected handle ( )

handle_cron_healthcheck() 공개 메소드

Restart the background process if not already running and data exists in the queue.

is_process_running() 보호된 메소드

Check whether the current process is already running in a background process.
protected is_process_running ( )

is_queue_empty() 보호된 메소드

Is queue empty
protected is_queue_empty ( ) : boolean
리턴 boolean

lock_process() 보호된 메소드

Lock the process so that multiple instances can't run simultaneously. Override if applicable, but the duration should be greater than that defined in the time_exceeded() method.
protected lock_process ( )

maybe_handle() 공개 메소드

Checks whether data exists within the queue and that the process is not already running.
public maybe_handle ( )

memory_exceeded() 보호된 메소드

Ensures the batch process never exceeds 90% of the maximum WordPress memory.
protected memory_exceeded ( ) : boolean
리턴 boolean

push_to_queue() 공개 메소드

Push to queue
public push_to_queue ( mixed $data )
$data mixed Data.

save() 공개 메소드

Save queue
public save ( )

schedule_cron_healthcheck() 공개 메소드

Schedule cron healthcheck
public schedule_cron_healthcheck ( mixed $schedules ) : mixed
$schedules mixed Schedules.
리턴 mixed

schedule_event() 보호된 메소드

Schedule event
protected schedule_event ( )

task() 추상적인 보호된 메소드

Override this method to perform any actions required on each queue item. Return the modified item for further processing in the next pass through. Or, return false to remove the item from the queue.
abstract protected task ( mixed $item ) : mixed
$item mixed Queue item to iterate over.
리턴 mixed

time_exceeded() 보호된 메소드

Ensures the batch never exceeds a sensible time limit. A timeout limit of 30s is common on shared hosting.
protected time_exceeded ( ) : boolean
리턴 boolean

unlock_process() 보호된 메소드

Unlock the process so that other instances can spawn.
protected unlock_process ( )

update() 공개 메소드

Update queue
public update ( string $key, array $data )
$key string Key.
$data array Data.

프로퍼티 상세

$action 보호되어 있는 프로퍼티

(default value: 'background_process')
protected string $action
리턴 string

$cron_hook_identifier 보호되어 있는 프로퍼티

Cron_hook_identifier
protected mixed $cron_hook_identifier
리턴 mixed

$cron_interval_identifier 보호되어 있는 프로퍼티

Cron_interval_identifier
protected mixed $cron_interval_identifier
리턴 mixed

$start_time 보호되어 있는 프로퍼티

(default value: 0)
protected int $start_time
리턴 integer