forked from devsam/image
git_pull이 CLI에서도 동작하게 변경
This commit is contained in:
+11
-2
@@ -24,10 +24,14 @@ function getVersion($target=null){
|
||||
|
||||
}
|
||||
|
||||
function isCommandLineInterface()
|
||||
{
|
||||
return (php_sapi_name() === 'cli');
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$req_hash = $_REQUEST['req']??'';
|
||||
$req_time = $_REQUEST['time']??0;
|
||||
|
||||
|
||||
$json_response = [
|
||||
'result'=>false,
|
||||
@@ -35,6 +39,10 @@ $json_response = [
|
||||
'version'=>null,
|
||||
];
|
||||
|
||||
if (!isCommandLineInterface()) {
|
||||
$req_hash = $_REQUEST['req']??'';
|
||||
$req_time = $_REQUEST['time']??0;
|
||||
|
||||
if (!$req_hash) {
|
||||
$json_response['reason'] = 'no req';
|
||||
die(json_encode($json_response));
|
||||
@@ -63,6 +71,7 @@ if($ans_hash != $req_hash){
|
||||
$json_response['reason'] = 'hash mismatch';
|
||||
die(json_encode($json_response));
|
||||
}
|
||||
}
|
||||
|
||||
exec("git pull -q 2>&1", $output);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user