File size: 793 Bytes
07c3cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

use ProcessMaker\Core\Installer;

$inst = new Installer();

$oProcess = new Processes();

//Get Available autoinstall process
$availableProcess = $inst->getDirectoryFiles( PATH_OUTTRUNK . "autoinstall", "pm" );

$path = PATH_OUTTRUNK . "autoinstall" . PATH_SEP;
$message = "";
foreach ($availableProcess as $processfile) {

    $oData = $oProcess->getProcessData( $path . $processfile );
    $Fields['PRO_FILENAME'] = $processfile;
    $Fields['IMPORT_OPTION'] = 2;
    $sProUid = $oData->process['PRO_UID'];
    if ($oProcess->processExists( $sProUid )) {
        $message .= "$processfile - Not imported (process exist)<br>";

    } else {
        $oProcess->createProcessFromData( $oData, $path . $processfile );
        $message .= "$processfile - OK<br>";
    }
}

echo $message;