Merge remote-tracking branch 'origin/feature/HOR-3559' into feature/HOR-3629
This commit is contained in:
@@ -342,6 +342,22 @@ CLI::taskOpt("lang", "", "lLANG", "lang=LANG");
|
|||||||
CLI::taskArg('workspace');
|
CLI::taskArg('workspace');
|
||||||
CLI::taskRun("cliListIds");
|
CLI::taskRun("cliListIds");
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
CLI::taskName('regenerate-pmtable-classes');
|
||||||
|
CLI::taskDescription(<<<EOT
|
||||||
|
Regenerate the class with incorrect reference
|
||||||
|
|
||||||
|
This method recursively finds all PHP files that reference the path PATH_DATA
|
||||||
|
incorrectly, which is caused by importing processes where the data directory
|
||||||
|
of ProcessMaker has different routes. Modified files are backed up with the
|
||||||
|
extension '.backup' in the same directory.
|
||||||
|
EOT
|
||||||
|
);
|
||||||
|
CLI::taskArg('workspace');
|
||||||
|
CLI::taskRun("regenerate_pmtable_classes");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function run_info
|
* Function run_info
|
||||||
* access public
|
* access public
|
||||||
@@ -1114,3 +1130,30 @@ function run_migrate_plugin($args, $opts) {
|
|||||||
CLI::logging("<*> Migrating and populating data Singleton took " . ($stop - $start) . " seconds.\n");
|
CLI::logging("<*> Migrating and populating data Singleton took " . ($stop - $start) . " seconds.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* This method recursively finds all PHP files that reference the path PATH_DATA
|
||||||
|
* incorrectly, which is caused by importing processes where the data directory
|
||||||
|
* of ProcessMaker has different routes. Modified files are backed up with the
|
||||||
|
* extension '.backup' in the same directory.
|
||||||
|
*
|
||||||
|
* @param array $args
|
||||||
|
* @param array $opts
|
||||||
|
* @throws Exception
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function regenerate_pmtable_classes($args, $opts)
|
||||||
|
{
|
||||||
|
if (sizeof($args) > 0) {
|
||||||
|
$start = microtime(true);
|
||||||
|
CLI::logging("> Updating generated class files for PM Tables...\n");
|
||||||
|
|
||||||
|
Bootstrap::setConstantsRelatedWs($args[0]);
|
||||||
|
$workspaceTools = new workspaceTools($args[0]);
|
||||||
|
$workspaceTools->fixReferencePathFiles(PATH_DATA_SITE . "classes", PATH_DATA);
|
||||||
|
|
||||||
|
$stop = microtime(true);
|
||||||
|
CLI::logging("<*> Updating generated class files for PM Tables took " . ($stop - $start) . " seconds.\n");
|
||||||
|
} else {
|
||||||
|
throw new Exception("No workspace specified for updating generated class files.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -113,6 +113,17 @@ class PmTable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param string $adapter
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setDbConfigAdapter($adapter)
|
||||||
|
{
|
||||||
|
$this->dbConfig->adapter = $adapter;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backward compatibility function
|
* Backward compatibility function
|
||||||
* Resolve a propel data source
|
* Resolve a propel data source
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class ConsolidatedCases
|
|||||||
$RepTabUid = $data['rep_uid'];
|
$RepTabUid = $data['rep_uid'];
|
||||||
$TableName = $data['table_name'];
|
$TableName = $data['table_name'];
|
||||||
$Title = $data['title'];
|
$Title = $data['title'];
|
||||||
if($this->isUpdateFields($data) && $Status) {
|
if ($this->isUpdateFields($data) && $Status) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ($this->existTable && $Status) {
|
if ($this->existTable && $Status) {
|
||||||
@@ -26,7 +26,7 @@ class ConsolidatedCases
|
|||||||
|
|
||||||
if ($RepTabUid != '') {
|
if ($RepTabUid != '') {
|
||||||
$this->deleteRepTab($RepTabUid, $Status, $TasUid, $TableName);
|
$this->deleteRepTab($RepTabUid, $Status, $TasUid, $TableName);
|
||||||
if(!$Status){
|
if (!$Status) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$RepTabUid = '';
|
$RepTabUid = '';
|
||||||
@@ -174,7 +174,7 @@ class ConsolidatedCases
|
|||||||
if ($this->existTableName) {
|
if ($this->existTableName) {
|
||||||
$diff = array_diff($data, $this->rowRepTab);
|
$diff = array_diff($data, $this->rowRepTab);
|
||||||
}
|
}
|
||||||
if ($this->existCaseConsolidate){
|
if ($this->existCaseConsolidate) {
|
||||||
$diff = array_diff($diff, $this->rowCaseConsCore);
|
$diff = array_diff($diff, $this->rowCaseConsCore);
|
||||||
}
|
}
|
||||||
return count($diff) <= 0;
|
return count($diff) <= 0;
|
||||||
@@ -213,9 +213,40 @@ class ConsolidatedCases
|
|||||||
return $oReportTable->getRepTabUid();
|
return $oReportTable->getRepTabUid();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createReportVariables($RepTabUid, $ProUid, $formFields)
|
/**
|
||||||
|
* Create a record to 'ReportVar', this function uses the fields generated by
|
||||||
|
* the function 'buildReportVariables'.
|
||||||
|
*
|
||||||
|
* @param string $repTabUid
|
||||||
|
* @param string $proUid
|
||||||
|
* @param array $formFields
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function createReportVariables($repTabUid, $proUid, $formFields)
|
||||||
|
{
|
||||||
|
list($fieldsClass, $fields) = $this->buildReportVariables($formFields, function ($repVarName, $repVarType) use ($repTabUid, $proUid) {
|
||||||
|
$reportVar = new ReportVar();
|
||||||
|
$reportVar->create(array(
|
||||||
|
'REP_TAB_UID' => $repTabUid,
|
||||||
|
'PRO_UID' => $proUid,
|
||||||
|
'REP_VAR_NAME' => $repVarName,
|
||||||
|
'REP_VAR_TYPE' => $repVarType)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
return array($fieldsClass, $fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates the fields for 'Report Tables', the second parameter is a 'callback'
|
||||||
|
* that receives as arguments the name and type of the field.
|
||||||
|
*
|
||||||
|
* @param array $formFields
|
||||||
|
* @param function $callbackFunction
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function buildReportVariables($formFields, $callbackFunction = null)
|
||||||
{
|
{
|
||||||
$oReportVar = new ReportVar();
|
|
||||||
$fieldsClass = array();
|
$fieldsClass = array();
|
||||||
$fields = array();
|
$fields = array();
|
||||||
$i = 1;
|
$i = 1;
|
||||||
@@ -224,7 +255,7 @@ class ConsolidatedCases
|
|||||||
$fieldsClass[$i]['FLD_KEY'] = 'on';
|
$fieldsClass[$i]['FLD_KEY'] = 'on';
|
||||||
$fieldsClass[$i]['FLD_AUTO_INCREMENT'] = 'off';
|
$fieldsClass[$i]['FLD_AUTO_INCREMENT'] = 'off';
|
||||||
$fieldsClass[$i]['FLD_DESCRIPTION'] = '';
|
$fieldsClass[$i]['FLD_DESCRIPTION'] = '';
|
||||||
$fieldsClass[$i]['FLD_TYPE'] = 'VARCHAR' ;
|
$fieldsClass[$i]['FLD_TYPE'] = 'VARCHAR';
|
||||||
$fieldsClass[$i]['FLD_SIZE'] = 32;
|
$fieldsClass[$i]['FLD_SIZE'] = 32;
|
||||||
$i++;
|
$i++;
|
||||||
$fieldsClass[$i]['FLD_NAME'] = 'APP_NUMBER';
|
$fieldsClass[$i]['FLD_NAME'] = 'APP_NUMBER';
|
||||||
@@ -232,26 +263,26 @@ class ConsolidatedCases
|
|||||||
$fieldsClass[$i]['FLD_KEY'] = 'on';
|
$fieldsClass[$i]['FLD_KEY'] = 'on';
|
||||||
$fieldsClass[$i]['FLD_AUTO_INCREMENT'] = 'off';
|
$fieldsClass[$i]['FLD_AUTO_INCREMENT'] = 'off';
|
||||||
$fieldsClass[$i]['FLD_DESCRIPTION'] = '';
|
$fieldsClass[$i]['FLD_DESCRIPTION'] = '';
|
||||||
$fieldsClass[$i]['FLD_TYPE'] = 'VARCHAR' ;
|
$fieldsClass[$i]['FLD_TYPE'] = 'VARCHAR';
|
||||||
$fieldsClass[$i]['FLD_SIZE'] = 255;
|
$fieldsClass[$i]['FLD_SIZE'] = 255;
|
||||||
|
|
||||||
foreach ($formFields as $sField) {
|
foreach ($formFields as $field) {
|
||||||
$aField = explode('-', $sField);
|
$fieldProperty = explode('-', $field);
|
||||||
if ($aField[1] == 'title' || $aField[1] == 'submit') {
|
if ($fieldProperty[1] == 'title' || $fieldProperty[1] == 'submit') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
$fieldsClass[$i]['FLD_NAME'] = $aField[0];
|
$fieldsClass[$i]['FLD_NAME'] = $fieldProperty[0];
|
||||||
$fieldsClass[$i]['FLD_NULL'] = 'off';
|
$fieldsClass[$i]['FLD_NULL'] = 'off';
|
||||||
$fieldsClass[$i]['FLD_KEY'] = 'off';
|
$fieldsClass[$i]['FLD_KEY'] = 'off';
|
||||||
$fieldsClass[$i]['FLD_AUTO_INCREMENT'] = 'off';
|
$fieldsClass[$i]['FLD_AUTO_INCREMENT'] = 'off';
|
||||||
$fieldsClass[$i]['FLD_DESCRIPTION'] = '';
|
$fieldsClass[$i]['FLD_DESCRIPTION'] = '';
|
||||||
|
|
||||||
switch ($aField[1]) {
|
switch ($fieldProperty[1]) {
|
||||||
case 'currency':
|
case 'currency':
|
||||||
case 'percentage':
|
case 'percentage':
|
||||||
$sType = 'number';
|
$type = 'number';
|
||||||
$fieldsClass[$i]['FLD_TYPE'] = 'FLOAT' ;
|
$fieldsClass[$i]['FLD_TYPE'] = 'FLOAT';
|
||||||
$fieldsClass[$i]['FLD_SIZE'] = 255;
|
$fieldsClass[$i]['FLD_SIZE'] = 255;
|
||||||
break;
|
break;
|
||||||
case 'text':
|
case 'text':
|
||||||
@@ -262,34 +293,32 @@ class ConsolidatedCases
|
|||||||
case 'radiogroup':
|
case 'radiogroup':
|
||||||
case 'hidden':
|
case 'hidden':
|
||||||
case "link":
|
case "link":
|
||||||
$sType = 'char';
|
$type = 'char';
|
||||||
$fieldsClass[$i]['FLD_TYPE'] = 'VARCHAR' ;
|
$fieldsClass[$i]['FLD_TYPE'] = 'VARCHAR';
|
||||||
$fieldsClass[$i]['FLD_SIZE'] = 255;
|
$fieldsClass[$i]['FLD_SIZE'] = 255;
|
||||||
break;
|
break;
|
||||||
case 'textarea':
|
case 'textarea':
|
||||||
$sType = 'text';
|
$type = 'text';
|
||||||
$fieldsClass[$i]['FLD_TYPE'] = 'TEXT' ;
|
$fieldsClass[$i]['FLD_TYPE'] = 'TEXT';
|
||||||
$fieldsClass[$i]['FLD_SIZE'] = '';
|
$fieldsClass[$i]['FLD_SIZE'] = '';
|
||||||
break;
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
$sType = 'date';
|
$type = 'date';
|
||||||
$fieldsClass[$i]['FLD_TYPE'] = 'DATE' ;
|
$fieldsClass[$i]['FLD_TYPE'] = 'DATE';
|
||||||
$fieldsClass[$i]['FLD_SIZE'] = '';
|
$fieldsClass[$i]['FLD_SIZE'] = '';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$sType = 'char';
|
$type = 'char';
|
||||||
$fieldsClass[$i]['FLD_TYPE'] = 'VARCHAR' ;
|
$fieldsClass[$i]['FLD_TYPE'] = 'VARCHAR';
|
||||||
$fieldsClass[$i]['FLD_SIZE'] = 255;
|
$fieldsClass[$i]['FLD_SIZE'] = 255;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oReportVar->create(array(
|
if (!empty($callbackFunction) && is_callable($callbackFunction)) {
|
||||||
'REP_TAB_UID' => $RepTabUid,
|
$callbackFunction($fieldProperty[0], $type);
|
||||||
'PRO_UID' => $ProUid,
|
}
|
||||||
'REP_VAR_NAME' => $aField[0],
|
|
||||||
'REP_VAR_TYPE' => $sType)
|
$fields[] = array('sFieldName' => $fieldProperty[0], 'sType' => $type);
|
||||||
);
|
|
||||||
$fields[] = array('sFieldName' => $aField[0], 'sType' => $sType);
|
|
||||||
}
|
}
|
||||||
return array($fieldsClass, $fields);
|
return array($fieldsClass, $fields);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
use ProcessMaker\Util\FixReferencePath;
|
||||||
* Utility functions to manage a workspace.
|
|
||||||
*
|
|
||||||
* @author Alexandre Rosenfeld
|
|
||||||
*/
|
|
||||||
|
|
||||||
use ProcessMaker\Plugins\Adapters\PluginAdapter;
|
use ProcessMaker\Plugins\Adapters\PluginAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class workspaceTools
|
* class workspaceTools.
|
||||||
|
*
|
||||||
|
* Utility functions to manage a workspace.
|
||||||
*
|
*
|
||||||
* @package workflow.engine.classes
|
* @package workflow.engine.classes
|
||||||
*/
|
*/
|
||||||
@@ -712,7 +709,7 @@ class workspaceTools
|
|||||||
$res = $appCache->fillAppCacheView($lang);
|
$res = $appCache->fillAppCacheView($lang);
|
||||||
}
|
}
|
||||||
//set status in config table
|
//set status in config table
|
||||||
$confParams = Array('LANG' => $lang, 'STATUS' => 'active');
|
$confParams = array('LANG' => $lang, 'STATUS' => 'active');
|
||||||
$oConf->aConfig = $confParams;
|
$oConf->aConfig = $confParams;
|
||||||
$oConf->saveConfig('APP_CACHE_VIEW_ENGINE', '', '', '');
|
$oConf->saveConfig('APP_CACHE_VIEW_ENGINE', '', '', '');
|
||||||
|
|
||||||
@@ -868,7 +865,7 @@ class workspaceTools
|
|||||||
p11835::isApplicable();
|
p11835::isApplicable();
|
||||||
$systemSchema = PmSystem::getSystemSchema($this->dbAdapter);
|
$systemSchema = PmSystem::getSystemSchema($this->dbAdapter);
|
||||||
$systemSchemaRbac = PmSystem::getSystemSchemaRbac($this->dbAdapter);// get the Rbac Schema
|
$systemSchemaRbac = PmSystem::getSystemSchemaRbac($this->dbAdapter);// get the Rbac Schema
|
||||||
$this->registerSystemTables(array_merge($systemSchema,$systemSchemaRbac));
|
$this->registerSystemTables(array_merge($systemSchema, $systemSchemaRbac));
|
||||||
$this->upgradeSchema($systemSchema);
|
$this->upgradeSchema($systemSchema);
|
||||||
$this->upgradeSchema($systemSchemaRbac, false, true, $onedb); // perform Upgrade to Rbac
|
$this->upgradeSchema($systemSchemaRbac, false, true, $onedb); // perform Upgrade to Rbac
|
||||||
$this->upgradeData();
|
$this->upgradeData();
|
||||||
@@ -989,7 +986,7 @@ class workspaceTools
|
|||||||
$oDataBase = $this->getDatabase($rbac);
|
$oDataBase = $this->getDatabase($rbac);
|
||||||
|
|
||||||
if (!$onedb) {
|
if (!$onedb) {
|
||||||
if($rbac){
|
if ($rbac) {
|
||||||
$rename = PmSystem::verifyRbacSchema($workspaceSchema);
|
$rename = PmSystem::verifyRbacSchema($workspaceSchema);
|
||||||
if (count($rename) > 0) {
|
if (count($rename) > 0) {
|
||||||
foreach ($rename as $tableName) {
|
foreach ($rename as $tableName) {
|
||||||
@@ -1142,7 +1139,6 @@ class workspaceTools
|
|||||||
$Fields['WORKSPACE_NAME'] = $this->name;
|
$Fields['WORKSPACE_NAME'] = $this->name;
|
||||||
|
|
||||||
if (isset($this->dbHost)) {
|
if (isset($this->dbHost)) {
|
||||||
|
|
||||||
$dbNetView = new NET($this->dbHost);
|
$dbNetView = new NET($this->dbHost);
|
||||||
$dbNetView->loginDbServer($this->dbUser, $this->dbPass);
|
$dbNetView->loginDbServer($this->dbUser, $this->dbPass);
|
||||||
try {
|
try {
|
||||||
@@ -1253,7 +1249,7 @@ class workspaceTools
|
|||||||
|
|
||||||
if ($onedb) {
|
if ($onedb) {
|
||||||
$databases = array("rb", "rp");
|
$databases = array("rb", "rp");
|
||||||
} else if ($dbInfo['DB_NAME'] == $dbInfo['DB_RBAC_NAME']) {
|
} elseif ($dbInfo['DB_NAME'] == $dbInfo['DB_RBAC_NAME']) {
|
||||||
$databases = array("wf");
|
$databases = array("wf");
|
||||||
} else {
|
} else {
|
||||||
$databases = array("wf", "rp", "rb");
|
$databases = array("wf", "rp", "rb");
|
||||||
@@ -1296,9 +1292,8 @@ class workspaceTools
|
|||||||
* @param string $filename the backup filename
|
* @param string $filename the backup filename
|
||||||
* @param bool $compress wheter to compress or not
|
* @param bool $compress wheter to compress or not
|
||||||
*/
|
*/
|
||||||
static public function createBackup($filename, $compress = true)
|
public static function createBackup($filename, $compress = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!file_exists(dirname($filename))) {
|
if (!file_exists(dirname($filename))) {
|
||||||
mkdir(dirname($filename));
|
mkdir(dirname($filename));
|
||||||
}
|
}
|
||||||
@@ -1442,10 +1437,10 @@ class workspaceTools
|
|||||||
|
|
||||||
if (!$flag && !is_null($flagFunction)) {
|
if (!$flag && !is_null($flagFunction)) {
|
||||||
//Replace TYPE by ENGINE
|
//Replace TYPE by ENGINE
|
||||||
if( $versionBackupEngine == 1) {
|
if ($versionBackupEngine == 1) {
|
||||||
$script = preg_replace($arrayRegExpEngineSearch, $arrayRegExpEngineReplace, file_get_contents($filename));
|
$script = preg_replace($arrayRegExpEngineSearch, $arrayRegExpEngineReplace, file_get_contents($filename));
|
||||||
file_put_contents($filename, $script."\nCOMMIT;");
|
file_put_contents($filename, $script."\nCOMMIT;");
|
||||||
}else{
|
} else {
|
||||||
$arrayRegExpEngineSearch = array("/\)\s*TYPE\s*=\s*(InnoDB)/i", "/\)\s*TYPE\s*=\s*(MyISAM)/i");
|
$arrayRegExpEngineSearch = array("/\)\s*TYPE\s*=\s*(InnoDB)/i", "/\)\s*TYPE\s*=\s*(MyISAM)/i");
|
||||||
$arrayRegExpEngineReplace = array(") ENGINE=\\1 DEFAULT CHARSET=utf8", ") ENGINE=\\1");
|
$arrayRegExpEngineReplace = array(") ENGINE=\\1 DEFAULT CHARSET=utf8", ") ENGINE=\\1");
|
||||||
$script = preg_replace($arrayRegExpEngineSearch, $arrayRegExpEngineReplace, file_get_contents($filename));
|
$script = preg_replace($arrayRegExpEngineSearch, $arrayRegExpEngineReplace, file_get_contents($filename));
|
||||||
@@ -1481,7 +1476,7 @@ class workspaceTools
|
|||||||
|
|
||||||
//Replace TYPE by ENGINE
|
//Replace TYPE by ENGINE
|
||||||
$script = preg_replace($arrayRegExpEngineSearch, $arrayRegExpEngineReplace, file_get_contents($filename));
|
$script = preg_replace($arrayRegExpEngineSearch, $arrayRegExpEngineReplace, file_get_contents($filename));
|
||||||
if( $versionBackupEngine == 1) {
|
if ($versionBackupEngine == 1) {
|
||||||
$script = $script."\nCOMMIT;";
|
$script = $script."\nCOMMIT;";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1546,14 +1541,13 @@ class workspaceTools
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function restoreLegacy($directory)
|
public static function restoreLegacy($directory)
|
||||||
{
|
{
|
||||||
throw new Exception("Use gulliver to restore backups from old versions");
|
throw new Exception("Use gulliver to restore backups from old versions");
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function getBackupInfo($filename)
|
public static function getBackupInfo($filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
$backup = new Archive_Tar($filename);
|
$backup = new Archive_Tar($filename);
|
||||||
//Get a temporary directory in the upgrade directory
|
//Get a temporary directory in the upgrade directory
|
||||||
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
|
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
|
||||||
@@ -1581,7 +1575,7 @@ class workspaceTools
|
|||||||
G::rm_dir($tempDirectory);
|
G::rm_dir($tempDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function dirPerms($filename, $owner, $group, $perms)
|
public static function dirPerms($filename, $owner, $group, $perms)
|
||||||
{
|
{
|
||||||
$chown = @chown($filename, $owner);
|
$chown = @chown($filename, $owner);
|
||||||
$chgrp = @chgrp($filename, $group);
|
$chgrp = @chgrp($filename, $group);
|
||||||
@@ -1617,9 +1611,8 @@ class workspaceTools
|
|||||||
* @param string $lang for define the language
|
* @param string $lang for define the language
|
||||||
* @param string $port of database if is empty take 3306
|
* @param string $port of database if is empty take 3306
|
||||||
*/
|
*/
|
||||||
static public function restore($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true, $lang = 'en', $port = '')
|
public static function restore($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true, $lang = 'en', $port = '')
|
||||||
{
|
{
|
||||||
|
|
||||||
$backup = new Archive_Tar($filename);
|
$backup = new Archive_Tar($filename);
|
||||||
//Get a temporary directory in the upgrade directory
|
//Get a temporary directory in the upgrade directory
|
||||||
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
|
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
|
||||||
@@ -1731,7 +1724,7 @@ class workspaceTools
|
|||||||
} else {
|
} else {
|
||||||
CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
|
CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
|
||||||
}
|
}
|
||||||
list ($dbHost, $dbUser, $dbPass) = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
|
list($dbHost, $dbUser, $dbPass) = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
|
||||||
if ($port != '') {
|
if ($port != '') {
|
||||||
$dbHost = $dbHost . $port; //127.0.0.1:3306
|
$dbHost = $dbHost . $port; //127.0.0.1:3306
|
||||||
}
|
}
|
||||||
@@ -1764,7 +1757,7 @@ class workspaceTools
|
|||||||
foreach ($metadata->databases as $db) {
|
foreach ($metadata->databases as $db) {
|
||||||
if ($dbName != $newDBNames[$db->name]) {
|
if ($dbName != $newDBNames[$db->name]) {
|
||||||
$dbName = $dbUser = $newDBNames[$db->name];
|
$dbName = $dbUser = $newDBNames[$db->name];
|
||||||
if(isset($newDBNames['DB_USER'])){
|
if (isset($newDBNames['DB_USER'])) {
|
||||||
$dbUser = $newDBNames['DB_USER'];
|
$dbUser = $newDBNames['DB_USER'];
|
||||||
}
|
}
|
||||||
if (mysql_select_db($dbName, $link)) {
|
if (mysql_select_db($dbName, $link)) {
|
||||||
@@ -1854,6 +1847,12 @@ class workspaceTools
|
|||||||
$stop = microtime(true);
|
$stop = microtime(true);
|
||||||
CLI::logging("<*> Migrating an populating indexing for APP_CACHE_VIEW process took " . ($stop - $start) . " seconds.\n");
|
CLI::logging("<*> Migrating an populating indexing for APP_CACHE_VIEW process took " . ($stop - $start) . " seconds.\n");
|
||||||
|
|
||||||
|
$start = microtime(true);
|
||||||
|
CLI::logging("> Updating generated class files for PM Tables...\n");
|
||||||
|
self::fixReferencePathFiles(PATH_DATA_SITE . "classes", PATH_DATA);
|
||||||
|
$stop = microtime(true);
|
||||||
|
CLI::logging("<*> Updating generated class files for PM Tables took " . ($stop - $start) . " seconds.\n");
|
||||||
|
|
||||||
mysql_close($link);
|
mysql_close($link);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1928,7 +1927,8 @@ class workspaceTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkMafeRequirements ($workspace,$lang) {
|
public function checkMafeRequirements($workspace, $lang)
|
||||||
|
{
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
$pmRestClient = OauthClientsPeer::retrieveByPK('x-pm-local-client');
|
$pmRestClient = OauthClientsPeer::retrieveByPK('x-pm-local-client');
|
||||||
if (empty($pmRestClient)) {
|
if (empty($pmRestClient)) {
|
||||||
@@ -1945,7 +1945,7 @@ class workspaceTools
|
|||||||
|
|
||||||
$envFile = PATH_CONFIG . 'env.ini';
|
$envFile = PATH_CONFIG . 'env.ini';
|
||||||
$skin ='neoclassic';
|
$skin ='neoclassic';
|
||||||
if (file_exists($envFile) ) {
|
if (file_exists($envFile)) {
|
||||||
$sysConf = PmSystem::getSystemConfiguration($envFile);
|
$sysConf = PmSystem::getSystemConfiguration($envFile);
|
||||||
$lang = $sysConf['default_lang'];
|
$lang = $sysConf['default_lang'];
|
||||||
$skin = $sysConf['default_skin'];
|
$skin = $sysConf['default_skin'];
|
||||||
@@ -1973,9 +1973,9 @@ class workspaceTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function changeHashPassword ($workspace, $response)
|
public function changeHashPassword($workspace, $response)
|
||||||
{
|
{
|
||||||
$this->initPropel( true );
|
$this->initPropel(true);
|
||||||
$licensedFeatures = & PMLicensedFeatures::getSingleton();
|
$licensedFeatures = & PMLicensedFeatures::getSingleton();
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
if ($licensedFeatures->verifyfeature('95OY24wcXpEMzIyRmlNSnF0STNFSHJzMG9wYTJKekpLNmY2ZmRCeGtuZk5oUDloaUNhUGVjTDJBPT0=')) {
|
if ($licensedFeatures->verifyfeature('95OY24wcXpEMzIyRmlNSnF0STNFSHJzMG9wYTJKekpLNmY2ZmRCeGtuZk5oUDloaUNhUGVjTDJBPT0=')) {
|
||||||
@@ -1987,9 +1987,9 @@ class workspaceTools
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verifyFilesOldEnterprise ($workspace)
|
public function verifyFilesOldEnterprise($workspace)
|
||||||
{
|
{
|
||||||
$this->initPropel( true );
|
$this->initPropel(true);
|
||||||
$pathBackup = PATH_DATA . 'backups';
|
$pathBackup = PATH_DATA . 'backups';
|
||||||
if (!file_exists($pathBackup)) {
|
if (!file_exists($pathBackup)) {
|
||||||
G::mk_dir($pathBackup, 0777);
|
G::mk_dir($pathBackup, 0777);
|
||||||
@@ -2034,7 +2034,7 @@ class workspaceTools
|
|||||||
CLI::logging(CLI::error("Could not get shared folder permissions, workspace permissions couldn't be changed") . "\n");
|
CLI::logging(CLI::error("Could not get shared folder permissions, workspace permissions couldn't be changed") . "\n");
|
||||||
}
|
}
|
||||||
CLI::logging(" Removing $pathFileEnterprise...\n");
|
CLI::logging(" Removing $pathFileEnterprise...\n");
|
||||||
copy($pathFileEnterprise , $pathNewFile. PATH_SEP . 'enterprise.php');
|
copy($pathFileEnterprise, $pathNewFile. PATH_SEP . 'enterprise.php');
|
||||||
G::rm_dir($pathFileEnterprise);
|
G::rm_dir($pathFileEnterprise);
|
||||||
if (file_exists($pathFileEnterprise)) {
|
if (file_exists($pathFileEnterprise)) {
|
||||||
CLI::logging(CLI::info(" Remove manually $pathFileEnterprise...\n"));
|
CLI::logging(CLI::info(" Remove manually $pathFileEnterprise...\n"));
|
||||||
@@ -2227,7 +2227,8 @@ class workspaceTools
|
|||||||
CLI::logging("> Completed table LIST_CANCELED\n");
|
CLI::logging("> Completed table LIST_CANCELED\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function regenerateListCompleted($lang = 'en'){
|
public function regenerateListCompleted($lang = 'en')
|
||||||
|
{
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
$query = 'INSERT INTO '.$this->dbName.'.LIST_COMPLETED
|
$query = 'INSERT INTO '.$this->dbName.'.LIST_COMPLETED
|
||||||
(APP_UID,
|
(APP_UID,
|
||||||
@@ -2289,7 +2290,8 @@ class workspaceTools
|
|||||||
CLI::logging("> Completed table LIST_COMPLETED\n");
|
CLI::logging("> Completed table LIST_COMPLETED\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function regenerateListMyInbox(){
|
public function regenerateListMyInbox()
|
||||||
|
{
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
$query = 'INSERT INTO '.$this->dbName.'.LIST_MY_INBOX
|
$query = 'INSERT INTO '.$this->dbName.'.LIST_MY_INBOX
|
||||||
(APP_UID,
|
(APP_UID,
|
||||||
@@ -2358,7 +2360,8 @@ class workspaceTools
|
|||||||
CLI::logging("> Completed table LIST_MY_INBOX\n");
|
CLI::logging("> Completed table LIST_MY_INBOX\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function regenerateListInbox(){
|
public function regenerateListInbox()
|
||||||
|
{
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
$query = 'INSERT INTO '.$this->dbName.'.LIST_INBOX
|
$query = 'INSERT INTO '.$this->dbName.'.LIST_INBOX
|
||||||
(APP_UID,
|
(APP_UID,
|
||||||
@@ -2415,7 +2418,8 @@ class workspaceTools
|
|||||||
CLI::logging("> Completed table LIST_INBOX\n");
|
CLI::logging("> Completed table LIST_INBOX\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function regenerateListParticipatedHistory(){
|
public function regenerateListParticipatedHistory()
|
||||||
|
{
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
$query = 'INSERT INTO '.$this->dbName.'.LIST_PARTICIPATED_HISTORY
|
$query = 'INSERT INTO '.$this->dbName.'.LIST_PARTICIPATED_HISTORY
|
||||||
(APP_UID,
|
(APP_UID,
|
||||||
@@ -2589,7 +2593,8 @@ class workspaceTools
|
|||||||
* For the labels we use the tables user, process, task and application
|
* For the labels we use the tables user, process, task and application
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function regenerateListPaused(){
|
public function regenerateListPaused()
|
||||||
|
{
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
$query = 'INSERT INTO '.$this->dbName.'.LIST_PAUSED
|
$query = 'INSERT INTO '.$this->dbName.'.LIST_PAUSED
|
||||||
(
|
(
|
||||||
@@ -2672,7 +2677,8 @@ class workspaceTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
public function regenerateListUnassigned(){
|
public function regenerateListUnassigned()
|
||||||
|
{
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
$truncate = 'TRUNCATE '.$this->dbName.'.LIST_UNASSIGNED';
|
$truncate = 'TRUNCATE '.$this->dbName.'.LIST_UNASSIGNED';
|
||||||
//This executeQuery is very fast than Propel
|
//This executeQuery is very fast than Propel
|
||||||
@@ -2731,12 +2737,13 @@ class workspaceTools
|
|||||||
*
|
*
|
||||||
* return boolean value
|
* return boolean value
|
||||||
*/
|
*/
|
||||||
public function listFirstExecution ($action, $list='all'){
|
public function listFirstExecution($action, $list='all')
|
||||||
|
{
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'insert':
|
case 'insert':
|
||||||
$conf = new Configuration();
|
$conf = new Configuration();
|
||||||
if($list==='all'){
|
if ($list==='all') {
|
||||||
if (!($conf->exists('MIGRATED_LIST', 'list', 'list', 'list', 'list'))) {
|
if (!($conf->exists('MIGRATED_LIST', 'list', 'list', 'list', 'list'))) {
|
||||||
$data["CFG_UID"] ='MIGRATED_LIST';
|
$data["CFG_UID"] ='MIGRATED_LIST';
|
||||||
$data["OBJ_UID"] ='list';
|
$data["OBJ_UID"] ='list';
|
||||||
@@ -2747,7 +2754,7 @@ class workspaceTools
|
|||||||
$conf->create($data);
|
$conf->create($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($list==='unassigned'){
|
if ($list==='unassigned') {
|
||||||
if (!($conf->exists('MIGRATED_LIST_UNASSIGNED', 'list', 'list', 'list', 'list'))) {
|
if (!($conf->exists('MIGRATED_LIST_UNASSIGNED', 'list', 'list', 'list', 'list'))) {
|
||||||
$data["CFG_UID"] ='MIGRATED_LIST_UNASSIGNED';
|
$data["CFG_UID"] ='MIGRATED_LIST_UNASSIGNED';
|
||||||
$data["OBJ_UID"] ='list';
|
$data["OBJ_UID"] ='list';
|
||||||
@@ -2763,19 +2770,19 @@ class workspaceTools
|
|||||||
case 'check':
|
case 'check':
|
||||||
$criteria = new Criteria("workflow");
|
$criteria = new Criteria("workflow");
|
||||||
$criteria->addSelectColumn(ConfigurationPeer::CFG_UID);
|
$criteria->addSelectColumn(ConfigurationPeer::CFG_UID);
|
||||||
if($list==='all'){
|
if ($list==='all') {
|
||||||
$criteria->add(ConfigurationPeer::CFG_UID, "MIGRATED_LIST", CRITERIA::EQUAL);
|
$criteria->add(ConfigurationPeer::CFG_UID, "MIGRATED_LIST", CRITERIA::EQUAL);
|
||||||
}
|
}
|
||||||
if($list==='unassigned'){
|
if ($list==='unassigned') {
|
||||||
$criteria->add(ConfigurationPeer::CFG_UID, "MIGRATED_LIST_UNASSIGNED", CRITERIA::EQUAL);
|
$criteria->add(ConfigurationPeer::CFG_UID, "MIGRATED_LIST_UNASSIGNED", CRITERIA::EQUAL);
|
||||||
}
|
}
|
||||||
$rsCriteria = AppCacheViewPeer::doSelectRS($criteria);
|
$rsCriteria = AppCacheViewPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$aRows = array ();
|
$aRows = array();
|
||||||
while ($rsCriteria->next()) {
|
while ($rsCriteria->next()) {
|
||||||
$aRows[] = $rsCriteria->getRow();
|
$aRows[] = $rsCriteria->getRow();
|
||||||
}
|
}
|
||||||
if(empty($aRows)){
|
if (empty($aRows)) {
|
||||||
return false; //If is false continue with the migrated
|
return false; //If is false continue with the migrated
|
||||||
} else {
|
} else {
|
||||||
return true; //Stop
|
return true; //Stop
|
||||||
@@ -2840,7 +2847,8 @@ class workspaceTools
|
|||||||
*
|
*
|
||||||
* return void
|
* return void
|
||||||
*/
|
*/
|
||||||
public static function registerSystemTables($aSquema){
|
public static function registerSystemTables($aSquema)
|
||||||
|
{
|
||||||
//Register all tables
|
//Register all tables
|
||||||
$sListTables = '';
|
$sListTables = '';
|
||||||
foreach ($aSquema as $key => $value) {
|
foreach ($aSquema as $key => $value) {
|
||||||
@@ -2848,16 +2856,17 @@ class workspaceTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sysTablesIniFile= PATH_CONFIG . 'system-tables.ini';
|
$sysTablesIniFile= PATH_CONFIG . 'system-tables.ini';
|
||||||
$contents = file_put_contents( $sysTablesIniFile, sprintf( "%s '%s'\n", "tables = ", $sListTables ) );
|
$contents = file_put_contents($sysTablesIniFile, sprintf("%s '%s'\n", "tables = ", $sListTables));
|
||||||
if ($contents === null) {
|
if ($contents === null) {
|
||||||
throw (new Exception( G::LoadTranslation('ID_FILE_NOT_WRITEABLE', SYS_LANG, array($sysTablesIniFile) ) ));
|
throw (new Exception(G::LoadTranslation('ID_FILE_NOT_WRITEABLE', SYS_LANG, array($sysTablesIniFile))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*return void
|
*return void
|
||||||
*/
|
*/
|
||||||
public function checkRbacPermissions(){
|
public function checkRbacPermissions()
|
||||||
|
{
|
||||||
CLI::logging("-> Verifying roles permissions in RBAC \n");
|
CLI::logging("-> Verifying roles permissions in RBAC \n");
|
||||||
//Update table RBAC permissions
|
//Update table RBAC permissions
|
||||||
$RBAC = &RBAC::getSingleton();
|
$RBAC = &RBAC::getSingleton();
|
||||||
@@ -3129,7 +3138,6 @@ class workspaceTools
|
|||||||
PATH_DATA."/post-missing-inbox-".$this->name.".txt",
|
PATH_DATA."/post-missing-inbox-".$this->name.".txt",
|
||||||
"[".$item['APP_UID']."] has not been found"
|
"[".$item['APP_UID']."] has not been found"
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CLI::logging("> Number of missing inbox cases for workspace " . CLI::info($this->name) . ": " . CLI::info($counter) . "\n");
|
CLI::logging("> Number of missing inbox cases for workspace " . CLI::info($this->name) . ": " . CLI::info($counter) . "\n");
|
||||||
@@ -3276,7 +3284,7 @@ class workspaceTools
|
|||||||
|
|
||||||
public function verifyListData($type)
|
public function verifyListData($type)
|
||||||
{
|
{
|
||||||
switch($type) {
|
switch ($type) {
|
||||||
case 'LIST_CANCELLED':
|
case 'LIST_CANCELLED':
|
||||||
$response = $this->verifyMissingCancelled();
|
$response = $this->verifyMissingCancelled();
|
||||||
break;
|
break;
|
||||||
@@ -3325,7 +3333,7 @@ class workspaceTools
|
|||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
$conf = new Configuration();
|
$conf = new Configuration();
|
||||||
$blackList = array();
|
$blackList = array();
|
||||||
if($bExist = $conf->exists('MIGRATED_CONTENT', 'content')){
|
if ($bExist = $conf->exists('MIGRATED_CONTENT', 'content')) {
|
||||||
$oConfig = $conf->load('MIGRATED_CONTENT', 'content');
|
$oConfig = $conf->load('MIGRATED_CONTENT', 'content');
|
||||||
$blackList = $oConfig['CFG_VALUE'] == 'true' ? array('Groupwf', 'Process', 'Department', 'Task', 'InputDocument', 'Application') : unserialize($oConfig['CFG_VALUE']);
|
$blackList = $oConfig['CFG_VALUE'] == 'true' ? array('Groupwf', 'Process', 'Department', 'Task', 'InputDocument', 'Application') : unserialize($oConfig['CFG_VALUE']);
|
||||||
}
|
}
|
||||||
@@ -3374,14 +3382,14 @@ class workspaceTools
|
|||||||
$oTable = new $className();
|
$oTable = new $className();
|
||||||
$that = array($oTable, $methods['exists']);
|
$that = array($oTable, $methods['exists']);
|
||||||
$params = array($row[$fieldUidName]);
|
$params = array($row[$fieldUidName]);
|
||||||
if (isset($row['CON_PARENT']) && $row['CON_PARENT'] != ''){
|
if (isset($row['CON_PARENT']) && $row['CON_PARENT'] != '') {
|
||||||
array_push($params, $row['CON_PARENT']);
|
array_push($params, $row['CON_PARENT']);
|
||||||
$fieldName = isset($fields['alias']) && isset($fields['alias']['CON_PARENT']) ? $fields['alias']['CON_PARENT'] : 'CON_PARENT';
|
$fieldName = isset($fields['alias']) && isset($fields['alias']['CON_PARENT']) ? $fields['alias']['CON_PARENT'] : 'CON_PARENT';
|
||||||
$row[$fieldName] = $row['CON_PARENT'];
|
$row[$fieldName] = $row['CON_PARENT'];
|
||||||
}
|
}
|
||||||
unset($row['CON_PARENT']);
|
unset($row['CON_PARENT']);
|
||||||
if (call_user_func_array($that, $params)){
|
if (call_user_func_array($that, $params)) {
|
||||||
if (isset($methods['update'])){
|
if (isset($methods['update'])) {
|
||||||
$fn = $methods['update'];
|
$fn = $methods['update'];
|
||||||
$fn($row);
|
$fn($row);
|
||||||
} else {
|
} else {
|
||||||
@@ -3508,7 +3516,8 @@ class workspaceTools
|
|||||||
CLI::logging("|--> Clean data in table " . OauthRefreshTokensPeer::TABLE_NAME . " rows ".$refreshToken."\n");
|
CLI::logging("|--> Clean data in table " . OauthRefreshTokensPeer::TABLE_NAME . " rows ".$refreshToken."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function migrateIteeToDummytask($workspaceName){
|
public function migrateIteeToDummytask($workspaceName)
|
||||||
|
{
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
$arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', $workspaceName);
|
$arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', $workspaceName);
|
||||||
$conf = new Configurations();
|
$conf = new Configurations();
|
||||||
@@ -3531,8 +3540,8 @@ class workspaceTools
|
|||||||
|
|
||||||
//Search All process
|
//Search All process
|
||||||
$oCriteria = new Criteria("workflow");
|
$oCriteria = new Criteria("workflow");
|
||||||
$oCriteria->addSelectColumn( ProcessPeer::PRO_UID );
|
$oCriteria->addSelectColumn(ProcessPeer::PRO_UID);
|
||||||
$oCriteria->addSelectColumn( ProcessPeer::PRO_ITEE );
|
$oCriteria->addSelectColumn(ProcessPeer::PRO_ITEE);
|
||||||
$oCriteria->add(ProcessPeer::PRO_ITEE, '0', Criteria::EQUAL);
|
$oCriteria->add(ProcessPeer::PRO_ITEE, '0', Criteria::EQUAL);
|
||||||
$rsCriteria = ProcessPeer::doSelectRS($oCriteria);
|
$rsCriteria = ProcessPeer::doSelectRS($oCriteria);
|
||||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
@@ -3542,7 +3551,7 @@ class workspaceTools
|
|||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
$prj_uid = $row['PRO_UID'];
|
$prj_uid = $row['PRO_UID'];
|
||||||
$bpmnProcess = new Process();
|
$bpmnProcess = new Process();
|
||||||
if($bpmnProcess->isBpmnProcess($prj_uid)){
|
if ($bpmnProcess->isBpmnProcess($prj_uid)) {
|
||||||
$project = new \ProcessMaker\Project\Adapter\BpmnWorkflow();
|
$project = new \ProcessMaker\Project\Adapter\BpmnWorkflow();
|
||||||
$diagram = $project->getStruct($prj_uid);
|
$diagram = $project->getStruct($prj_uid);
|
||||||
$res = $project->updateFromStruct($prj_uid, $diagram);
|
$res = $project->updateFromStruct($prj_uid, $diagram);
|
||||||
@@ -3568,9 +3577,10 @@ class workspaceTools
|
|||||||
$conf->saveConfig('SKIN_CRON', '');
|
$conf->saveConfig('SKIN_CRON', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function upgradeAuditLog($workspace){
|
public function upgradeAuditLog($workspace)
|
||||||
|
{
|
||||||
$conf = new Configurations();
|
$conf = new Configurations();
|
||||||
if (!$conf->exists('AUDIT_LOG','log')) {
|
if (!$conf->exists('AUDIT_LOG', 'log')) {
|
||||||
CLI::logging("> Updating Auditlog Config \n");
|
CLI::logging("> Updating Auditlog Config \n");
|
||||||
$oServerConf = &serverConf::getSingleton();
|
$oServerConf = &serverConf::getSingleton();
|
||||||
$sAudit = $oServerConf->getAuditLogProperty('AL_OPTION', $workspace);
|
$sAudit = $oServerConf->getAuditLogProperty('AL_OPTION', $workspace);
|
||||||
@@ -3579,7 +3589,8 @@ class workspaceTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function migrateSelfServiceRecordsRun($workspace) {
|
public function migrateSelfServiceRecordsRun($workspace)
|
||||||
|
{
|
||||||
// Initializing
|
// Initializing
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
|
|
||||||
@@ -3597,7 +3608,7 @@ class workspaceTools
|
|||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
$temp = @unserialize($row['GRP_UID']);
|
$temp = @unserialize($row['GRP_UID']);
|
||||||
if (is_array($temp)) {
|
if (is_array($temp)) {
|
||||||
foreach($temp as $groupUid) {
|
foreach ($temp as $groupUid) {
|
||||||
if ($groupUid != '') {
|
if ($groupUid != '') {
|
||||||
$appAssignSelfServiceValueGroup = new AppAssignSelfServiceValueGroup();
|
$appAssignSelfServiceValueGroup = new AppAssignSelfServiceValueGroup();
|
||||||
$appAssignSelfServiceValueGroup->setId($row['ID']);
|
$appAssignSelfServiceValueGroup->setId($row['ID']);
|
||||||
@@ -3625,7 +3636,8 @@ class workspaceTools
|
|||||||
CLI::logging(" Migrating Self-Service by Value Cases Done \n");
|
CLI::logging(" Migrating Self-Service by Value Cases Done \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function migratePopulateIndexingACV($workspace) {
|
public function migratePopulateIndexingACV($workspace)
|
||||||
|
{
|
||||||
// Migrating and populating new indexes
|
// Migrating and populating new indexes
|
||||||
CLI::logging("-> Migrating an populating indexing for avoiding the use of table APP_CACHE_VIEW Start \n");
|
CLI::logging("-> Migrating an populating indexing for avoiding the use of table APP_CACHE_VIEW Start \n");
|
||||||
|
|
||||||
@@ -3752,7 +3764,7 @@ class workspaceTools
|
|||||||
CLI::logging("-> Populating PRO_ID, USR_ID at LIST_* \n");
|
CLI::logging("-> Populating PRO_ID, USR_ID at LIST_* \n");
|
||||||
$con->begin();
|
$con->begin();
|
||||||
$stmt = $con->createStatement();
|
$stmt = $con->createStatement();
|
||||||
foreach(workspaceTools::$populateIdsQueries as $query) {
|
foreach (workspaceTools::$populateIdsQueries as $query) {
|
||||||
$stmt->executeQuery($query);
|
$stmt->executeQuery($query);
|
||||||
}
|
}
|
||||||
$con->commit();
|
$con->commit();
|
||||||
@@ -3895,4 +3907,24 @@ class workspaceTools
|
|||||||
$conf->create($data);
|
$conf->create($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method finds all recursively PHP files that have the path PATH_DATA,
|
||||||
|
* poorly referenced, this is caused by the import of processes where the data
|
||||||
|
* directory of ProcessMaker has different routes. Modified files are backed
|
||||||
|
* up with the extension '.backup' in the same directory.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function fixReferencePathFiles($pathClasses, $pathData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->initPropel(true);
|
||||||
|
$fixReferencePath = new FixReferencePath();
|
||||||
|
$fixReferencePath->runProcess($pathClasses, $pathData);
|
||||||
|
CLI::logging($fixReferencePath->getResumeDebug());
|
||||||
|
} catch (Exception $e) {
|
||||||
|
CLI::logging(CLI::error("Error:" . "Error updating generated class files for PM Tables, proceed to regenerate manually: " . $e));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
241
workflow/engine/src/ProcessMaker/Util/FixReferencePath.php
Normal file
241
workflow/engine/src/ProcessMaker/Util/FixReferencePath.php
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ProcessMaker\Util;
|
||||||
|
|
||||||
|
use Configurations;
|
||||||
|
use Criteria;
|
||||||
|
use ResultSet;
|
||||||
|
use FieldsPeer;
|
||||||
|
use ReportTablePeer;
|
||||||
|
use CaseConsolidatedCorePeer;
|
||||||
|
use ConsolidatedCases;
|
||||||
|
use AdditionalTablesPeer;
|
||||||
|
use PmTable;
|
||||||
|
use ReportVarPeer;
|
||||||
|
use AdditionalTables;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class regenerates the 'Propel' classes that are necessary for the
|
||||||
|
* administration of a 'Report Table', this is caused by the import of processes
|
||||||
|
* where the data directory of ProcessMaker has different routes.
|
||||||
|
*/
|
||||||
|
class FixReferencePath
|
||||||
|
{
|
||||||
|
private $modeDebug = false;
|
||||||
|
private $resumeDebug = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get property modeDebug.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getModeDebug()
|
||||||
|
{
|
||||||
|
return $this->modeDebug;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set property modeDebug.
|
||||||
|
*
|
||||||
|
* @param boolean $modeDebug
|
||||||
|
*/
|
||||||
|
public function setModeDebug($modeDebug)
|
||||||
|
{
|
||||||
|
$this->modeDebug = $modeDebug;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get property resumeDebug.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getResumeDebug()
|
||||||
|
{
|
||||||
|
return $this->resumeDebug;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set property resumeDebug.
|
||||||
|
*
|
||||||
|
* @param string $resumeDebug
|
||||||
|
*/
|
||||||
|
public function setResumeDebug($resumeDebug)
|
||||||
|
{
|
||||||
|
$this->resumeDebug = $resumeDebug;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find all PHP type files recursively.
|
||||||
|
* The '$pathData' argument is the path to be replaced with the path found
|
||||||
|
* as incorrect.
|
||||||
|
*
|
||||||
|
* @param string $directory
|
||||||
|
* @param string $pathData
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function runProcess($directory, $pathData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//This variable is not defined and does not involve its value in this
|
||||||
|
//task, it is removed at the end of the method.
|
||||||
|
$_SERVER["REQUEST_URI"] = "";
|
||||||
|
if (!defined("SYS_SKIN")) {
|
||||||
|
$conf = new Configurations();
|
||||||
|
define("SYS_SKIN", $conf->getConfiguration('SKIN_CRON', ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria = new Criteria("workflow");
|
||||||
|
$criteria->addSelectColumn(ReportTablePeer::REP_TAB_UID);
|
||||||
|
$criteria->addSelectColumn(CaseConsolidatedCorePeer::TAS_UID);
|
||||||
|
$criteria->addSelectColumn(ReportTablePeer::REP_TAB_NAME);
|
||||||
|
$criteria->addJoin(ReportTablePeer::REP_TAB_UID, CaseConsolidatedCorePeer::REP_TAB_UID, Criteria::JOIN);
|
||||||
|
$criteria->add(CaseConsolidatedCorePeer::CON_STATUS, "ACTIVE", Criteria::EQUAL);
|
||||||
|
$doSelect = ReportTablePeer::doSelectRS($criteria);
|
||||||
|
$doSelect->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
$consolidatedCases = new ConsolidatedCases();
|
||||||
|
while ($doSelect->next()) {
|
||||||
|
$row = $doSelect->getRow();
|
||||||
|
$fields = $this->getReportTableFields($row["REP_TAB_UID"]);
|
||||||
|
list($fields, $outFields) = $consolidatedCases->buildReportVariables($fields);
|
||||||
|
try {
|
||||||
|
$this->regeneratePropelClasses($row["REP_TAB_NAME"], $row["REP_TAB_NAME"], $fields, $row["TAS_UID"]);
|
||||||
|
$this->outVerboseln("* Regenerate classes for table: " . $row["REP_TAB_NAME"]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
CLI::logging(CLI::error("Error:" . "Error in regenerate classes for table: " . $row["REP_TAB_NAME"] . ". " . $e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria = new Criteria("workflow");
|
||||||
|
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
|
||||||
|
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||||
|
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_CLASS_NAME);
|
||||||
|
$criteria->addSelectColumn(AdditionalTablesPeer::DBS_UID);
|
||||||
|
$doSelect = AdditionalTablesPeer::doSelectRS($criteria);
|
||||||
|
$doSelect->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
while ($doSelect->next()) {
|
||||||
|
$row = $doSelect->getRow();
|
||||||
|
$fields = $this->getAdditionalTablesFields($row["ADD_TAB_UID"]);
|
||||||
|
try {
|
||||||
|
$pmTable = new PmTable($row["ADD_TAB_NAME"]);
|
||||||
|
$pmTable->setDbConfigAdapter("mysql");
|
||||||
|
$pmTable->setColumns($fields);
|
||||||
|
$pmTable->prepare();
|
||||||
|
$pmTable->preparePropelIniFile();
|
||||||
|
$pmTable->buildSchema();
|
||||||
|
$pmTable->phingbuildModel();
|
||||||
|
$this->outVerboseln("* Regenerate classes for table: " . $row["ADD_TAB_NAME"]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
CLI::logging(CLI::error("Error:" . "Error in regenerate classes for table: " . $row["ADD_TAB_NAME"] . ". " . $e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($_SERVER["REQUEST_URI"]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
CLI::logging(CLI::error("Error:" . "Error in regenerate classes files, proceed to regenerate manually: " . $e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the fields of the 'Report Table'.
|
||||||
|
*
|
||||||
|
* @param string $repTabUid
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getReportTableFields($repTabUid)
|
||||||
|
{
|
||||||
|
$fields = array();
|
||||||
|
$criteria = new Criteria("workflow");
|
||||||
|
$criteria->addSelectColumn(ReportVarPeer::REP_VAR_NAME);
|
||||||
|
$criteria->addSelectColumn(ReportVarPeer::REP_VAR_TYPE);
|
||||||
|
$criteria->add(ReportVarPeer::REP_TAB_UID, $repTabUid, Criteria::EQUAL);
|
||||||
|
$doSelect = ReportVarPeer::doSelectRS($criteria);
|
||||||
|
$doSelect->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
while ($doSelect->next()) {
|
||||||
|
$row = $doSelect->getRow();
|
||||||
|
$fields[] = $row['REP_VAR_NAME'] . '-' . $row['REP_VAR_TYPE'];
|
||||||
|
}
|
||||||
|
return $fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the fields of the 'Additional Table'.
|
||||||
|
*
|
||||||
|
* @param string $addTabUid
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public function getAdditionalTablesFields($addTabUid)
|
||||||
|
{
|
||||||
|
$fields = array();
|
||||||
|
$criteria = new Criteria("workflow");
|
||||||
|
$criteria->add(FieldsPeer::ADD_TAB_UID, $addTabUid);
|
||||||
|
$doSelect = FieldsPeer::doSelectRS($criteria);
|
||||||
|
$doSelect->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
while ($doSelect->next()) {
|
||||||
|
$row = $doSelect->getRow();
|
||||||
|
$object = new stdClass();
|
||||||
|
$object->field_index = $row["FLD_INDEX"];
|
||||||
|
$object->field_name = $row["FLD_NAME"];
|
||||||
|
$object->field_description = $row["FLD_DESCRIPTION"];
|
||||||
|
$object->field_type = $row["FLD_TYPE"];
|
||||||
|
$object->field_size = $row["FLD_SIZE"];
|
||||||
|
$object->field_null = $row["FLD_NULL"];
|
||||||
|
$object->field_autoincrement = $row["FLD_AUTO_INCREMENT"];
|
||||||
|
$object->field_key = $row["FLD_KEY"];
|
||||||
|
$fields[] = $object;
|
||||||
|
}
|
||||||
|
return $fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regenerate 'Propel' classes for 'Report Tables'. The name of the 'Report Table',
|
||||||
|
* the fields and the related task are required.
|
||||||
|
*
|
||||||
|
* @param string $repTabName
|
||||||
|
* @param array $fields
|
||||||
|
* @param string $guid
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function regeneratePropelClasses($repTabName, $className, $fields, $guid)
|
||||||
|
{
|
||||||
|
$sourcePath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
|
||||||
|
|
||||||
|
@unlink($sourcePath . $className . '.php');
|
||||||
|
@unlink($sourcePath . $className . 'Peer.php');
|
||||||
|
@unlink($sourcePath . PATH_SEP . 'map' . PATH_SEP . $className . 'MapBuilder.php');
|
||||||
|
@unlink($sourcePath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $className . '.php');
|
||||||
|
@unlink($sourcePath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $className . 'Peer.php');
|
||||||
|
|
||||||
|
$additionalTables = new AdditionalTables();
|
||||||
|
$additionalTables->createPropelClasses($repTabName, $className, $fields, $guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the output found, the message is not displayed if the value of the
|
||||||
|
* 'modeVerbose' property is false.
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function outVerbose($message)
|
||||||
|
{
|
||||||
|
$this->resumeDebug = $this->resumeDebug . $message;
|
||||||
|
if ($this->modeDebug === true) {
|
||||||
|
echo $message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows on the screen the output found with line break.
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function outVerboseln($message)
|
||||||
|
{
|
||||||
|
$this->outVerbose($message . "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user