Fix the new import methods.

This commit is contained in:
Gustavo Adolfo Cruz Laura
2016-03-28 14:48:33 -04:00
parent 616e24d32b
commit 7a2fd9a225
11 changed files with 183 additions and 16 deletions

View File

@@ -38,7 +38,7 @@ class AssignmentRulesMigrator implements Importable, Exportable
if ($replace) {
$this->processes->createTaskRows($data);
} else {
$this->processes->updateTaskRows($data);
$this->processes->addNewTaskRows($data);
}
} catch (\Exception $e) {

View File

@@ -29,7 +29,7 @@ class DBConnectionMigrator implements Importable, Exportable
if ($replace) {
$this->processes->createDBConnectionsRows($data);
} else {
$this->processes->updateDBConnectionsRows($data);
$this->processes->addNewDBConnectionsRows($data);
}
} catch (\Exception $e) {
\Logger::log($e->getMessage());

View File

@@ -29,7 +29,7 @@ class DynaformsMigrator implements Importable, Exportable
if ($replace) {
$this->processes->createDynaformRows($data);
} else {
$this->processes->updateDynaformRows($data);
$this->processes->addNewDynaformRows($data);
}
} catch (\Exception $e) {
\Logger::log($e->getMessage());

View File

@@ -2,8 +2,7 @@
namespace ProcessMaker\BusinessModel\Migrator;
use ProcessMaker\BusinessModel\Process;
use Symfony\Component\Config\Definition\Exception\Exception;
use ProcessMaker\BusinessModel\Util;
use \ProcessMaker\BusinessModel\Migrator\FileHandler;
class FilesMigrator implements Importable, Exportable
@@ -37,7 +36,7 @@ class FilesMigrator implements Importable, Exportable
if ($replace) {
$this->processes->createFilesManager($value['PRO_UID'], array($value));
} else {
$this->processes->updateFilesManager($value['PRO_UID'], array($value));
$this->processes->addNewFilesManager($value['PRO_UID'], array($value));
}
}
}
@@ -48,12 +47,18 @@ class FilesMigrator implements Importable, Exportable
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);
}
if (file_exists($filename)) {
if ($replace) {
file_put_contents($filename, $file["file_content"]);
}
} else {
file_put_contents($filename, $file["file_content"]);
}
file_put_contents($filename, $file["file_content"]);
@chmod($filename, 0775);
}
}

View File

@@ -29,7 +29,7 @@ class InputDocumentsMigrator implements Importable, Exportable
if ($replace) {
$this->processes->createInputRows($data);
} else {
$this->processes->updateInputRows($data);
$this->processes->addNewInputRows($data);
}
} catch (\Exception $e) {
\Logger::log($e->getMessage());

View File

@@ -31,7 +31,7 @@ class OutputDocumentsMigrator implements Importable, Exportable
if ($replace) {
$this->processes->createOutputRows($data);
} else {
$this->processes->updateOutputRows($data);
$this->processes->addNewOutputRows($data);
}
} catch (\Exception $e) {
\Logger::log($e->getMessage());

View File

@@ -30,7 +30,7 @@ class SupervisorsMigrator implements Importable, Exportable
if ($replace) {
$this->processes->createProcessUser($data);
} else {
$this->processes->updateProcessUser($data);
$this->processes->addNewProcessUser($data);
}
} catch (\Exception $e) {
\Logger::log($e->getMessage());

View File

@@ -2,7 +2,8 @@
namespace ProcessMaker\BusinessModel\Migrator;
use Symfony\Component\Config\Definition\Exception\Exception;
use ProcessMaker\BusinessModel\Util;
class TemplatesMigrator implements Importable, Exportable
{
@@ -35,7 +36,7 @@ class TemplatesMigrator implements Importable, Exportable
if ($replace) {
$this->processes->createFilesManager($value['PRO_UID'], array($value));
} else {
$this->processes->updateFilesManager($value['PRO_UID'], array($value));
$this->processes->addNewFilesManager($value['PRO_UID'], array($value));
}
}
}
@@ -51,7 +52,13 @@ class TemplatesMigrator implements Importable, Exportable
Util\Common::mk_dir($path, 0775);
}
file_put_contents($filename, $file["file_content"]);
if (file_exists($filename)) {
if ($replace) {
file_put_contents($filename, $file["file_content"]);
}
} else {
file_put_contents($filename, $file["file_content"]);
}
@chmod($filename, 0775);
}
}

View File

@@ -31,7 +31,7 @@ class TriggersMigrator implements Importable, Exportable
if ($replace) {
$this->processes->createTriggerRows($data);
} else {
$this->processes->updateTriggerRows($data);
$this->processes->addNewTriggerRows($data);
}
} catch (\Exception $e) {
\Logger::log($e->getMessage());