RunGenerator.php
[Pman.Core] / RunGenerator.php
index ab5930b..4bcb0cf 100644 (file)
 require_once 'Pman.php';
 class Pman_Core_RunGenerator extends Pman
 {     
+    static $cli_desc = "Generate DataObjects (runs updatedatabase first)";
+   
+    static $cli_opts = array(
+        'module' => array(
+            'desc' => 'Module',
+            'short' => 'm',
+            'default' => '',
+            'min' => 1,
+            'max' => 1,
+            
+        ),
+        'overwrite' => array(
+            'desc' => 'Files to Overwrite',
+            'default' => '',
+            'short' => 'o',
+            'min' => 1,
+            'max' => 999,
+            
+        )
+        
+    );
+    
     var $cli = false;
     function getAuth() {
         
-        $o = PEAR::getStaticProperty('HTML_FlexyFramework', 'options');
-        if (!empty($o['cli'])) {
+        
+        $ff = HTML_FlexyFramework::get();
+        if (!empty($ff->cli)) {
             $this->cli = true;
             return true;
         }
@@ -29,8 +52,14 @@ class Pman_Core_RunGenerator extends Pman
         return true;
     }
      
-    function get($args)
+    function get($args, $opts)
     {
+        
+        
+        HTML_FlexyFramework::run('Core/UpdateDatabase');
+        
+         
+        
         require_once 'Pman/Core/Generator.php';
         ini_set('pcre.backtrack_limit', 2000000);
         ini_set('pcre.recursion_limit', 2000000);
@@ -42,12 +71,17 @@ class Pman_Core_RunGenerator extends Pman
         }
         $x = new Pman_Core_Generator();
        // $x->page = clone($this);
-        $x->start($this->cli, $args, $lastarg);
+       
+        
+        $modules = is_string($opts['modules']) ? array($opts['modules']) : $opts['modules'];
+        $overwrite = is_string($opts['overwrite']) ? array($opts['overwrite']) : $opts['overwrite'];
+
+        $x->start($this->cli, $modules, overwrite);
         
         // technically it would be good to trash the cached ini files here.. 
         // however we can not really do that, as the ownships are off..
         //we can however regen our own files..
-        HTML_FlexyFramework::generateDataobjectsCache(true);
+        HTML_FlexyFramework::get()->generateDataobjectsCache(true);
         
         die("done!");
     }