MT-12
This commit is contained in:
@@ -32,7 +32,29 @@ class FilesMigrator implements Importable, Exportable
|
|||||||
public function import($data)
|
public function import($data)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->processes->createFilesManager($data[0]['PRO_UID'],$data);
|
$aTable = $data['TABLE'];
|
||||||
|
foreach ($aTable as $value) {
|
||||||
|
if($value['PRF_EDITABLE'] !== 1){
|
||||||
|
$this->processes->createFilesManager($value['PRO_UID'],array($value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$aPath = $data['PATH'];
|
||||||
|
foreach ($aPath as $target => $files) {
|
||||||
|
$basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP;
|
||||||
|
if(strtoupper($target) === 'PUBLIC'){
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$filename = $basePath . ((isset($file["file_path"]))? $file["file_path"] : $file["filepath"]);
|
||||||
|
$path = dirname($filename);
|
||||||
|
|
||||||
|
if (!is_dir($path)) {
|
||||||
|
Util\Common::mk_dir($path, 0775);
|
||||||
|
}
|
||||||
|
|
||||||
|
file_put_contents($filename, $file["file_content"]);
|
||||||
|
chmod($filename, 0775);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Logger::log($e);
|
Logger::log($e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,54 @@ class GranularImporter
|
|||||||
$this->factory = new MigratorFactory();
|
$this->factory = new MigratorFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load Objects List Selected
|
||||||
|
*/
|
||||||
|
public function loadObjectsListSelected($data, $aGranular) {
|
||||||
|
$objectList = array();
|
||||||
|
if(in_array('PROCESSDEFINITION', $aGranular)){
|
||||||
|
$objectList['PROCESSDEFINITION'] = $this->structureBpmnData($data['tables']['bpmn']);
|
||||||
|
}
|
||||||
|
if(in_array('ASSIGNMENTRULES', $aGranular)){
|
||||||
|
$objectList['ASSIGNMENTRULES'] = $data['tables']['workflow']['tasks'];
|
||||||
|
}
|
||||||
|
if(in_array('VARIABLES', $aGranular)){
|
||||||
|
$objectList['VARIABLES'] = $data['tables']['workflow']['processVariables'];
|
||||||
|
}
|
||||||
|
if(in_array('DYNAFORMS', $aGranular)){
|
||||||
|
$objectList['DYNAFORMS'] = $data['tables']['workflow']['dynaforms'];
|
||||||
|
}
|
||||||
|
if(in_array('INPUTDOCUMENTS', $aGranular)){
|
||||||
|
$objectList['INPUTDOCUMENTS'] = $data['tables']['workflow']['inputs'];
|
||||||
|
}
|
||||||
|
if(in_array('OUTPUTDOCUMENTS', $aGranular)){
|
||||||
|
$objectList['OUTPUTDOCUMENTS'] = $data['tables']['workflow']['outputs'];
|
||||||
|
}
|
||||||
|
if(in_array('TRIGGERS', $aGranular)){
|
||||||
|
$objectList['TRIGGERS'] = $data['tables']['workflow']['triggers'];
|
||||||
|
}
|
||||||
|
if(in_array('TEMPLATES', $aGranular)){
|
||||||
|
$objectList['TEMPLATES']['TABLE'] = $data['tables']['workflow']['filesManager'];
|
||||||
|
$objectList['TEMPLATES']['PATH'] = $data['files']['workflow'];
|
||||||
|
}
|
||||||
|
if(in_array('FILES', $aGranular)){
|
||||||
|
$objectList['FILES']['TABLE'] = $data['tables']['workflow']['filesManager'];
|
||||||
|
$objectList['FILES']['PATH'] = $data['files']['workflow'];
|
||||||
|
}
|
||||||
|
return $objectList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the structure from File
|
||||||
|
*/
|
||||||
public function structureBpmnData(array $tables){
|
public function structureBpmnData(array $tables){
|
||||||
$project = $tables["project"][0];
|
$project = $tables["project"][0];
|
||||||
$diagram = $tables["diagram"][0];
|
$diagram = $tables["diagram"][0];
|
||||||
$diagram["activities"] = $tables["activity"];
|
$diagram["activities"] = (isset($tables["activity"])) ? $tables["activity"] : array();
|
||||||
$diagram["artifacts"] = (isset($tables["artifact"])) ? $tables["artifact"] : array();
|
$diagram["artifacts"] = (isset($tables["artifact"])) ? $tables["artifact"] : array();
|
||||||
$diagram["events"] = $tables["event"];
|
$diagram["events"] = (isset($tables["event"])) ? $tables["event"] : array();
|
||||||
$diagram["flows"] = $tables["flow"];
|
$diagram["flows"] = (isset($tables["flow"])) ? $tables["flow"] : array();
|
||||||
$diagram["gateways"] = $tables["gateway"];
|
$diagram["gateways"] = (isset($tables["gateway"])) ? $tables["gateway"] : array();
|
||||||
$diagram["data"] = (isset($tables["data"]))? $tables["data"] : array();
|
$diagram["data"] = (isset($tables["data"]))? $tables["data"] : array();
|
||||||
$diagram["participants"] = (isset($tables["participant"]))? $tables["participant"] : array();
|
$diagram["participants"] = (isset($tables["participant"]))? $tables["participant"] : array();
|
||||||
$diagram["laneset"] = (isset($tables["laneset"]))? $tables["laneset"] : array();
|
$diagram["laneset"] = (isset($tables["laneset"]))? $tables["laneset"] : array();
|
||||||
@@ -37,6 +77,9 @@ class GranularImporter
|
|||||||
return $project;
|
return $project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* import
|
||||||
|
*/
|
||||||
public function import($objectList)
|
public function import($objectList)
|
||||||
{
|
{
|
||||||
foreach ($objectList as $key => $data) {
|
foreach ($objectList as $key => $data) {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class ProcessDefinitionMigrator implements Importable, Exportable
|
|||||||
public function import($data)
|
public function import($data)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return $this->bpmn->createFromStruct($data);;
|
$this->bpmn->createFromStruct($data, false);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,25 +30,17 @@ class TemplatesMigrator implements Importable, Exportable
|
|||||||
public function import($data)
|
public function import($data)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
foreach ($data as $target => $files) {
|
//TABLE
|
||||||
switch (strtoupper($target)) {
|
$aTable = $data['TABLE'];
|
||||||
case 'DYNAFORMS':
|
foreach ($aTable as $value) {
|
||||||
$basePath = PATH_DYNAFORM;
|
if($value['PRF_EDITABLE'] === 1){
|
||||||
break;
|
$this->processes->createFilesManager($value['PRO_UID'],array($value));
|
||||||
case 'PUBLIC':
|
}
|
||||||
$basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP;
|
}
|
||||||
break;
|
$aPath = $data['PATH'];
|
||||||
case 'TEMPLATES':
|
foreach ($aPath as $target => $files) {
|
||||||
$basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'mailTemplates' . PATH_SEP;
|
$basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'mailTemplates' . PATH_SEP;
|
||||||
break;
|
if(strtoupper($target) === 'TEMPLATES'){
|
||||||
default:
|
|
||||||
$basePath = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($basePath)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$filename = $basePath . ((isset($file["file_path"]))? $file["file_path"] : $file["filepath"]);
|
$filename = $basePath . ((isset($file["file_path"]))? $file["file_path"] : $file["filepath"]);
|
||||||
$path = dirname($filename);
|
$path = dirname($filename);
|
||||||
@@ -61,6 +53,7 @@ class TemplatesMigrator implements Importable, Exportable
|
|||||||
chmod($filename, 0775);
|
chmod($filename, 0775);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Logger::log($e);
|
Logger::log($e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user