Files
thetool/CLI.php
Frank Schubert 4ea4927931 Initial commit
2021-03-29 23:04:42 +02:00

48 lines
1.1 KiB
PHP

#!/usr/bin/php
<?php
/**
* This is the default mvcfronk CLI starting point. You might want to rename it to your
* applications name.
* Sets various needed constants and loads Router class, which runs approriate Controller
*
* @author Frank Schubert <fronk@fronk.at>
* @version 2016-08-28
*/
define('mfUI',"cli");
/* If true, FronkDB prints all SQL Statements */
define('FRONKDB_SQLDEBUG',false);
/* Set default Timezone and error reporting */
ini_set("date.timezone","Europe/Vienna");
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
/* Set paths */
define('BASEDIR',realpath(dirname(__FILE__)));
define('LIBDIR',realpath(BASEDIR."/lib")."/");
define('APPDIR',realpath(BASEDIR."/application")."/");
$request=array();
// Put commandline arguments into $request
if(count($argv)) {
$args=$argv;
array_shift($args); // shift scriptname off of args array
foreach($args as $i => $arg) {
if(preg_match('/^--([^ ]+)/',$arg,$m)) {
if(!preg_match('/^--/',$args[$i+1])) {
$request[$m[1]]=$args[$i+1];
}
}
}
}
// Start Application
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
$app=new mfRouter($request);