-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathactions.php
More file actions
31 lines (27 loc) · 914 Bytes
/
actions.php
File metadata and controls
31 lines (27 loc) · 914 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
<?php
set_time_limit( 0);
ob_implicit_flush( 1);
require_once( 'requireme.php');
checksession();
if ( $action == 'websocketserver') {
if ( procpid( 'websocket.server.with.fork.php')) prockill( procpid( 'websocket.server.with.fork.php'));
procat( '/usr/local/php/bin/php /web/websockets/websocket.server.with.fork.php > /web/websockets/server.log');
die( jsonsend( jsonmsg( 'ok')));
}
if ( $action == 'chunk') { // [seek], streams, size
$in = fopen( 'data.binary', 'r');
if ( isset( $seek) && $in) fseek( $in, $seek);
if ( ! $in || feof( $in)) die( '');
echo fread( $in, $size);
fclose( $in);
}
if ( $action == 'stats') { // took, setup, timegaps
$out = foutopen( "raw.bz64jsonl", 'a');
$time = tsystem();
$setup = json2h( $setup, true);
$timegaps = json2h( $timegaps, true);
foutwrite( $out, compact( ttl( 'time,took,setup,timegaps')));
foutclose( $out);
die( jsonsend( jsonmsg( 'ok')));
}
?>