+ Add missing Phing package
- Remove pending LoadInclude
This commit is contained in:
davidcallizaya
2017-08-04 11:23:34 -04:00
parent 53f1350a89
commit bce594fe24
22 changed files with 199 additions and 241 deletions

View File

@@ -57,6 +57,7 @@
"thirdparty/jsmin/jsmin.php",
"thirdparty/libchart/classes/",
"thirdparty/pear",
"thirdparty/phing",
"rbac/engine/classes/"
],
"files": [

View File

@@ -418,7 +418,7 @@ class WebApplication
define("PATH_GULLIVER", PATH_GULLIVER_HOME . "system" . PATH_SEP); //gulliver system classes
define("PATH_GULLIVER_BIN", PATH_GULLIVER_HOME . "bin" . PATH_SEP); //gulliver bin classes
define("PATH_TEMPLATE", PATH_GULLIVER_HOME . "templates" . PATH_SEP);
define("PATH_THIRDPARTY", PATH_GULLIVER_HOME . "thirdparty" . PATH_SEP);
define("PATH_THIRDPARTY", PATH_TRUNK . "thirdparty" . PATH_SEP);
define("PATH_RBAC", PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP); //to enable rbac version 2
define("PATH_RBAC_CORE", PATH_RBAC_HOME . "engine" . PATH_SEP);
define("PATH_CORE", PATH_HOME . "engine" . PATH_SEP);

View File

@@ -38,7 +38,7 @@
define( 'PATH_GULLIVER', PATH_GULLIVER_HOME . 'system' . PATH_SEP ); //gulliver system classes
define( 'PATH_GULLIVER_BIN', PATH_GULLIVER_HOME . 'bin' . PATH_SEP ); //gulliver bin classes
define( 'PATH_TEMPLATE', PATH_GULLIVER_HOME . 'templates' . PATH_SEP );
define( 'PATH_THIRDPARTY', PATH_GULLIVER_HOME . 'thirdparty' . PATH_SEP );
define( 'PATH_THIRDPARTY', PATH_TRUNK . 'thirdparty' . PATH_SEP );
define( 'PATH_RBAC', PATH_RBAC_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP ); //to enable rbac version 2

View File

@@ -26,7 +26,7 @@
define( 'PATH_GULLIVER', PATH_GULLIVER_HOME . 'system' . PATH_SEP ); //gulliver system classes
define( 'PATH_TEMPLATE', PATH_GULLIVER_HOME . 'templates' . PATH_SEP );
define( 'PATH_THIRDPARTY', PATH_GULLIVER_HOME . 'thirdparty' . PATH_SEP );
define( 'PATH_THIRDPARTY', $pathTrunk . 'thirdparty' . PATH_SEP );
define( 'PATH_RBAC', PATH_RBAC_HOME . 'engine/classes' . PATH_SEP ); //to enable rbac version 2
define( 'PATH_DATA', '/shared/rbac/');
define( 'PATH_HTML', PATH_HOME . 'public_html' . PATH_SEP );

View File

@@ -1,41 +1,14 @@
<?php
/**
* class.case.php
*
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once 'classes/model/AdditionalTables.php';
/**
* PmTable Class
* New class to handle pmTable in native form invoking to Phing & Propel
*
* @author Erik Amaru Ortiz <erik@colosa.com>
*/
class PmTable
{
private $dom = null;
private $schemaFile = '';
private $tableName;
@@ -56,11 +29,11 @@ class PmTable
private $keepData = false;
public $tableClassName = '';
public function __construct ($tableName = null)
public function __construct($tableName = null)
{
if (isset( $tableName )) {
if (isset($tableName)) {
$this->tableName = $tableName;
$this->className = $this->toCamelCase( $tableName );
$this->className = $this->toCamelCase($tableName);
}
$this->dbConfig = new StdClass();
@@ -82,7 +55,7 @@ class PmTable
* @param array $columns contains a array of abjects
* array(StdClass->field_name, field_type, field_size, field_null, field_key, field_autoincrement,...)
*/
public function setColumns ($columns)
public function setColumns($columns)
{
$this->columns = $columns;
}
@@ -92,9 +65,9 @@ class PmTable
*
* @param string $dbsUid DBS_UID to relate the pmTable to phisical table
*/
public function setDataSource ($dbsUid)
public function setDataSource($dbsUid)
{
$this->dataSource = self::resolveDbSource( $dbsUid );
$this->dataSource = self::resolveDbSource($dbsUid);
switch ($this->dataSource) {
case 'workflow':
@@ -116,10 +89,10 @@ class PmTable
default:
require_once 'classes/model/DbSource.php';
$oDBSource = new DbSource();
$proUid = $oDBSource->getValProUid( $this->dataSource );
$dbSource = $oDBSource->load( $this->dataSource, $proUid );
$proUid = $oDBSource->getValProUid($this->dataSource);
$dbSource = $oDBSource->load($this->dataSource, $proUid);
if (is_object( $dbSource )) {
if (is_object($dbSource)) {
$this->dbConfig->adapter = $dbSource->getDbsType();
$this->dbConfig->host = $dbSource->getDbsServer();
$this->dbConfig->name = $dbSource->getDbsDatabaseName();
@@ -127,7 +100,7 @@ class PmTable
$this->dbConfig->passwd = $dbSource->getDbsPassword();
$this->dbConfig->port = $dbSource->getDbsPort();
}
if (is_array( $dbSource )) {
if (is_array($dbSource)) {
$this->dbConfig->adapter = $dbSource['DBS_TYPE'];
$this->dbConfig->host = $dbSource['DBS_SERVER'];
$this->dbConfig->name = $dbSource['DBS_DATABASE_NAME'];
@@ -135,7 +108,7 @@ class PmTable
$this->dbConfig->passwd = $dbSource['DBS_PASSWORD'];
$this->dbConfig->port = $dbSource['DBS_PORT'];
} else {
throw new Exception( "Db source with id $dbsUid does not exist!" );
throw new Exception("Db source with id $dbsUid does not exist!");
}
}
}
@@ -166,7 +139,7 @@ class PmTable
return $dbsUid;
}
public function getDataSource ()
public function getDataSource()
{
return $this->dataSource;
}
@@ -176,12 +149,12 @@ class PmTable
*
* @return object containing dbConfig var
*/
public function getDbConfig ()
public function getDbConfig()
{
return $this->dbConfig;
}
public function setAlterTable ($value)
public function setAlterTable($value)
{
$this->alterTable = $value;
}
@@ -194,7 +167,7 @@ class PmTable
/**
* Build the pmTable with all dependencies
*/
public function build ()
public function build()
{
$this->prepare();
$this->preparePropelIniFile();
@@ -207,11 +180,11 @@ class PmTable
}
}
public function buildModelFor ($dbsUid, $tablesList)
public function buildModelFor($dbsUid, $tablesList)
{
$this->setDataSource( $dbsUid );
$this->setDataSource($dbsUid);
$loadSchema = false;
$this->prepare( $loadSchema );
$this->prepare($loadSchema);
$this->phingbuildModel();
$this->phingbuildSql();
//$this->upgradeDatabaseFor($this->dataSource, $tablesList);
@@ -220,10 +193,10 @@ class PmTable
/**
* Prepare the pmTable env
*/
public function prepare ($loadSchema = true)
public function prepare($loadSchema = true)
{
//prevent execute prepare() twice or more
if (is_object( $this->dom )) {
if (is_object($this->dom)) {
return true;
}
@@ -235,116 +208,116 @@ class PmTable
$this->classesDir = $this->baseDir . 'classes' . PATH_SEP;
// G::mk_dir create the requested dir and the parents directories if not exists
G::mk_dir( $this->configDir );
G::mk_dir( $this->dataDir );
G::mk_dir($this->configDir);
G::mk_dir($this->dataDir);
if ($loadSchema) {
$this->loadSchema();
}
}
public function loadSchema ()
public function loadSchema()
{
$this->dom = new DOMDocument( '1.0', 'utf-8' );
$this->dom = new DOMDocument('1.0', 'utf-8');
$this->dom->preserveWhiteSpace = false;
$this->dom->formatOutput = true;
if (file_exists( $this->configDir . $this->schemaFilename )) {
if (@$this->dom->load( $this->configDir . $this->schemaFilename ) !== true) {
throw new Exception( 'Error: ' . $this->schemaFilename . ' is a invalid xml file!' );
if (file_exists($this->configDir . $this->schemaFilename)) {
if (@$this->dom->load($this->configDir . $this->schemaFilename) !== true) {
throw new Exception('Error: ' . $this->schemaFilename . ' is a invalid xml file!');
}
$this->rootNode = $this->dom->firstChild;
} else {
$this->rootNode = $this->dom->createElement( 'database' );
$this->rootNode->setAttribute( 'name', $this->dataSource );
$this->dom->appendChild( $this->rootNode );
$this->rootNode = $this->dom->createElement('database');
$this->rootNode->setAttribute('name', $this->dataSource);
$this->dom->appendChild($this->rootNode);
}
}
/**
* Build the xml schema for propel
*/
public function buildSchema ()
public function buildSchema()
{
$tableNode = $this->dom->createElement( 'table' );
$tableNode->setAttribute( 'name', $this->tableName );
$tableNode = $this->dom->createElement('table');
$tableNode->setAttribute('name', $this->tableName);
if ($this->hasAutoIncrementPKey()) {
$tableNode->setAttribute( 'idMethod', 'native' );
$tableNode->setAttribute('idMethod', 'native');
}
// specifying collation
switch ($this->dbConfig->adapter) {
case 'mysql':
$vendorNode = $this->dom->createElement( 'vendor' );
$vendorNode->setAttribute( 'type', $this->dbConfig->adapter );
$parameterNode = $this->dom->createElement( 'parameter' );
$parameterNode->setAttribute( 'name', 'Collation' );
$parameterNode->setAttribute( 'value', 'utf8_general_ci' );
$vendorNode->appendChild( $parameterNode );
$tableNode->appendChild( $vendorNode );
$vendorNode = $this->dom->createElement('vendor');
$vendorNode->setAttribute('type', $this->dbConfig->adapter);
$parameterNode = $this->dom->createElement('parameter');
$parameterNode->setAttribute('name', 'Collation');
$parameterNode->setAttribute('value', 'utf8_general_ci');
$vendorNode->appendChild($parameterNode);
$tableNode->appendChild($vendorNode);
break;
}
$indexNode = $this->dom->createElement( 'index' );
$indexNode->setAttribute( 'name', 'indexTable' );
$indexNode = $this->dom->createElement('index');
$indexNode->setAttribute('name', 'indexTable');
$flag = false;
foreach ($this->columns as $column) {
// create the column node
$columnNode = $this->dom->createElement( 'column' );
$columnNode = $this->dom->createElement('column');
// setting column node attributes
$columnNode->setAttribute( 'name', $column->field_name );
$columnNode->setAttribute( 'type', $column->field_type );
$columnNode->setAttribute('name', $column->field_name);
$columnNode->setAttribute('type', $column->field_type);
if ($column->field_size != '' && $column->field_size != 0) {
$columnNode->setAttribute( 'size', $column->field_size );
$columnNode->setAttribute('size', $column->field_size);
}
if ($column->field_type == 'DECIMAL') {
if ($column->field_size > 2) {
$columnNode->setAttribute( 'scale', 2 );
$columnNode->setAttribute('scale', 2);
} else {
$columnNode->setAttribute( 'scale', 1 );
$columnNode->setAttribute('scale', 1);
}
}
$columnNode->setAttribute( 'required', ($column->field_null ? 'false' : 'true') );
$columnNode->setAttribute('required', ($column->field_null ? 'false' : 'true'));
// only define the primaryKey attribute if it is defined
if ($column->field_key) {
$columnNode->setAttribute( 'primaryKey', "true" );
$columnNode->setAttribute('primaryKey', "true");
}
// only define the autoIncrement attribute if it is defined
if ($column->field_autoincrement) {
$columnNode->setAttribute( 'autoIncrement', "true" );
$columnNode->setAttribute('autoIncrement', "true");
}
// define the Index attribute if it is defined
if (isset($column->field_index) && $column->field_index) {
$columnNode->setAttribute( 'index', "true" );
$indexColumnNode = $this->dom->createElement( 'index-column' );
$indexColumnNode->setAttribute( 'name', $column->field_name );
$indexNode->appendChild( $indexColumnNode );
$columnNode->setAttribute('index', "true");
$indexColumnNode = $this->dom->createElement('index-column');
$indexColumnNode->setAttribute('name', $column->field_name);
$indexNode->appendChild($indexColumnNode);
$flag = true;
}
$tableNode->appendChild( $columnNode );
$tableNode->appendChild($columnNode);
}
if ($flag) {
$tableNode->appendChild( $indexNode );
$tableNode->appendChild($indexNode);
}
$xpath = new DOMXPath( $this->dom );
$xtable = $xpath->query( '/database/table[@name="' . $this->tableName . '"]' );
$xpath = new DOMXPath($this->dom);
$xtable = $xpath->query('/database/table[@name="' . $this->tableName . '"]');
if ($xtable->length == 0) {
//the table definition does not exist, then just append the new node
$this->rootNode->appendChild( $tableNode );
$this->rootNode->appendChild($tableNode);
} else {
// the table definition already exist, then replace the node
$replacedNode = $xtable->item( 0 );
$this->rootNode->replaceChild( $tableNode, $replacedNode );
$replacedNode = $xtable->item(0);
$this->rootNode->replaceChild($tableNode, $replacedNode);
}
// saving the xml result file
@@ -354,7 +327,7 @@ class PmTable
/**
* Remove the pmTable and all related objects, files and others
*/
public function remove ()
public function remove()
{
$this->prepare();
$this->removeFromSchema();
@@ -365,16 +338,16 @@ class PmTable
/**
* Remove the target pmTable from schema of propel
*/
public function removeFromSchema ()
public function removeFromSchema()
{
$xpath = new DOMXPath( $this->dom );
$xpath = new DOMXPath($this->dom);
// locate the node
$xtable = $xpath->query( '/database/table[@name="' . $this->tableName . '"]' );
$xtable = $xpath->query('/database/table[@name="' . $this->tableName . '"]');
if ($xtable->length == 0) {
return false;
}
$this->rootNode->removeChild( $xtable->item( 0 ) );
$this->rootNode->removeChild($xtable->item(0));
// saving the xml result file
$this->saveSchema();
}
@@ -382,29 +355,29 @@ class PmTable
/**
* Remove the model related classes files
*/
public function removeModelFiles ()
public function removeModelFiles()
{
@unlink( $this->classesDir . $this->className . '.php' );
@unlink( $this->classesDir . $this->className . 'Peer.php' );
@unlink( $this->classesDir . 'map' . PATH_SEP . $this->className . 'MapBuilder.php' );
@unlink( $this->classesDir . 'om' . PATH_SEP . 'Base' . $this->className . '.php' );
@unlink( $this->classesDir . 'om' . PATH_SEP . 'Base' . $this->className . 'Peer.php' );
@unlink($this->classesDir . $this->className . '.php');
@unlink($this->classesDir . $this->className . 'Peer.php');
@unlink($this->classesDir . 'map' . PATH_SEP . $this->className . 'MapBuilder.php');
@unlink($this->classesDir . 'om' . PATH_SEP . 'Base' . $this->className . '.php');
@unlink($this->classesDir . 'om' . PATH_SEP . 'Base' . $this->className . 'Peer.php');
}
/**
* Drop the phisical table of target pmTable or any specified as parameter
*/
public function dropTable ($tableName = null)
public function dropTable($tableName = null)
{
$tableName = isset( $tableName ) ? $tableName : $this->tableName;
$con = Propel::getConnection( $this->dataSource );
$tableName = isset($tableName) ? $tableName : $this->tableName;
$con = Propel::getConnection($this->dataSource);
$stmt = $con->createStatement();
if (is_object( $con )) {
if (is_object($con)) {
try {
$stmt->executeQuery( "DROP TABLE {$tableName}" );
$stmt->executeQuery("DROP TABLE {$tableName}");
} catch (Exception $e) {
throw new Exception( "Physical table '$tableName' does not exist!" );
throw new Exception("Physical table '$tableName' does not exist!");
}
}
}
@@ -412,27 +385,27 @@ class PmTable
/**
* Save the xml schema for propel
*/
public function saveSchema ()
public function saveSchema()
{
$this->dom->save( $this->configDir . $this->schemaFilename );
$this->dom->save($this->configDir . $this->schemaFilename);
}
/**
* Prepare and create if not exists the propel ini file
*/
public function preparePropelIniFile ()
public function preparePropelIniFile()
{
$adapter = $this->dbConfig->adapter;
if (file_exists( $this->configDir . "propel.$adapter.ini" )) {
if (file_exists($this->configDir . "propel.$adapter.ini")) {
return true;
}
if (! file_exists( PATH_CORE . PATH_SEP . 'config' . PATH_SEP . "propel.$adapter.ini" )) {
throw new Exception( "Invalid or not supported engine '$adapter'!" );
if (! file_exists(PATH_CORE . PATH_SEP . 'config' . PATH_SEP . "propel.$adapter.ini")) {
throw new Exception("Invalid or not supported engine '$adapter'!");
}
@copy( PATH_CORE . PATH_SEP . 'config' . PATH_SEP . "propel.$adapter.ini", $this->configDir . "propel.$adapter.ini" );
@copy(PATH_CORE . PATH_SEP . 'config' . PATH_SEP . "propel.$adapter.ini", $this->configDir . "propel.$adapter.ini");
}
/**
@@ -441,35 +414,35 @@ class PmTable
* for the related table
* - this function is not executing other sentenses like 'SET FOREIGN_KEY_CHECKS = 0;' for mysql, and others
*/
public function upgradeDatabase ()
public function upgradeDatabase()
{
$con = Propel::getConnection( $this->dataSource );
$con = Propel::getConnection($this->dataSource);
$stmt = $con->createStatement();
$lines = file( $this->dataDir . $this->dbConfig->adapter . PATH_SEP . 'schema.sql' );
$lines = file($this->dataDir . $this->dbConfig->adapter . PATH_SEP . 'schema.sql');
$previous = null;
$queryStack = array ();
$queryStack = array();
$aDNS = $con->getDSN();
$dbEngine = $aDNS["phptype"];
foreach ($lines as $j => $line) {
switch ($dbEngine) {
case 'mysql':
$line = trim( $line ); // Remove comments from the script
$line = trim($line); // Remove comments from the script
if (strpos( $line, "--" ) === 0) {
$line = substr( $line, 0, strpos( $line, "--" ) );
if (strpos($line, "--") === 0) {
$line = substr($line, 0, strpos($line, "--"));
}
if (empty( $line )) {
if (empty($line)) {
continue;
}
if (strpos( $line, "#" ) === 0) {
$line = substr( $line, 0, strpos( $line, "#" ) );
if (strpos($line, "#") === 0) {
$line = substr($line, 0, strpos($line, "#"));
}
if (empty( $line )) {
if (empty($line)) {
continue;
}
@@ -481,19 +454,19 @@ class PmTable
// If the current line doesnt end with ; then put this line together
// with the next one, thus supporting multi-line statements.
if (strrpos( $line, ";" ) != strlen( $line ) - 1) {
if (strrpos($line, ";") != strlen($line) - 1) {
$previous = $line;
continue;
}
$line = substr( $line, 0, strrpos( $line, ";" ) );
$line = substr($line, 0, strrpos($line, ";"));
// just execute the drop and create table for target table nad not for others
if (stripos( $line, 'CREATE TABLE' ) !== false || stripos( $line, 'DROP TABLE' ) !== false) {
$isCreateForCurrentTable = preg_match( '/CREATE\sTABLE\s[\[\'\"\`]{1}' . $this->tableName . '[\]\'\"\`]{1}/i', $line, $match );
if (stripos($line, 'CREATE TABLE') !== false || stripos($line, 'DROP TABLE') !== false) {
$isCreateForCurrentTable = preg_match('/CREATE\sTABLE\s[\[\'\"\`]{1}' . $this->tableName . '[\]\'\"\`]{1}/i', $line, $match);
if ($isCreateForCurrentTable) {
$queryStack['create'] = $line;
} else {
$isDropForCurrentTable = preg_match( '/DROP TABLE.*[\[\'\"\`]{1}' . $this->tableName . '[\]\'\"\`]{1}/i', $line, $match );
$isDropForCurrentTable = preg_match('/DROP TABLE.*[\[\'\"\`]{1}' . $this->tableName . '[\]\'\"\`]{1}/i', $line, $match);
if ($isDropForCurrentTable) {
$queryStack['drop'] = $line;
}
@@ -501,22 +474,22 @@ class PmTable
}
break;
case 'mssql':
$line = trim( $line ); // Remove comments from the script
$line = trim($line); // Remove comments from the script
if (strpos( $line, "--" ) === 0) {
$line = substr( $line, 0, strpos( $line, "--" ) );
if (strpos($line, "--") === 0) {
$line = substr($line, 0, strpos($line, "--"));
}
if (empty( $line )) {
if (empty($line)) {
continue;
}
if (strpos( $line, "#" ) === 0) {
$line = substr( $line, 0, strpos( $line, "#" ) );
if (strpos($line, "#") === 0) {
$line = substr($line, 0, strpos($line, "#"));
}
if (empty( $line )) {
if (empty($line)) {
continue;
}
@@ -528,47 +501,47 @@ class PmTable
// If the current line doesnt end with ; then put this line together
// with the next one, thus supporting multi-line statements.
if (strrpos( $line, ";" ) != strlen( $line ) - 1) {
if (strrpos($line, ";") != strlen($line) - 1) {
$previous = $line;
continue;
}
$line = substr( $line, 0, strrpos( $line, ";" ) );
$line = substr($line, 0, strrpos($line, ";"));
if (strpos( $line, $this->tableName ) == false) {
if (strpos($line, $this->tableName) == false) {
continue;
}
$auxCreate = explode( 'CREATE', $line );
$auxDrop = explode( 'IF EXISTS', $auxCreate['0'] );
$auxCreate = explode('CREATE', $line);
$auxDrop = explode('IF EXISTS', $auxCreate['0']);
$queryStack['drop'] = 'IF EXISTS' . $auxDrop['1'];
$queryStack['create'] = 'CREATE' . $auxCreate['1'];
break;
case 'oracle':
$line = trim( $line ); // Remove comments from the script
if (empty( $line )) {
$line = trim($line); // Remove comments from the script
if (empty($line)) {
continue;
}
switch (true) {
case preg_match( "/^CREATE TABLE\s/i", $line ):
if (strpos( $line, $this->tableName ) == true) {
case preg_match("/^CREATE TABLE\s/i", $line):
if (strpos($line, $this->tableName) == true) {
$inCreate = true;
$lineCreate .= $line . ' ';
}
break;
case preg_match( "/ALTER TABLE\s/i", $line ):
if (strpos( $line, $this->tableName ) == true) {
case preg_match("/ALTER TABLE\s/i", $line):
if (strpos($line, $this->tableName) == true) {
$inAlter = true;
$lineAlter .= $line . ' ';
}
break;
case preg_match( "/^DROP TABLE\s/i", $line ):
if (strpos( $line, $this->tableName ) == true) {
case preg_match("/^DROP TABLE\s/i", $line):
if (strpos($line, $this->tableName) == true) {
$inDrop = true;
$lineDrop .= $line . ' ';
if (strrpos( $line, ";" ) > 0) {
if (strrpos($line, ";") > 0) {
$queryStack['drop'] = $lineDrop;
$inDrop = false;
}
@@ -577,21 +550,21 @@ class PmTable
default:
if ($inCreate) {
$lineCreate .= $line . ' ';
if (strrpos( $line, ";" ) > 0) {
if (strrpos($line, ";") > 0) {
$queryStack['create'] = $lineCreate;
$inCreate = false;
}
}
if ($inAlter) {
$lineAlter .= $line . ' ';
if (strrpos( $line, ";" ) > 0) {
if (strrpos($line, ";") > 0) {
$queryStack['alter'] = $lineAlter;
$inAlter = false;
}
}
if ($inDrop) {
$lineDrop .= $line . ' ';
if (strrpos( $line, ";" ) > 0) {
if (strrpos($line, ";") > 0) {
$queryStack['drop'] = $lineDrop;
$inDrop = false;
}
@@ -621,12 +594,12 @@ class PmTable
}
if ($dbEngine == 'oracle') {
$queryStack['drop'] = substr( $queryStack['drop'], 0, strrpos( $queryStack['drop'], ";" ) );
$queryStack['create'] = substr( $queryStack['create'], 0, strrpos( $queryStack['create'], ";" ) );
$queryStack['alter'] = substr( $queryStack['alter'], 0, strrpos( $queryStack['alter'], ";" ) );
$queryStack['drop'] = substr($queryStack['drop'], 0, strrpos($queryStack['drop'], ";"));
$queryStack['create'] = substr($queryStack['create'], 0, strrpos($queryStack['create'], ";"));
$queryStack['alter'] = substr($queryStack['alter'], 0, strrpos($queryStack['alter'], ";"));
$queryIfExistTable = "SELECT TABLE_NAME FROM USER_TABLES WHERE TABLE_NAME = '" . $table . "'";
$rs = $stmt->executeQuery( $queryIfExistTable );
$rs = $stmt->executeQuery($queryIfExistTable);
if ($rs->next()) {
if ($this->keepData && $sqlTableBackup != null) {
@@ -638,27 +611,27 @@ class PmTable
$swTableBackup = 1;
}
$stmt->executeQuery( $queryStack['drop'] );
$stmt->executeQuery($queryStack['drop']);
}
$stmt->executeQuery( $queryStack['create'] );
$stmt->executeQuery( $queryStack['alter'] );
$stmt->executeQuery($queryStack['create']);
$stmt->executeQuery($queryStack['alter']);
} else {
if (isset( $queryStack['create'] )) {
if (isset($queryStack['create'])) {
// first at all we need to verify if we have a valid schema defined,
// so we verify that creating a dummy table
$swapQuery = str_replace( $table, $table . '_TMP', $queryStack['create'] );
$swapQuery = str_replace($table, $table . '_TMP', $queryStack['create']);
// if there is a problem with user defined table schema executeQuery() will throw a sql exception
$stmt->executeQuery( $swapQuery );
$stmt->executeQuery($swapQuery);
// if there was not problem above proceced deleting the dummy table and drop and create the target table
$stmt->executeQuery( "DROP TABLE {$table}_TMP" );
if (! isset( $queryStack['drop'] )) {
$stmt->executeQuery("DROP TABLE {$table}_TMP");
if (! isset($queryStack['drop'])) {
$queryStack['drop'] = "DROP TABLE {$table}";
}
if (! isset( $queryStack['create'] )) {
throw new Exception( 'A problem occurred resolving the schema to update for this table' );
if (! isset($queryStack['create'])) {
throw new Exception('A problem occurred resolving the schema to update for this table');
}
if ($this->keepData && $sqlTableBackup != null) {
@@ -684,8 +657,8 @@ class PmTable
}
}
$stmt->executeQuery( $queryStack['drop'] );
$stmt->executeQuery( $queryStack['create'] );
$stmt->executeQuery($queryStack['drop']);
$stmt->executeQuery($queryStack['create']);
}
}
@@ -693,13 +666,13 @@ class PmTable
$tableFileName = str_replace("_", " ", strtolower($table));
$tableFileName = str_replace(" ", null, ucwords($tableFileName));
require_once (PATH_WORKSPACE . "classes" . PATH_SEP . "$tableFileName.php");
require_once(PATH_WORKSPACE . "classes" . PATH_SEP . "$tableFileName.php");
$sql = "SELECT * FROM $tableBackup";
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
// array the primary keys
foreach($this->columns as $value) {
foreach ($this->columns as $value) {
if ($value->field_key == 1) {
$this->primaryKey[] = $value->field_name;
}
@@ -712,7 +685,7 @@ class PmTable
// verify row has all primary keys
$keys = 0;
foreach ($row as $colName => $value) {
if (in_array($colName,$this->primaryKey)){
if (in_array($colName, $this->primaryKey)) {
$keys++;
}
}
@@ -732,31 +705,31 @@ class PmTable
}
}
public function upgradeDatabaseFor ($dataSource, $tablesList = array())
public function upgradeDatabaseFor($dataSource, $tablesList = array())
{
$con = Propel::getConnection( $dataSource );
$con = Propel::getConnection($dataSource);
$stmt = $con->createStatement();
$lines = file( $this->dataDir . $this->dbConfig->adapter . PATH_SEP . 'schema.sql' );
$lines = file($this->dataDir . $this->dbConfig->adapter . PATH_SEP . 'schema.sql');
$previous = null;
$errors = '';
foreach ($lines as $j => $line) {
$line = trim( $line ); // Remove comments from the script
$line = trim($line); // Remove comments from the script
if (strpos( $line, "--" ) === 0) {
$line = substr( $line, 0, strpos( $line, "--" ) );
if (strpos($line, "--") === 0) {
$line = substr($line, 0, strpos($line, "--"));
}
if (empty( $line )) {
if (empty($line)) {
continue;
}
if (strpos( $line, "#" ) === 0) {
$line = substr( $line, 0, strpos( $line, "#" ) );
if (strpos($line, "#") === 0) {
$line = substr($line, 0, strpos($line, "#"));
}
if (empty( $line )) {
if (empty($line)) {
continue;
}
@@ -768,23 +741,23 @@ class PmTable
// If the current line doesnt end with ; then put this line together
// with the next one, thus supporting multi-line statements.
if (strrpos( $line, ";" ) != strlen( $line ) - 1) {
if (strrpos($line, ";") != strlen($line) - 1) {
$previous = $line;
continue;
}
$line = substr( $line, 0, strrpos( $line, ";" ) );
$line = substr($line, 0, strrpos($line, ";"));
// execute
$isCreate = stripos( $line, 'CREATE TABLE' ) !== false;
$isDrop = stripos( $line, 'DROP TABLE' ) !== false;
$isCreate = stripos($line, 'CREATE TABLE') !== false;
$isDrop = stripos($line, 'DROP TABLE') !== false;
if ($isCreate || $isDrop) {
if (preg_match( '/TABLE\s[\'\"\`]+(\w+)[\'\"\`]+/i', $line, $match )) {
if (in_array( $match[1], $tablesList )) {
if (preg_match('/TABLE\s[\'\"\`]+(\w+)[\'\"\`]+/i', $line, $match)) {
if (in_array($match[1], $tablesList)) {
//error_log($line);
try {
$stmt->executeQuery( $line );
$stmt->executeQuery($line);
} catch (Exception $e) {
$errors .= $e->getMessage() . "\n";
continue;
@@ -802,7 +775,7 @@ class PmTable
*
* @return boolean to affirm if was defined a column as pk.
*/
public function hasAutoIncrementPKey ()
public function hasAutoIncrementPKey()
{
foreach ($this->columns as $column) {
if ($column->field_autoincrement) {
@@ -817,14 +790,14 @@ class PmTable
*
* @return array contains all supported columns types provided by propel
*/
public function getPropelSupportedColumnTypes ()
public function getPropelSupportedColumnTypes()
{
/**
* http://www.propelorm.org/wiki/Documentation/1.2/Schema
* [type = "BOOLEAN|TINYINT|SMALLINT|INTEGER|BIGINT|DOUBLE|FLOAT|REAL|DECIMAL|CHAR|{VARCHAR}
* |LONGVARCHAR|DATE|TIME|TIMESTAMP|BLOB|CLOB"]
*/
$types = array ();
$types = array();
$types['BOOLEAN'] = 'BOOLEAN';
$types['TINYINT'] = 'TINYINT';
@@ -854,29 +827,29 @@ class PmTable
* @param string $name any string witha name separated by underscore
* @return string contains a camelcase expresion for $name
*/
public function toCamelCase ($name)
public function toCamelCase($name)
{
$tmp = explode( '_', trim( $name ) );
$tmp = explode('_', trim($name));
foreach ($tmp as $i => $part) {
$tmp[$i] = ucFirst( strtolower( $part ) );
$tmp[$i] = ucFirst(strtolower($part));
}
return implode( '', $tmp );
return implode('', $tmp);
}
/**
* Run om task for phing to build all mdoel classes
*/
public function phingbuildModel ()
public function phingbuildModel()
{
$this->_callPhing( 'om' );
$this->_callPhing('om');
}
/**
* Run sql task for phing to generate the sql schema
*/
public function phingbuildSql ()
public function phingbuildSql()
{
$this->_callPhing( 'sql' );
$this->_callPhing('sql');
}
/**
@@ -884,13 +857,13 @@ class PmTable
*
* @param string $taskName [om|sql]
*/
private function _callPhing ($taskName)
private function _callPhing($taskName)
{
$options = array ('project.dir' => $this->configDir,'build.properties' => "propel.{$this->dbConfig->adapter}.ini",'propel.targetPackage' => 'classes','propel.output.dir' => $this->targetDir,'propel.php.dir' => $this->baseDir
$options = array('project.dir' => $this->configDir, 'build.properties' => "propel.{$this->dbConfig->adapter}.ini", 'propel.targetPackage' => 'classes', 'propel.output.dir' => $this->targetDir, 'propel.php.dir' => $this->baseDir
);
self::callPhing( array ($taskName
), PATH_THIRDPARTY . 'propel-generator/build.xml', $options, false );
self::callPhing(array($taskName
), PATH_THIRDPARTY . 'propel-generator/build.xml', $options, false);
}
/**
@@ -900,38 +873,38 @@ class PmTable
* @param array $options - array options to override the options on .ini file
* @param bool $verbose - to show a verbose output
*/
public static function callPhing ($target, $buildFile = '', $options = array(), $verbose = true)
public static function callPhing($target, $buildFile = '', $options = array(), $verbose = true)
{
$args = array ();
$args = array();
foreach ($options as $key => $value) {
$args[] = "-D$key=$value";
}
if ($buildFile) {
$args[] = '-f';
$args[] = realpath( $buildFile );
$args[] = realpath($buildFile);
}
if (! $verbose) {
$args[] = '-q';
}
if (is_array( $target )) {
$args = array_merge( $args, $target );
if (is_array($target)) {
$args = array_merge($args, $target);
} else {
$args[] = $target;
}
if (DIRECTORY_SEPARATOR != '\\' && (function_exists( 'posix_isatty' ) && @posix_isatty( STDOUT ))) {
if (DIRECTORY_SEPARATOR != '\\' && (function_exists('posix_isatty') && @posix_isatty(STDOUT))) {
$args[] = '-logger';
$args[] = 'phing.listener.AnsiColorLogger';
}
Phing::startup();
Phing::setProperty( 'phing.home', getenv( 'PHING_HOME' ) );
Phing::setProperty('phing.home', getenv('PHING_HOME'));
$m = new pmPhing();
$m->execute( $args );
$m->execute($args);
$m->runBuild();
}
@@ -941,7 +914,7 @@ class PmTable
$confCasesList = $conf->getConfiguration('casesList', $action);
if (!class_exists('AdditionalTables')) {
require_once ("classes/model/AdditionalTables.php");
require_once("classes/model/AdditionalTables.php");
}
$oCriteria = new Criteria('workflow');
@@ -1000,4 +973,3 @@ class PmTable
return $oCriteria;
}
}

View File

@@ -305,7 +305,7 @@ class AdditionalTables extends BaseAdditionalTables
FieldsPeer::doDelete($criteria);
//remove all related to pmTable
$pmTable = new pmTable($additionalTable['ADD_TAB_NAME']);
$pmTable = new PmTable($additionalTable['ADD_TAB_NAME']);
$pmTable->setDataSource($additionalTable['DBS_UID']);
$pmTable->remove();
}
@@ -865,7 +865,7 @@ class AdditionalTables extends BaseAdditionalTables
// the class exists then load it.
require_once PATH_WORKSPACE . 'classes/' . $className . '.php';
// create a criteria object of report table class
$c = new Criteria(pmTable::resolveDbSource($row['DBS_UID']));
$c = new Criteria(PmTable::resolveDbSource($row['DBS_UID']));
// select all related records with this $appUid
eval('$c->add(' . $className . 'Peer::APP_UID, \'' . $appUid . '\');');
eval('$records = ' . $className . 'Peer::doSelect($c);');

View File

@@ -35,7 +35,7 @@
define( 'PATH_GULLIVER', PATH_GULLIVER_HOME . 'system' . PATH_SEP ); //gulliver system classes
define( 'PATH_GULLIVER_BIN', PATH_GULLIVER_HOME . 'bin' . PATH_SEP ); //gulliver bin classes
define( 'PATH_TEMPLATE', PATH_GULLIVER_HOME . 'templates' . PATH_SEP );
define( 'PATH_THIRDPARTY', PATH_GULLIVER_HOME . 'thirdparty' . PATH_SEP );
define( 'PATH_THIRDPARTY', PATH_TRUNK . 'thirdparty' . PATH_SEP );
define( 'PATH_RBAC', PATH_RBAC_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP ); //to enable rbac version 2
define( 'PATH_RBAC_CORE', PATH_RBAC_HOME . 'engine' . PATH_SEP );
define( 'PATH_HTML', PATH_HOME . 'public_html' . PATH_SEP );

View File

@@ -69,7 +69,7 @@ class pmTablesProxy extends HttpProxyController
foreach ($addTables['rows'] as $i => $table) {
try {
$con = Propel::getConnection( pmTable::resolveDbSource( $table['DBS_UID'] ) );
$con = Propel::getConnection( PmTable::resolveDbSource( $table['DBS_UID'] ) );
$stmt = $con->createStatement();
$rs = $stmt->executeQuery( 'SELECT COUNT(*) AS NUM_ROWS from ' . $table['ADD_TAB_NAME'] );
if ($rs->next()) {
@@ -1177,7 +1177,7 @@ class pmTablesProxy extends HttpProxyController
$additionalTables = new AdditionalTables();
$table = $additionalTables->load( $httpData->id );
if ($table['PRO_UID'] != '') {
$additionalTables->populateReportTable( $table['ADD_TAB_NAME'], pmTable::resolveDbSource( $table['DBS_UID'] ), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID'], $table['ADD_TAB_UID'] );
$additionalTables->populateReportTable( $table['ADD_TAB_NAME'], PmTable::resolveDbSource( $table['DBS_UID'] ), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID'], $table['ADD_TAB_UID'] );
$result->message = 'generated for table ' . $table['ADD_TAB_NAME'];
}

View File

@@ -23,7 +23,6 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
//if (($RBAC_Response=$RBAC->userCanAccess("PM_USERS"))!=1) return $RBAC_Response;
G::LoadInclude( 'ajax' );
$_POST['action'] = get_ajax_value( 'action' );
switch ($_POST['action']) {

View File

@@ -62,7 +62,6 @@ function LookForChildren ($parent, $level, $aDepUsers)
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
G::LoadInclude( 'ajax' );
$_POST['action'] = get_ajax_value( 'action' );
require_once 'classes/model/Department.php';

View File

@@ -40,8 +40,6 @@ function pagedTable_BeforeQuery (&$ntable)
require_once (PATH_GULLIVER_HOME . 'methods/pagedTableAjax.php');
die();
G::LoadInclude( 'ajax' );
$id = get_ajax_value( 'ptID' );
$ntable = unserialize(base64_decode($_SESSION['pagedTable[' . $id . ']']));
$page = get_ajax_value( 'page' );

View File

@@ -24,7 +24,6 @@
if (($RBAC_Response = $RBAC->userCanAccess( "PM_USERS" )) != 1) {
return $RBAC_Response;
}
G::LoadInclude( 'ajax' );
$_POST['action'] = get_ajax_value( 'action' );
switch ($_POST['action']) {

View File

@@ -23,7 +23,6 @@
*
*/
try {
G::LoadInclude ( 'ajax' );
if (isset ( $_POST ['form'] )) {
$_POST = $_POST ['form'];
}

View File

@@ -21,7 +21,6 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
G::LoadInclude( 'ajax' );
//$oJSON = new Services_JSON();
if (isset( $_POST['mode'] ) && $_POST['mode'] != '') {
$aData = $_POST;

View File

@@ -27,7 +27,6 @@ try {
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
G::LoadInclude( 'ajax' );
if (isset( $_POST['form'] )) {
$_POST = $_POST['form'];
}

View File

@@ -33,7 +33,6 @@ if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_FACTORY
die();
}
G::LoadInclude( 'ajax' );
//G::pr($_SESSION);
$_POST['action'] = get_ajax_value( 'action' );
if ($_POST['action'] == '') {

View File

@@ -23,8 +23,6 @@
*/
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
G::LoadInclude( 'ajax' );
$G_ENABLE_BLANK_SKIN = true;
$ARR_WEEKDAYS[0] = array ('SUNDAY','MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY'

View File

@@ -24,8 +24,6 @@
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
G::ForceLogin( 'WF_PROCESS' );
G::LoadInclude( 'ajax' );
$G_HELP_PAGE = "setup-environment-time-controls-weekend";
$G_MAIN_MENU = "processmaker";

View File

@@ -43,7 +43,6 @@ try {
require_once 'classes/model/StepTrigger.php';
require_once 'classes/model/Triggers.php';
G::LoadInclude( 'ajax' );
if (! empty( $_GET )) {
if (! isset( $_GET['form'] )) {
$aData = urldecode_values( $_GET );

View File

@@ -22,7 +22,6 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
ini_set( 'display_errors', 'off' );
G::LoadInclude( 'ajax' );
$function = get_ajax_value( 'function' );
$cat = get_ajax_value( 'cat' );
$node = get_ajax_value( 'node' );

View File

@@ -130,7 +130,7 @@ class Table
$table = $additionalTables->load($rep_uid);
$additionalTables->populateReportTable(
$table['ADD_TAB_NAME'],
\pmTable::resolveDbSource( $table['DBS_UID'] ),
\PmTable::resolveDbSource( $table['DBS_UID'] ),
$table['ADD_TAB_TYPE'],
$table['PRO_UID'],
$table['ADD_TAB_GRID'],
@@ -361,7 +361,7 @@ class Table
throw (new \Exception("The fields must have a key 'fld_key'"));
}
$pmTable = new \pmTable($tableName);
$pmTable = new \PmTable($tableName);
$pmTable->setDataSource($tableCon);
$pmTable->setColumns($columnsStd);
$pmTable->setAlterTable(true);

View File

@@ -187,7 +187,7 @@ define( 'PATH_GULLIVER_HOME', PATH_TRUNK . 'gulliver' . PATH_SEP );
define( 'PATH_GULLIVER', PATH_GULLIVER_HOME . 'system' . PATH_SEP ); //gulliver system classes
define( 'PATH_GULLIVER_BIN', PATH_GULLIVER_HOME . 'bin' . PATH_SEP ); //gulliver bin classes
define( 'PATH_TEMPLATE', PATH_GULLIVER_HOME . 'templates' . PATH_SEP );
define( 'PATH_THIRDPARTY', PATH_GULLIVER_HOME . 'thirdparty' . PATH_SEP );
define( 'PATH_THIRDPARTY', PATH_TRUNK . 'thirdparty' . PATH_SEP );
define( 'PATH_RBAC', PATH_RBAC_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP ); //to enable rbac version 2
define( 'PATH_RBAC_CORE', PATH_RBAC_HOME . 'engine' . PATH_SEP );