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