예제 #1
0
파일: functions.php 프로젝트: jonesxv/csf
function workflow_recurse($sid)
{
    global $db;
    $schema = '';
    #select the svid containint the link between modules
    #I.E. state tied to City
    $sql = "select * from " . $schema . "station_variables where (sid='" . $sid . "') and (name like 'connect%');";
    $result = $db->fetchAll($sql);
    foreach ($result as $variable) {
        #take value (which will be the linked module- I.E. for country it will be state), and rerun function
        #to get its links (I.E. for state it will be city)
        workflow_recurse($variable['value']);
        workflow_setrequest($variable['value'], 'update');
        workflow_execute1($variable['value'], 1);
    }
}
예제 #2
0
파일: environment.php 프로젝트: jonesxv/csf
function workflow_execute($sid)
{
    global $db;
    $sql = "select * from station";
    $result1 = $db->fetchAll($sql);
    #file_put_contents('/tmp/info',"Checking Predecessors (".$sid.")\n",FILE_APPEND);
    foreach ($result1 as $value) {
        #set variable $stations as the value of the modules 'status' column in database
        $stations[$value['sid']]['status'] = $value['status'];
        #set variable $stations as the value of the modules 'request' column in database
        $stations[$value['sid']]['request'] = $value['request'];
    }
    $sql = "select * from station_variables where (sid='" . $sid . "') and (name like 'connect%');";
    $result = $db->fetchAll($sql);
    foreach ($result as $variable) {
        #echo '..found('.$variable['value'].')';
        #file_put_contents('/tmp/info',"Found (".$variable['value'].")\n",FILE_APPEND);
        ############################# only run if all required inputs are done.
        $sql = "select * from station_variables where (value='" . $variable['value'] . "') and (name like 'connect%');";
        $result2 = $db->fetchAll($sql);
        $go = 0;
        #file_put_contents('/tmp/info',"Preparing Check ".$variable['value']."\n",FILE_APPEND);
        foreach ($result2 as $value) {
            #echo '..checking('.$value['sid'].')';
            #file_put_contents('/tmp/info',"Checking ".$variable['value']." against (".$value['sid'].")\n",FILE_APPEND);
            if (!($stations[$value['sid']]['status'] == 'ready' and $stations[$value['sid']]['request'] == 'done')) {
                $go = 1;
            }
            #file_put_contents('/tmp/info',"Result: ".intval($go)." \n",FILE_APPEND);
        }
        if ($go == 0) {
            workflow_execute1($variable['value']);
        }
    }
}