--- a/busui/owa/cli.php +++ b/busui/owa/cli.php @@ -1,1 +1,92 @@ + + * @copyright Copyright © 2010 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.2.1 + */ + +define('OWA_CLI', true); + +if (!empty($_POST)) { + exit(); +} elseif (!empty($_GET)) { + exit(); +} elseif (!empty($argv)) { + $params = array(); + // get params from the command line args + // $argv is a php super global variable + + for ($i=1; $iisEndpointEnabled( basename( __FILE__ ) ) ) { + + // setting CLI mode to true + $owa->setSetting('base', 'cli_mode', true); + // setting user auth + $owa->setCurrentUser('admin', 'cli-user'); + // run controller or view and echo page content + $s = owa_coreAPI::serviceSingleton(); + $s->loadCliCommands(); + + if (array_key_exists('cmd', $params)) { + + $cmd = $s->getCliCommandClass($params['cmd']); + + if ($cmd) { + $params['do'] = $cmd; + echo $owa->handleRequest($params); + } else { + echo "Invalid command name."; + } + + } else { + echo "Missing a command argument."; + } + +} else { + // unload owa + $owa->restInPeace(); +} + +?>