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."; ?>