Merged in 3.1 (pull request #4737)

Updating branch HOR-1500 with last changes in 3.1 (2016-08-11)
This commit is contained in:
Julio Cesar Laura Avendaño
2016-08-11 15:42:38 -04:00
6 changed files with 180 additions and 56 deletions

View File

@@ -1,5 +1,8 @@
<?php <?php
namespace Build\Utils; namespace Build\Utils;
include_once('workflow/engine/config/paths_installed.php');
/** /**
* Class ProcessMakerPhpBuilderHelper * Class ProcessMakerPhpBuilderHelper
* Main Builder class, has methods to build PMUI and MAFE, * Main Builder class, has methods to build PMUI and MAFE,
@@ -47,6 +50,11 @@ class ProcessMakerPhpBuilderHelper
* @var array * @var array
*/ */
public $devDir = array(); public $devDir = array();
/**
* Build Log Directory
* @var string
*/
public $logDir = "./shared/log";
/** /**
* Versions class, it contains versions and hashes from repositories * Versions class, it contains versions and hashes from repositories
* @var Versions * @var Versions
@@ -89,6 +97,7 @@ class ProcessMakerPhpBuilderHelper
$this->utils = new PhpBuilderUtils(); $this->utils = new PhpBuilderUtils();
$this->versions = new Versions(); $this->versions = new Versions();
$this->parameters = $this->getConfig(false); $this->parameters = $this->getConfig(false);
return $this->parameters; return $this->parameters;
} }
@@ -133,6 +142,11 @@ class ProcessMakerPhpBuilderHelper
$this->baseDir = empty($config['base_dir']) ? $baseDir : $config['base_dir']; $this->baseDir = empty($config['base_dir']) ? $baseDir : $config['base_dir'];
$this->publicDir = $this->baseDir . "/workflow/public_html"; $this->publicDir = $this->baseDir . "/workflow/public_html";
$this->buildTempDir = $this->baseDir . "/workflow/buildTemp"; $this->buildTempDir = $this->baseDir . "/workflow/buildTemp";
$this->logDir = $this->baseDir . "/shared/log";
if (defined('PATH_DATA')) {
$this->logDir = PATH_DATA . "log";
}
$this->utils->__set("logDir", $this->logDir);
$this->utils->refreshDir($this->buildTempDir); $this->utils->refreshDir($this->buildTempDir);
if (!file_exists($this->publicDir)) { if (!file_exists($this->publicDir)) {
$this->utils->exitCode(5); $this->utils->exitCode(5);
@@ -194,12 +208,14 @@ class ProcessMakerPhpBuilderHelper
// Building minified JS Files // Building minified JS Files
$mafeCompresedFile = $this->dir['targetDir'] . "/js"; $mafeCompresedFile = $this->dir['targetDir'] . "/js";
$files = $this->utils->getJsIncludeFiles(); $files = $this->utils->getJsIncludeFiles();
$this->utils->minifyFiles("mafe-$hashVendors", 'js', $files, $this->dir['baseDir'] . "/", $mafeCompresedFile . "/", false); $this->utils->minifyFiles("mafe-$hashVendors", 'js', $files, $this->dir['baseDir'] . "/",
$mafeCompresedFile . "/", false);
// Building minified CSS // Building minified CSS
$mafeCompresedFile = $this->dir['targetDir'] . "/css"; $mafeCompresedFile = $this->dir['targetDir'] . "/css";
$files = $this->utils->getCssIncludeFiles(); $files = $this->utils->getCssIncludeFiles();
$this->utils->minifyFiles("mafe-$hashVendors", 'css', $files, $this->dir['baseDir'] . "/", $mafeCompresedFile . "/", false); $this->utils->minifyFiles("mafe-$hashVendors", 'css', $files, $this->dir['baseDir'] . "/",
$mafeCompresedFile . "/", false);
//Create build-hash file //Create build-hash file
$this->utils->echoContent("Create File: buildhash"); $this->utils->echoContent("Create File: buildhash");
@@ -250,22 +266,24 @@ class ProcessMakerPhpBuilderHelper
$themeDir = $themeDir . $this->theme; $themeDir = $themeDir . $this->theme;
$this->utils->echoContent("1.- Copying lib files into: $pmUIDir"); $this->utils->echoContent("1.- Copying lib files into: $pmUIDir");
copy("$source/build/js/pmui-$version.js", "$pmUIDir/pmui.min.js"); $this->utils->copy("$source/build/js/pmui-$version.js", "$pmUIDir/pmui.min.js");
copy("$themeDir/build/pmui-$this->theme.css", "$pmUIDir/pmui.min.css"); $this->utils->copy("$themeDir/build/pmui-$this->theme.css", "$pmUIDir/pmui.min.css");
$this->utils->recCopy("$themeDir/build/images", "$target/css/images"); $this->utils->recCopy("$themeDir/build/images", "$target/css/images");
$this->utils->recCopy("$source/img", $imgTargetDir); $this->utils->recCopy("$source/img", $imgTargetDir);
$this->utils->echoContent("2.- Copying lib files into: $jsTargetDir"); $this->utils->echoContent("2.- Copying lib files into: $jsTargetDir");
copy("$source/libraries/restclient/restclient-min.js", "$jsTargetDir/restclient.min.js"); $this->utils->copy("$source/libraries/restclient/restclient-min.js", "$jsTargetDir/restclient.min.js");
$this->utils->echoContent("3.- Copying font files into: $pmUIFontsDir"); $this->utils->echoContent("3.- Copying font files into: $pmUIFontsDir");
$this->utils->recCopy("$source/themes/$this->theme/fonts", $pmUIFontsDir); $this->utils->recCopy("$source/themes/$this->theme/fonts", $pmUIFontsDir);
$this->utils->echoFooter("PMUI Build Finished!"); $this->utils->echoFooter("PMUI Build Finished!");
$response['success'] = true; $response['success'] = true;
return $response; return $response;
} catch (Exception $e) { } catch (Exception $e) {
$this->utils->exitCode(8, $e); $this->utils->exitCode(8, $e);
return $e; return $e;
} }
} }
@@ -343,19 +361,24 @@ class ProcessMakerPhpBuilderHelper
} }
$this->utils->echoContent("Copying files into: $jsTargetDir"); $this->utils->echoContent("Copying files into: $jsTargetDir");
copy($source . "/lib/wz_jsgraphics/wz_jsgraphics.js", $jsTargetDir . "/wz_jsgraphics.js");
copy($source . "/lib/jQuery/jquery-1.10.2.min.js", $jsTargetDir . "/jquery-1.10.2.min.js"); $this->utils->copy($source . "/lib/wz_jsgraphics/wz_jsgraphics.js", $jsTargetDir . "/wz_jsgraphics.js");
copy($source . "/lib/underscore/underscore-min.js", $jsTargetDir . "/underscore-min.js"); $this->utils->copy($source . "/lib/jQuery/jquery-1.10.2.min.js", $jsTargetDir . "/jquery-1.10.2.min.js");
copy($source . "/lib/jQueryUI/jquery-ui-1.10.3.custom.min.js", $jsTargetDir . "/jquery-ui-1.10.3.custom.min.js"); $this->utils->copy($source . "/lib/underscore/underscore-min.js", $jsTargetDir . "/underscore-min.js");
copy($source . "/lib/jQueryLayout/jquery.layout.min.js", $jsTargetDir . "/jquery.layout.min.js"); $this->utils->copy($source . "/lib/jQueryUI/jquery-ui-1.10.3.custom.min.js",
copy($source . "/lib/modernizr/modernizr.js", $jsTargetDir . "/modernizr.js"); $jsTargetDir . "/jquery-ui-1.10.3.custom.min.js");
$this->utils->copy($source . "/lib/jQueryLayout/jquery.layout.min.js",
$jsTargetDir . "/jquery.layout.min.js");
$this->utils->copy($source . "/lib/modernizr/modernizr.js", $jsTargetDir . "/modernizr.js");
$this->utils->recCopy($source . "/src/formDesigner/img/", $target . "/img"); $this->utils->recCopy($source . "/src/formDesigner/img/", $target . "/img");
$this->utils->echoFooter("Michelangelo FE Build Finished"); $this->utils->echoFooter("Michelangelo FE Build Finished");
$response['success'] = true; $response['success'] = true;
return $response; return $response;
} catch (Exception $e) { } catch (Exception $e) {
$this->utils->exitCode(9, $e); $this->utils->exitCode(9, $e);
return $e; return $e;
} }
@@ -377,9 +400,11 @@ class ProcessMakerPhpBuilderHelper
$this->versions->pmdynaform_ver = $vh['version'] . "." . $vh['hash']; $this->versions->pmdynaform_ver = $vh['version'] . "." . $vh['hash'];
$response = null; $response = null;
return $response; return $response;
} catch (Exception $e) { } catch (Exception $e) {
$this->utils->exitCode(10, $e); $this->utils->exitCode(10, $e);
return $e; return $e;
} }
} }
@@ -393,7 +418,7 @@ class ProcessMakerPhpBuilderHelper
try { try {
$this->utils->delTree($this->buildTempDir); $this->utils->delTree($this->buildTempDir);
} catch (Exception $e) { } catch (Exception $e) {
$this->utils->log($e);
} }
} }
} }
@@ -410,6 +435,8 @@ class PhpBuilderUtils
* @var string * @var string
*/ */
public $extensionsJsConfig; public $extensionsJsConfig;
public $logger;
public $logDir;
/** /**
* Class constructor. * Class constructor.
@@ -419,6 +446,8 @@ class PhpBuilderUtils
{ {
$this->extensionsJsConfig = ""; $this->extensionsJsConfig = "";
$this->silentMode = false; $this->silentMode = false;
$this->logger = array();
$this->logDir = "";
} }
/** /**
@@ -442,6 +471,16 @@ class PhpBuilderUtils
$this->$key = $value; $this->$key = $value;
} }
/**
* Logger function.
*
* @param mixed $e
*/
public function log($e)
{
$this->logger[] = $e;
}
/** /**
* Recursive copy of directories, * Recursive copy of directories,
* can be updated with compare values and overwrite if newer * can be updated with compare values and overwrite if newer
@@ -452,15 +491,37 @@ class PhpBuilderUtils
*/ */
function recCopy($src, $dst, $delete = false) function recCopy($src, $dst, $delete = false)
{ {
if ($delete && file_exists($dst)) $this->delTree($dst); if ($delete && file_exists($dst)) {
$this->delTree($dst);
}
if (is_dir($src)) { if (is_dir($src)) {
if (!file_exists($dst)) { if (!file_exists($dst) && is_writable($dst)) {
mkdir($dst); mkdir($dst);
} else {
$this->log("File doesn't exist or directory is not writable, file: $dst \n");
} }
$files = scandir($src); $files = scandir($src);
foreach ($files as $file) foreach ($files as $file) {
if ($file != "." && $file != "..") $this->recCopy("$src/$file", "$dst/$file"); if ($file != "." && $file != "..") {
} else if (file_exists($src)) copy($src, $dst); $this->recCopy("$src/$file", "$dst/$file");
}
}
} else {
$this->copy($src, $dst);
}
}
public function copy($src, $dst)
{
try {
if (file_exists($src) && is_writable($dst)) {
copy($src, $dst);
} else {
$this->log("File doesn't exist or directory is not writable, file: $dst \n");
}
} catch (Exception $e) {
$this->log($e);
}
} }
/** /**
@@ -474,10 +535,10 @@ class PhpBuilderUtils
*/ */
function copyIfExist($source, $file, $dest, $destFile, $tmp) function copyIfExist($source, $file, $dest, $destFile, $tmp)
{ {
if (!file_exists($tmp . $file)) { if (file_exists($tmp . $file)) {
copy($tmp . $file, $dest . $destFile); $this->copy($tmp . $file, $dest . $destFile);
} else { } else {
copy($source . $file, $dest . $destFile); $this->copy($source . $file, $dest . $destFile);
} }
} }
@@ -492,9 +553,26 @@ class PhpBuilderUtils
$parts = explode('/', $dir); $parts = explode('/', $dir);
$file = array_pop($parts); $file = array_pop($parts);
$dir = ''; $dir = '';
foreach ($parts as $part) foreach ($parts as $part) {
if (!is_dir($dir .= "/$part")) mkdir($dir); if (!is_dir($dir .= "/$part")) {
file_put_contents("$dir/$file", $contents); mkdir($dir);
}
}
$this->file_put_contents("/$file", $dir, $contents);
}
public function file_put_contents($file, $dir = "", $contents)
{
$dst = $dir . $file;
try {
if (is_writable($dir)) {
file_put_contents($dst, $contents);
} else {
$this->log("Cannot write file, check directory permissions, file: $dst \n");
}
} catch (Exception $e) {
$this->log($e);
}
} }
/** /**
@@ -568,6 +646,7 @@ class PhpBuilderUtils
foreach ($files as $file) { foreach ($files as $file) {
(is_dir("$dir/$file")) ? $this->delTree("$dir/$file") : unlink("$dir/$file"); (is_dir("$dir/$file")) ? $this->delTree("$dir/$file") : unlink("$dir/$file");
} }
return rmdir($dir); return rmdir($dir);
} }
@@ -645,7 +724,7 @@ class PhpBuilderUtils
} else { } else {
$current = $contents; $current = $contents;
} }
file_put_contents($directory . "/" . $filename, $current); $this->file_put_contents("/$filename", $directory, $current);
} }
/** /**
@@ -667,6 +746,7 @@ class PhpBuilderUtils
$zip->addFile($file, $newFile); $zip->addFile($file, $newFile);
} }
} }
return $zip; return $zip;
} }
@@ -703,7 +783,9 @@ class PhpBuilderUtils
{ {
$arrayItems = array(); $arrayItems = array();
$skipByExclude = false; $skipByExclude = false;
if (!file_exists($directory)) return $arrayItems; if (!file_exists($directory)) {
return $arrayItems;
}
$handle = opendir($directory); $handle = opendir($directory);
if ($handle) { if ($handle) {
while (false !== ($file = readdir($handle))) { while (false !== ($file = readdir($handle))) {
@@ -714,7 +796,9 @@ class PhpBuilderUtils
if (!$skip && !$skipByExclude) { if (!$skip && !$skipByExclude) {
if (is_dir($directory . DIRECTORY_SEPARATOR . $file)) { if (is_dir($directory . DIRECTORY_SEPARATOR . $file)) {
if ($recursive) { if ($recursive) {
$arrayItems = array_merge($arrayItems, $this->directoryToArray($directory . DIRECTORY_SEPARATOR . $file, $recursive, $listDirs, $listFiles, $exclude)); $arrayItems = array_merge($arrayItems,
$this->directoryToArray($directory . DIRECTORY_SEPARATOR . $file, $recursive, $listDirs,
$listFiles, $exclude));
} }
if ($listDirs) { if ($listDirs) {
$file = $directory . DIRECTORY_SEPARATOR . $file; $file = $directory . DIRECTORY_SEPARATOR . $file;
@@ -730,6 +814,7 @@ class PhpBuilderUtils
} }
closedir($handle); closedir($handle);
} }
return $arrayItems; return $arrayItems;
} }
@@ -760,7 +845,8 @@ class PhpBuilderUtils
switch ($lib->extension) { switch ($lib->extension) {
case "js": case "js":
$this->echoContent("Building Js File"); $this->echoContent("Building Js File");
$this->minifyFiles($lib->name, 'js', $files, $source . "/" . $sourceFrom, $target . "/$target_dir", $addPluginFiles); $this->minifyFiles($lib->name, 'js', $files, $source . "/" . $sourceFrom, $target . "/$target_dir",
$addPluginFiles);
break; break;
case "css": case "css":
$this->echoContent("Building Css File"); $this->echoContent("Building Css File");
@@ -791,8 +877,10 @@ class PhpBuilderUtils
$content = ""; $content = "";
$content = $content . $this->joinFiles($basePath, $files, $addPlugin); $content = $content . $this->joinFiles($basePath, $files, $addPlugin);
$this->file_force_contents($minifiedPath, $content); $this->file_force_contents($minifiedPath, $content);
return $content; return $content;
} }
return false; return false;
} }
@@ -807,6 +895,7 @@ class PhpBuilderUtils
foreach ($pluginDir as $key => $row) { foreach ($pluginDir as $key => $row) {
$pluginDir[$key] = $row . $pluginAdd; $pluginDir[$key] = $row . $pluginAdd;
} }
return $pluginDir; return $pluginDir;
} }
@@ -821,6 +910,7 @@ class PhpBuilderUtils
foreach ($pluginDir as $key => $row) { foreach ($pluginDir as $key => $row) {
$pluginDir[$key] = $baseDir . '/' . $row; $pluginDir[$key] = $baseDir . '/' . $row;
} }
return $pluginDir; return $pluginDir;
} }
@@ -846,6 +936,7 @@ class PhpBuilderUtils
} }
} }
} }
return $content; return $content;
} }
@@ -859,6 +950,7 @@ class PhpBuilderUtils
$values = []; $values = [];
$values['hash'] = substr(md5($source), 0, 7); $values['hash'] = substr(md5($source), 0, 7);
$values['version'] = '1.0.0'; $values['version'] = '1.0.0';
return $values; return $values;
} }
@@ -877,6 +969,7 @@ class PhpBuilderUtils
$values = []; $values = [];
$values['hash'] = !empty($hashes[0]) ? $hashes[0] : ''; $values['hash'] = !empty($hashes[0]) ? $hashes[0] : '';
$values['version'] = !empty($version[0]) ? $version[0] : ''; $values['version'] = !empty($version[0]) ? $version[0] : '';
return $values; return $values;
} }
@@ -923,8 +1016,6 @@ Build options:
Will clean the cache directory. Will clean the cache directory.
See also: https://bitbucket.com/processmaker/this/page/doesnt/exist/pmphpbuild
END; END;
} }
@@ -969,6 +1060,7 @@ END;
$this->echoContent("Exit Code Not found, exit anyway lol"); $this->echoContent("Exit Code Not found, exit anyway lol");
break; break;
} }
$this->writeToFile("build.log", $this->logDir, $this->logger);
exit($code); exit($code);
} }
@@ -999,6 +1091,7 @@ END;
} }
} }
} }
return $config; return $config;
} }
@@ -1021,7 +1114,6 @@ END;
"workflow/public_html/lib/mafe/mafe.min.js", "workflow/public_html/lib/mafe/mafe.min.js",
"workflow/public_html/lib/mafe/designer.min.js", "workflow/public_html/lib/mafe/designer.min.js",
"gulliver/js/tinymce/jscripts/tiny_mce/tiny_mce.js", "gulliver/js/tinymce/jscripts/tiny_mce/tiny_mce.js",
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/editor_plugin.js", "gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/editor_plugin.js",
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/editor_plugin.js", "gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/editor_plugin.js",
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin.js", "gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin.js",
@@ -1063,7 +1155,6 @@ END;
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/advlink/editor_plugin.js", "gulliver/js/tinymce/jscripts/tiny_mce/plugins/advlink/editor_plugin.js",
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin.js", "gulliver/js/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin.js",
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin.js", "gulliver/js/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin.js",
"gulliver/js/codemirror/lib/codemirror.js", "gulliver/js/codemirror/lib/codemirror.js",
"gulliver/js/codemirror/addon/hint/show-hint.js", "gulliver/js/codemirror/addon/hint/show-hint.js",
"gulliver/js/codemirror/addon/hint/javascript-hint.js", "gulliver/js/codemirror/addon/hint/javascript-hint.js",
@@ -1251,7 +1342,8 @@ END;
"src/models/PanelField.js", "src/models/PanelField.js",
"src/extends/core/get_scripts.js" "src/extends/core/get_scripts.js"
]; ];
$index = ['appMobile/form-dev.html', $index = [
'appMobile/form-dev.html',
"src/templates/template.html", "src/templates/template.html",
"src/templates/controls.html", "src/templates/controls.html",
"src/templates/GridTemplate.html", "src/templates/GridTemplate.html",
@@ -1281,10 +1373,10 @@ END;
$this->minifyFiles('pmDynaform', 'js', $minified, $source . "/", $dev . "/js/", false); $this->minifyFiles('pmDynaform', 'js', $minified, $source . "/", $dev . "/js/", false);
$this->recCopy($source . "/libs", $dev . "/libs", false); $this->recCopy($source . "/libs", $dev . "/libs", false);
copy($source . "/appMobile/appBuild.js", $dev . "/appBuild.js"); $this->copy($source . "/appMobile/appBuild.js", $dev . "/appBuild.js");
copy($source . "/img/geoMap.jpg", $dev . "/geoMap.jpg"); $this->copy($source . "/img/geoMap.jpg", $dev . "/geoMap.jpg");
$htmlFile = $this->joinFiles($source, $index); $htmlFile = $this->joinFiles($source, $index);
file_put_contents($dev . "/index.html", $htmlFile); $this->file_put_contents("/index.html", $dev, $htmlFile);
$cssmin = [ $cssmin = [
"libs/bootstrap-3.1.1/css/bootstrap.min.css", "libs/bootstrap-3.1.1/css/bootstrap.min.css",
@@ -1300,7 +1392,8 @@ END;
"libs/restclient/restclient.js", "libs/restclient/restclient.js",
"js/pmDynaform.js" "js/pmDynaform.js"
]; ];
$index = ["appMobile/form-prod.html", $index = [
"appMobile/form-prod.html",
"src/templates/template.html", "src/templates/template.html",
"src/templates/controls.html", "src/templates/controls.html",
"src/templates/GridTemplate.html", "src/templates/GridTemplate.html",
@@ -1332,11 +1425,11 @@ END;
$this->minifyFiles('pmDynaform.min', 'css', $cssmin, $dev . "/", $prod . "/css/", false); $this->minifyFiles('pmDynaform.min', 'css', $cssmin, $dev . "/", $prod . "/css/", false);
$this->minifyFiles('pmDynaform.min', 'js', $minified, $dev . "/", $prod . "/js/", false); $this->minifyFiles('pmDynaform.min', 'js', $minified, $dev . "/", $prod . "/js/", false);
copy($source . "/appMobile/appBuild.js", $prod . "/appBuild.js"); $this->copy($source . "/appMobile/appBuild.js", $prod . "/appBuild.js");
copy($source . "/img/geoMap.jpg", $prod . "/geoMap.jpg"); $this->copy($source . "/img/geoMap.jpg", $prod . "/geoMap.jpg");
$this->recCopy($source . "/img", $prod . "/img", false); $this->recCopy($source . "/img", $prod . "/img", false);
$htmlFile = $this->joinFiles($source, $index); $htmlFile = $this->joinFiles($source, $index);
file_put_contents($prod . "/index.html", $htmlFile); $this->file_put_contents("/index.html", $prod, $htmlFile);
// Create Zip File // Create Zip File
@@ -1347,8 +1440,9 @@ END;
$zipFile->open($outputFile, ZipArchive::CREATE | ZipArchive::OVERWRITE); $zipFile->open($outputFile, ZipArchive::CREATE | ZipArchive::OVERWRITE);
$zipFile = $this->addDirectoryToZip($zipFile, $prod, $directoryToZip); $zipFile = $this->addDirectoryToZip($zipFile, $prod, $directoryToZip);
$zipFile->close(); $zipFile->close();
if (file_exists($outputFile)) {
copy($outputFile, $target . "/build-prod.zip"); copy($outputFile, $target . "/build-prod.zip");
}
$this->echoFooter("PMUI Dynaform Zip Finished!"); $this->echoFooter("PMUI Dynaform Zip Finished!");
} }
} }
@@ -1366,14 +1460,6 @@ class Versions
public $pmdynaform_ver = ""; public $pmdynaform_ver = "";
public $pmdynaform_hash = ""; public $pmdynaform_hash = "";
/**
* Class Constructor
*/
public function __construct()
{
}
/** /**
* Get Function of class key * Get Function of class key
* @param string $key * @param string $key

View File

@@ -60,8 +60,6 @@ include_once 'phing/system/util/Register.php';
*/ */
class Phing { class Phing {
const inclDir = 'include_path';
/** The default build file name */ /** The default build file name */
const DEFAULT_BUILD_FILENAME = "build.xml"; const DEFAULT_BUILD_FILENAME = "build.xml";
@@ -860,9 +858,7 @@ class Phing {
} }
$firstPath = explode(":", implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts))); $firstPath = explode(":", implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
if (is_dir($firstPath[0])) { if (is_dir($firstPath[0])) {
$sPath = implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)) ini_set('include_path', implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
$inclDir = self::inclDir;
ini_set($inclDir, $sPath);
} }
} }
} }

