Initial commit
This commit is contained in:
47
CLI.php
Normal file
47
CLI.php
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/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);
|
||||
|
||||
Reference in New Issue
Block a user