-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestAsyncPush.php
More file actions
38 lines (31 loc) · 859 Bytes
/
TestAsyncPush.php
File metadata and controls
38 lines (31 loc) · 859 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
<?php
namespace modmore\SiteDashClient\Communication;
use modmore\SiteDashClient\CommandInterface;
class TestAsyncPush implements CommandInterface {
/**
* @var Pusher
*/
private $pusher;
public function __construct($pusher)
{
$this->pusher = $pusher;
}
public function run()
{
$this->pusher->acknowledge();
$result = new Result($this->pusher);
$logFile = MODX_CORE_PATH . 'cache/logs/sitedash_pushtest_' . date('Y-m-d-H-i-s') . '.log';
$limit = 15;
$i = 0;
@set_time_limit($limit + 5);
while ($i < $limit) {
$i++;
file_put_contents($logFile, date('Y-m-d H:i:s') . "\n", FILE_APPEND);
sleep(1);
}
$result(200, [
'success' => true,
'counted_to' => $limit,
]);
}
}