From 65d12890670ba304e645eb8161184df703e8c5b4 Mon Sep 17 00:00:00 2001 From: Gabriel Carneiro Date: Thu, 19 Dec 2024 19:55:44 -0300 Subject: [PATCH] push db changes to git --- php/upload.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/php/upload.php b/php/upload.php index 46c59d7..8222532 100755 --- a/php/upload.php +++ b/php/upload.php @@ -43,7 +43,7 @@ // Processa o vĂ­deo com o script do flavio function process_file($username, $title, $input_file, $output_file) { - $SCRIPT_PATH = '/var/www/src/aliceclass/script/script.sh'; + $SCRIPT_PATH = '/var/www/html/aliceclass/script/script.sh'; $cmd = sprintf('%s "%s" "%s" "%s" "%s" "%s"', $SCRIPT_PATH, $title, $username, $input_file, '', $output_file); @@ -74,8 +74,10 @@ } function push_to_git() { - // $git_cmd = '-c user.name="www-data" -c user.email="no-replay@example.org"' - // shell_exec('cd /var/www/src/AliceClass;' . $git_cmd . 'add _data/aulas.json;' . $git_cmd . 'commit -m "update data";' . $git_cmd . 'push'); + $git_cmd = 'git --git-dir=/var/www/src/aliceclass' + shell_exec($git_cmd . ' add /var/www/src/aliceclass/_data/aulas.json'); + shell_exec($git_cmd . ' commit -m "update data"'); + shell_exec($git_cmd . ' push'); } $username = $_SERVER['PHP_AUTH_USER']; @@ -97,6 +99,8 @@ upload($orig_file, $brute_file); //|| echo error && exit; process_file($username, $video_title, $brute_file, $target_file); // || echo error && exit; insert_into_db($username, $video_title, $video_desc, $video_level, $video_software, $video_date); + push_to_git(); + echo "The file ". htmlspecialchars(basename($orig_file)). " has been uploaded."; ?>