diff options
| author | KunoiSayami <[email protected]> | 2022-10-26 00:05:46 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2022-10-26 00:05:46 +0800 |
| commit | 685c74c4fa212b132c55be1c91e5b366a3593b83 (patch) | |
| tree | 25a9aa9024f517ce51107c89e60267fea56f105e /utils/ng/upload.php | |
| parent | 596fc2317eae72d006e4c528ac3f14c4d9d712e8 (diff) | |
refactor: Move script out from ng folder
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'utils/ng/upload.php')
| -rw-r--r-- | utils/ng/upload.php | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/utils/ng/upload.php b/utils/ng/upload.php deleted file mode 100644 index da848eb..0000000 --- a/utils/ng/upload.php +++ /dev/null @@ -1,35 +0,0 @@ -<?PHP - if (isset($_POST) && isset($_POST['token']) && - $_POST['token'] === 'be688838ca8686e5c90689bf2ab585cef1137c999b48c70b92f67a5c34dc15697b5d11c982ed6d71be1e1e7f7b4e0733884aa97c3f7a339a8ed03577cf74be09'; - ) { - if (!isset($_POST['arch'])) { - http_response_code(400); - echo "400 Bad Request: Should specify arch field while post files"; - die(); - } - if (!empty($_FILES['file'])) { - - $path = "/var/www/repo/". $_POST['arch'] . "/"; - $path = $path . basename($_FILES['file']['name']); - - if (move_uploaded_file($_FILES['file']['tmp_name'], $path)) { - echo "The file " . basename( $_FILES['file']['name']) . " has been uploaded"; - } else { - echo "There was an error uploading the file, please try again!"; - } - } else if (isset($_POST['action'])) { - if ($_POST['action'] === 'UPLOADED') { - $sock = stream_socket_client('unix:///run/update-repo-notify.sock', $errno, $errst); - fwrite($sock, "ARCH=". $_POST['arch'] ."\r\n"); - fclose($sock); - echo "200 OK STARTED"; - } else if ($_POST['action'] === 'REQUIRE_CLEAN') { - shell_exec("/usr/bin/rm -rf /var/www/repo/". $_POST['arch'] . "*"); - shell_exec("/usr/bin/mkdir /var/www/repo/". $_POST['arch']); - echo "200 OK CLEANED"; - } - } - } else { - http_response_code(403); - } -?> |
