forked from deliciousbrains/wp-background-processing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwp-background-processing.php
More file actions
60 lines (50 loc) · 1.36 KB
/
Copy pathwp-background-processing.php
File metadata and controls
60 lines (50 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* WP-Background Processing
*
* @package WP-Background-Processing
*/
/*
Plugin Name: WP Background Processing
Plugin URI: https://github.com/A5hleyRich/wp-background-processing
Description: Asynchronous requests and background processing in WordPress.
Author: Delicious Brains Inc.
Version: 1.0
Author URI: https://deliciousbrains.com/
GitHub Plugin URI: https://github.com/A5hleyRich/wp-background-processing
GitHub Branch: master
*/
require_once plugin_dir_path( __FILE__ ) . 'classes/wp-async-request.php';
require_once plugin_dir_path( __FILE__ ) . 'classes/wp-background-process.php';
class WP_Example_Process extends WP_Background_Process {
/**
* @var string
*/
protected $action = 'example_process';
/**
* 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.
*
* @param mixed $item Queue item to iterate over
*
* @return mixed
*/
protected function task( $item ) {
// Actions to perform
return false;
}
/**
* Complete
*
* Override if applicable, but ensure that the below actions are
* performed, or, call parent::complete().
*/
protected function complete() {
parent::complete();
// Show notice to user or perform some other arbitrary task...
}
}