From ec971836e850f9fd96cee2f1737c70f141f21d9d Mon Sep 17 00:00:00 2001 From: hjonathan Date: Fri, 1 Sep 2017 14:59:19 -0400 Subject: [PATCH] HOR-3821 update --- gulliver/bin/tasks/pakePropel.php | 82 ++++++++++++++++--------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/gulliver/bin/tasks/pakePropel.php b/gulliver/bin/tasks/pakePropel.php index 52d7d721b..f2c8ac6d8 100644 --- a/gulliver/bin/tasks/pakePropel.php +++ b/gulliver/bin/tasks/pakePropel.php @@ -223,51 +223,53 @@ function run_propel_build_model($task, $args) function run_propel_build_sql($task, $args) { - if ( isset ( $args[1] ) ) { - $propelIniFile = $args[1] . '.ini'; - $alternateDir = ''; - if ( ! file_exists ( 'config' . PATH_SEP . $propelIniFile ) ) { - $path = explode ( '/', $args[1] ); - if ( count($path) > 2 ) - throw new Exception('the propel.ini must be in your config directory.'); - if ( count($path) == 1 ) - $path[1] = 'propel'; + $alternateDir = ''; + if (isset ($args[1])) { + $propelIniFile = $args[1] . '.ini'; + $alternateDir = ''; + if (!file_exists('config' . PATH_SEP . $propelIniFile)) { + $path = explode('/', $args[1]); + if (count($path) > 2) + throw new Exception('the propel.ini must be in your config directory.'); + if (count($path) == 1) + $path[1] = 'propel'; - $propelIniFile = 'plugins' .PATH_SEP . $path[0] . PATH_SEP . 'config' . PATH_SEP . $path[1] . '.ini'; - if ( ! file_exists($propelIniFile) ) - throw new Exception("the propel.ini must be in your config directory. ($propelIniFile)"); + $propelIniFile = 'plugins' . PATH_SEP . $path[0] . PATH_SEP . 'config' . PATH_SEP . $path[1] . '.ini'; + if (!file_exists($propelIniFile)) + throw new Exception("the propel.ini must be in your config directory. ($propelIniFile)"); - pake_echo_action('propel.ini', "using the file : $propelIniFile "); - $alternateDir = PATH_PLUGINS . $path[0] . PATH_SEP; - //_call_phing($task, 'om', false, $path[1] . '.ini' , PATH_PLUGINS . $path[0] . PATH_SEP ); - //return; - } + pake_echo_action('propel.ini', "using the file : $propelIniFile "); + $alternateDir = PATH_PLUGINS . $path[0] . PATH_SEP; + } - } - - $aDB = array('mysql', 'mssql', 'oracle', 'pgsql'); - - if ( !in_array($args[0], $aDB)) { - throw new Exception('invalid database Adapter, available:[mysql|mssql|oracle|pgsql].'); - } - else { - switch ( $args [0]) { - case 'mysql' : if ( $alternateDir != '' ) - _call_phing($task, 'sql', false, 'propel.mysql.ini', $alternateDir ); - else - _call_phing($task, 'sql', true, 'propel.mysql.ini' ); - break; - case 'mssql' : _call_phing($task, 'sql', true, 'propel.mssql.ini' ); - break; - case 'oracle' : _call_phing($task, 'sql', true, 'propel.oracle.ini' ); - break; - case 'pgsql' : _call_phing($task, 'sql', true, 'propel.pgsql.ini' ); - break; - default : - throw new Exception('specify database Adapter, valid values are: mysql, mssql, oracle, pgsql.'); } - } + $aDB = array('mysql', 'mssql', 'oracle', 'pgsql'); + + if (!in_array($args[0], $aDB)) { + throw new Exception('invalid database Adapter, available:[mysql|mssql|oracle|pgsql].'); + } else { + switch ($args [0]) { + case 'mysql' : + if ($alternateDir != '') + _call_phing($task, 'sql', false, 'propel.mysql.ini', $alternateDir); + else + _call_phing($task, 'sql', true, 'propel.mysql.ini'); + break; + case 'mssql' : + _call_phing($task, 'sql', true, 'propel.mssql.ini'); + break; + case 'oracle' : + _call_phing($task, 'sql', true, 'propel.oracle.ini'); + break; + case 'pgsql' : + _call_phing($task, 'sql', true, 'propel.pgsql.ini'); + break; + default : + throw new Exception('specify database Adapter, valid values are: mysql, mssql, oracle, pgsql.'); + } + + } } function run_propel_build_db($task, $args)