<?php
function git_commit_change(){
exec("git status", $l);
$s = implode('', $l);
if(strpos($s, "nothing to commit") === false){
if(strpos($s, 'delete')!==false){
foreach($l as $line){
if(strpos($line, 'delete')!==false){
$deleted_file = trim(str_replace("deleted:",'',$line));
system("git rm ".$deleted_file);
}
}
}
system("git add .");
system('git commit -m "auto commit at '.date("Y-m-d H:i:s").'"');
}
}
function git_push_2_server(){
system('git push www master');
}
git_commit_change();
git_push_2_server();