From d860219f366a8fbe63b03d26c69525d4e6bd4f3a Mon Sep 17 00:00:00 2001 From: "Christophe.Boulain" <> Date: Mon, 15 Feb 2010 09:20:35 +0000 Subject: Merge from r2765 (and some others) 3.1 Added TActiveTableRow QST page Corrected an uninitialized array in TScaffoldBase --- framework/prado-cli.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'framework/prado-cli.php') diff --git a/framework/prado-cli.php b/framework/prado-cli.php index 9b9153c3..f9185e6b 100755 --- a/framework/prado-cli.php +++ b/framework/prado-cli.php @@ -43,6 +43,7 @@ PradoCommandLineInterpreter::getInstance()->addActionClass('PradoCommandLineCrea PradoCommandLineInterpreter::getInstance()->addActionClass('PradoCommandLinePhpShell'); PradoCommandLineInterpreter::getInstance()->addActionClass('PradoCommandLineUnitTest'); PradoCommandLineInterpreter::getInstance()->addActionClass('PradoCommandLineActiveRecordGen'); +PradoCommandLineInterpreter::getInstance()->addActionClass('PradoCommandLineConvertConfig'); //run it; PradoCommandLineInterpreter::getInstance()->run($_SERVER['argv']); @@ -730,6 +731,58 @@ EOD; } } +/** + * Convert prado 3.1 XML configuration to new prado 3.2 PHP array configuration + * + * @author Christophe Boulain + * @version $Id$ + * @since 3.2 + */ +class PradoCommandLineConvertConfig extends PradoCommandLineAction +{ + + protected $action = 'xmltophp'; + protected $parameters = array('xml'); + protected $optional = array('output'); + protected $description = 'Convert a prado xml configuration file () to a php array. '; + + public function performAction($args) + { + $xml=realpath($args[1]); + if (!is_file($xml)) + { + echo "Unable to find {$args[1]} file.\n"; + return true; + } + $output=$args[2]; + if ($output===null) + $output=dirname($xml).DIRECTORY_SEPARATOR.basename($xml, 'xml')."php"; + if (!is_writable(realpath(dirname($output)))) + { + echo "Can't write new config file {$output}\n"; + return true; + } + $config=$this->parseXML($xml); + print_r($config); + + return true; + } + + /** + * Open and parse an xml config file. + * @param string $xml the filepath of xml file + * @return array + */ + protected function parseXML($xml) + { + $dom=new DOMDocument(); + $dom->load($xml); + print_r ($dom->childNodes); + return ; + } + +} + //run PHP shell if(class_exists('PHP_Shell_Commands', false)) { -- cgit v1.2.3