summaryrefslogtreecommitdiff
path: root/framework/prado-cli.php
diff options
context:
space:
mode:
authorChristophe.Boulain <>2010-02-15 09:20:35 +0000
committerChristophe.Boulain <>2010-02-15 09:20:35 +0000
commitd860219f366a8fbe63b03d26c69525d4e6bd4f3a (patch)
tree6520a9a0a70a941d122de10d8f5ae9e3883a0ac6 /framework/prado-cli.php
parent94e94e0a8566f23d16658a04c55b0bbfdd6689aa (diff)
Merge from r2765 (and some others) 3.1
Added TActiveTableRow QST page Corrected an uninitialized array in TScaffoldBase
Diffstat (limited to 'framework/prado-cli.php')
-rwxr-xr-xframework/prado-cli.php53
1 files changed, 53 insertions, 0 deletions
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 <Christophe Boulain@gmail.com>
+ * @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 (<xml>) 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))
{