[fix] init management in deploy

This commit is contained in:
xdrm-brackets 2017-05-08 22:07:20 +02:00
parent fc4d805736
commit b013b84b8b
3 changed files with 26 additions and 17 deletions

View File

@ -1,3 +1,3 @@
#!/bin/sh
/usr/bin/env php $(realpath $(dirname $0))/source/deploy.php;
/usr/bin/env php $(realpath $(dirname $0))/source/deploy.php $*;

View File

@ -2,7 +2,7 @@
require_once __DIR__.'/../../include/php/const';
function api_deploy(){
function api_deploy($init){
/* [1] Fetch api response
=========================================================*/
@ -121,6 +121,10 @@
/* [6] Remove history entries
=========================================================*/
/* (0) We are done if @init */
if( $init )
return 0;
/* (1) Check history entries count */
if( !isset($arr_r['saved']) || !is_array($arr_r['saved']) )
return 127;
@ -146,7 +150,12 @@
}
$exec = api_deploy();
/* Manage init vs. sync */
$is_init = false;
if( $argc > 1 && $argv[1] == 'init' )
$is_init = true;
$exec = api_deploy($is_init);
echo $exec;
die($exec);

View File

@ -160,7 +160,7 @@
/* [8] Deploy received data
=========================================================*/
/* (1) Manage response deployement */
$deploy = syscall(SOURCE_DIR.'/lib/api/deploy');
$deploy = syscall(SOURCE_DIR.'/lib/api/deploy init');
/* (2) Return state */
return ($deploy === true) ? 0 : 127;