maj version dans config.xml
[mtweb] / cli.php
1 <?php
2
3   if(!isset($argv) || !$argv){
4     echo "variable argv non disponible\n";
5     return;
6   }
7
8   $path_file = "pathes.php";
9   $FIRST = false;
10   foreach($argv as $cmd_arg){
11     if(!$FIRST){
12       $FIRST = true;
13       continue;
14     }
15     if(strlen($cmd_arg)){
16       if(($k = strpos($cmd_arg, "=")) && (substr($cmd_arg, 0, $k) == "path_file")){
17         $path_file = substr($cmd_arg, $k + 1);
18       }
19     }
20   }  
21   if(!$path_file || !file_exists($path_file)){
22     echo "fichier des chemins introuvable\n";
23     return;
24   }
25
26   require $path_file;
27   $PATHES["mw_dir"] .= $PATHES["mw_dir"] && substr($PATHES["mw_dir"], -1) != "/" ? "/" : "";
28   require $PATHES["mw_dir"]."mw_app.php";
29
30   $app = new mw_app($path_file);
31
32   if(($res = $app->init()) !== true){
33     echo $res."\n";
34     return;
35   }
36
37   $env = $app->env();
38
39   if(($res = $env->run_cli($argv)) !== true){
40     echo $res."\n";
41     return;
42   }
43
44   debug($env->get_out());