php7 fixes
[Pman.Builder] / RunGenerator.php
1 <?php
2
3 /**
4  * 
5  * this is technically a cli wrapper for the generator..
6  * 
7  * we will test it on the web initially..
8  * 
9  * 
10  */
11 require_once 'Pman.php';
12 class Pman_Builder_RunGenerator extends Pman
13 {     
14     var $cli = false;
15     
16     
17     static $cli_desc  = "Creates Database Tables for modules";
18     
19     static $cli_opts  = array(
20         'module' => array(
21             'short' => 'm',
22             'min' => 1,
23             'max' => 1,
24             'default' => '',
25             'desc' => 'Module to Generate'  
26         ),
27         'update-db' => array(
28             'short' => 'd',
29             'min' => 0,
30             'max' => 0,
31             'desc' => 'Flag to just run database updates'  
32         ),
33         
34         'update-files' => array(
35             'short' => 'f',
36             'min' => 1,
37             'max' => 99,
38             'default' => array(),
39             'desc' => 'Files to update, eg. -f pman.ini -f Mtrack_wiki.php ' 
40         ),
41         
42         
43     );
44     
45     
46     
47     
48     
49     
50     
51     
52     
53     function getAuth() {
54         
55         $o = PEAR::getStaticProperty('HTML_FlexyFramework', 'options');
56         if (!empty($o['cli'])) {
57             $this->cli = true;
58             return true;
59         }
60         
61         parent::getAuth(); // load company!
62         $au = $this->getAuthUser();
63         if (!$au || $au->company()->comptype != 'OWNER') {
64             $this->jerr("Not authenticated", array('authFailure' => true));
65         }
66         $this->authUser = $au;
67         return true;
68     }
69      
70     function get($args,$opts = array())
71     {
72         
73         print_R($opts); exit;
74         
75         require_once 'Pman/Builder/Generator.php';
76         ini_set('pcre.backtrack_limit', 2000000);
77         ini_set('pcre.recursion_limit', 2000000);
78         $this->init();
79          
80         $lastarg = $this->cli  ? array_pop($_SERVER['argv']) : '';
81         if (preg_match('/RunGenerator/', $lastarg)) {
82             $lastarg  = '';
83         }
84         $x = new Pman_Builder_Generator();
85        // $x->page = clone($this);
86         $x->start($this->cli, $args, $lastarg);
87         die("done!");
88     }
89     
90 }