-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathdeleteTar.json.php
More file actions
31 lines (28 loc) · 868 Bytes
/
deleteTar.json.php
File metadata and controls
31 lines (28 loc) · 868 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
require_once './configuration.php';
set_time_limit(3600);// 1 hour
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
$obj->aVideoStorageURL = $global['aVideoStorageURL'];
$obj->filename = "";
$obj->filesize = 0;
if (empty($_REQUEST['secret']) || $_REQUEST['secret'] !== $global['secret']) {
$obj->msg = "Invalid secret";
} else if (empty($_REQUEST['filename'])) {
$obj->msg = "Empty filename";
} else {
$filename = $_REQUEST['filename'];
$obj->tarFileName = "{$filename}.tgz";
$videosDir = "{$global['videos_directory']}";
$backupFile = "{$videosDir}{$obj->tarFileName}";
if (file_exists($backupFile)) {
unlink($backupFile);
} else {
error_log("deleteTar ERROR ({$backupFile}) is does NOT exists ");
}
$obj->error = false;
}
die(json_encode($obj));
?>