forked from marcofbb/queue-system-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpanel.php
More file actions
97 lines (89 loc) · 2.55 KB
/
panel.php
File metadata and controls
97 lines (89 loc) · 2.55 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
require(__DIR__ . '/../class.queue.php');
$cola = new queue_admin();
if(isset($_GET['do']) and !empty($_GET['do'])){
$do = $_GET['do'];
if($do == 'add-demo-process1'){
$cola->enqueue('C:\xampp\php\php.exe '.__DIR__.'/exec/write_time_in_txt.php');
} elseif($do == 'add-demo-process2'){
$cola->enqueue('C:\xampp\php\php.exe '.__DIR__.'/exec/wait_30s.php');
} elseif($do == 'add-demo-process3'){
$in_20_second = time() + 20;
$cola->enqueue('C:\xampp\php\php.exe '.__DIR__.'/exec/wait_30s.php',$in_20_second,1);
} elseif($do == 'exec-one-queue') {
$cola->process_queue();
} elseif($do == 'delete-all-process-finish'){
$cola->delete_process_finish();
}
header('location: panel.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
</head>
<body>
<h2>Demo</h2>
<ul>
<li><a href="?do=add-demo-process1">Add Demo Process [Write txt]</a></li>
<li><a href="?do=add-demo-process2">Add Demo Process [Wait 30s]</a></li>
<li><a href="?do=add-demo-process3">Add Demo Process [Write txt] in 20 seconds and max priority</a></li>
<li><a href="?do=exec-one-queue">Execute a single process from the queue</a></li>
<li><a href="?do=delete-all-process-finish">Delete all process finish</a></li>
</ul>
<h2>Queue Info</h2>
<ul>
<li>Dispatcher Run: <?php if($cola->is_dispatcher_run()) echo 'yes'; else echo 'no'; ?></li>
<li>Pending: <?php echo $cola->count_queue_pending(); ?></li>
<li>Processing: <?php echo $cola->count_queue_processing(); ?></li>
<li>Finish: <?php echo $cola->count_queue_finish(); ?></li>
<li>Maximum in parallel [Config]: <?php echo $cola->max_process; ?></li>
<li>Total: <?php echo $cola->count_queue_total(); ?></li>
</ul>
<h2>Queue Data</h2>
<table>
<tr>
<th>ID</th>
<th>command</th>
<th>priority</th>
<th>message</th>
<th>time_add_queue</th>
<th>time_start_process</th>
<th>time_finish_process</th>
<th>wake_up</th>
<th>status</th>
</tr>
<?php
$data = $cola->get_queue_db();
if(!empty($data)): foreach($data as $d):
?>
<tr>
<td><?=$d['id']?></td>
<td><small><?=$d['command']?></small></td>
<td><?=$d['priority']?></td>
<td><small><?=$d['message']?></small></td>
<td><?=$d['time_add_queue']?></td>
<td><?=$d['time_start_process']?></td>
<td><?=$d['time_finish_process']?></td>
<td><?=$d['time_wake_up']?></td>
<td><?=$d['status']?></td>
</tr>
<?php endforeach; endif; ?>
</table>
</body>
</html>