-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
42 lines (33 loc) · 712 Bytes
/
example.php
File metadata and controls
42 lines (33 loc) · 712 Bytes
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
<?php
/**
* @file
* Example for Batch API.
*/
if(!defined('e107_INIT'))
{
require_once('../../class2.php');
}
// Include main Batch API file.
e107_require_once(e_PLUGIN . 'batch/includes/batch.php');
// Include we our example functions.
e107_require_once(e_PLUGIN . 'batch/includes/batch.example.php');
// Get dummy data for testing.
$comments = get_comments();
// Run!
batch_example($comments);
/**
* Helper function to load comments for Batch process (as dummy data).
*
* @return array
*/
function get_comments()
{
$db = e107::getDb();
$db->select('comments', '*', 'comment_id > 0');
$comments = array();
while($comment = $db->fetch())
{
$comments[] = $comment;
}
return $comments;
}