looking for wrong seperator
[Pman.Core] / 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_Core_RunGenerator extends Pman
13 {     
14     static $cli_desc = "Generate DataObjects (runs updatedatabase first)  
15                      does not change files, just shows you want would happen";
16         
17         
18     static $cli_opts = array(
19         'module' => array(
20             'desc' => 'Module (if new tables are found, they will be put in the modules database directory',
21             'short' => 'm',
22             'default' => '',
23             'min' => 1,
24             'max' => 1,
25             
26         ),
27         'overwrite' => array(
28             'desc' => 'Files to Overwrite (use _all_ to create everything)',
29             'default' => '',
30             'short' => 'o',
31             'min' => 1,
32             'max' => -1,
33             
34         ),
35         'noupdate' => array(
36             'desc' => 'Do not update the database using sql',
37             'default' => '',
38             'short' => 'n',
39             'min' => 1,
40             'max' => -1,
41             
42         )
43         
44     );
45     
46     var $cli = false;
47     function getAuth() {
48         
49         
50         $ff = HTML_FlexyFramework::get();
51         if (!empty($ff->cli)) {
52             $this->cli = true;
53             return true;
54         }
55         
56         parent::getAuth(); // load company!
57         $au = $this->getAuthUser();
58         if (!$au || $au->company()->comptype != 'OWNER') {
59             $this->jerr("Not authenticated", array('authFailure' => true));
60         }
61         $this->authUser = $au;
62         return true;
63     }
64      
65     function get($args, $opts=array())
66     {
67         //print_r($opts);exit;
68         if (empty($opts['noupdate'])) {
69             HTML_FlexyFramework::run('Core/UpdateDatabase');
70         }
71         
72         
73          
74         
75         require_once 'Pman/Core/Generator.php';
76         ini_set('pcre.backtrack_limit', 2000000);
77         ini_set('pcre.recursion_limit', 2000000);
78         $this->init();
79         
80         $x = new Pman_Core_Generator();
81        // $x->page = clone($this);
82        
83         
84         $modules = $opts['module'];
85         // overwrite can be multiple
86         $overwrite = is_string($opts['overwrite']) ? array($opts['overwrite']) : $opts['overwrite'];
87
88         $x->start($this->cli, $modules, $overwrite);
89         
90         // technically it would be good to trash the cached ini files here.. 
91         // however we can not really do that, as the ownships are off..
92         //we can however regen our own files..
93         HTML_FlexyFramework::get()->generateDataobjectsCache(true);
94         
95         die("done!");
96     }
97     
98 }