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