View File

@@ -3129,6 +3129,13 @@ class wsBase
$g->sessionVarRestore(); $g->sessionVarRestore();
return $result; return $result;
} }
$oAppThread = new AppThread();
$cant = $oAppThread->countStatus($caseUid, 'OPEN');
if($cant > 1){
$result = new wsResponse( 100, G::LoadTranslation( "ID_CASE_CANCELLED_PARALLEL" ) );
$g->sessionVarRestore();
return $result;
}
$case = new Cases(); $case = new Cases();
$case->cancelCase( $caseUid, $delIndex, $userUid ); $case->cancelCase( $caseUid, $delIndex, $userUid );

View File

@@ -114,5 +114,15 @@ class AppThread extends BaseAppThread
throw($oError); throw($oError);
} }
} }
public function countStatus($appUid, $status='OPEN'){
$c = new Criteria('workflow');
$c->clearSelectColumns();
$c->addSelectColumn( AppThreadPeer::APP_THREAD_PARENT );
$c->add(AppThreadPeer::APP_UID, $appUid );
$c->add(AppThreadPeer::APP_THREAD_STATUS , $status );
$cant = AppThreadPeer::doCount($c);
return $cant;
}
} }

View File

@@ -498,7 +498,7 @@ class Translation extends BaseTranslation
} }
} }
return $environments; return $this->sortByColumn($environments, 'LANGUAGE');
/* /*
G::LoadSystem('dbMaintenance'); G::LoadSystem('dbMaintenance');
@@ -520,6 +520,31 @@ class Translation extends BaseTranslation
*/ */
} }
/**
* Sorts an array according to a specified column
* Params : array $table
* string $colname
* bool $numeric
**/
public function sortByColumn($table, $colname) {
$tn = $ts = $temp_num = $temp_str = array();
foreach ($table as $key => $row) {
if(is_numeric(substr($row[$colname], 0, 1))) {
$tn[$key] = $row[$colname];
$temp_num[$key] = $row;
}
else {
$ts[$key] = $row[$colname];
$temp_str[$key] = $row;
}
}
unset($table);
array_multisort($tn, SORT_ASC, SORT_NUMERIC, $temp_num);
array_multisort($ts, SORT_ASC, SORT_STRING, $temp_str);
return array_merge($temp_num, $temp_str);
}
public function getInfoFromPOFile ($file) public function getInfoFromPOFile ($file)
{ {
G::loadClass( 'i18n_po' ); G::loadClass( 'i18n_po' );

View File

@@ -5,7 +5,7 @@ use \G;
class Variable class Variable
{ {
public $variableTypes = array('string', 'integer', 'float', 'boolean', 'datetime', 'grid', 'array', 'file'); private $variableTypes = ['string', 'integer', 'float', 'boolean', 'datetime', 'grid', 'array', 'file', 'multiplefile'];
/** /**
* Create Variable for a Process * Create Variable for a Process