DataObjects/ProjectDirectory.php
[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     var $cli = false;
15     function getAuth() {
16         
17         
18         $ff = HTML_FlexyFramework::get();
19         if (!empty($ff->cli)) {
20             $this->cli = true;
21             return true;
22         }
23         
24         parent::getAuth(); // load company!
25         $au = $this->getAuthUser();
26         if (!$au || $au->company()->comptype != 'OWNER') {
27             $this->jerr("Not authenticated", array('authFailure' => true));
28         }
29         $this->authUser = $au;
30         return true;
31     }
32      
33     function get($args)
34     {
35         require_once 'Pman/Core/Generator.php';
36         ini_set('pcre.backtrack_limit', 2000000);
37         ini_set('pcre.recursion_limit', 2000000);
38         $this->init();
39          
40         $lastarg = $this->cli  ? array_pop($_SERVER['argv']) : '';
41         if (preg_match('/RunGenerator/', $lastarg)) {
42             $lastarg  = '';
43         }
44         $x = new Pman_Core_Generator();
45        // $x->page = clone($this);
46         $x->start($this->cli, $args, $lastarg);
47         
48         // technically it would be good to trash the cached ini files here.. 
49         // however we can not really do that, as the ownships are off..
50         //we can however regen our own files..
51         HTML_FlexyFramework::get()->generateDataobjectsCache(true);
52         
53         die("done!");
54     }
55     
56 }