php7 fixes
[Pman.Builder] / Dump.php
index bf0edf7..0723729 100644 (file)
--- a/Dump.php
+++ b/Dump.php
@@ -8,9 +8,11 @@ class Pman_Builder_Dump extends Pman
     // getAuth - everyone allowed in...
     function getAuth() {
         return true;
+        exit;
     }
   
-    function get($app) {
+    function get($app, $opts = array()) {
+        die("DISABLED");
         $b = DB_DataObject::Factory('Builder');
         $b->find();
         echo '<PRE>';
@@ -18,13 +20,18 @@ class Pman_Builder_Dump extends Pman
         
         $map = array(
             'Clipping' => 'web.MediaOutreach/Pman/Clipping',
+            'PressRelease' => 'web.MediaOutreach/Pman/PressRelease',
             'Ris' => 'web.Ris/Pman/Ris',
             'TestApp' => false,
             'Hex' => false,
             'Example' => false,
             'ExampleOld' => false,
+            'Deleted' => false,
+            'DealFlow' => 'web.Dealflow/Pman/DealFlow',
+            'Aviation' => 'web.Aviation/Pman/Aviation',
             
         );
+        $dirs = array();
         while ($b->fetch()) {
           //  print_r($b);
             
@@ -40,8 +47,8 @@ class Pman_Builder_Dump extends Pman
            // {"id":"roo-file-1","name":"layout test.bjs","parent":"","title":false,"path":"/h
                 //ome/alan/buildertest/layout test.bjs"
             $fn = $dir ."Pman.". trim($data->app) . '/' . $data->name . '.bjs';
-            if (isseT($map[$data->app])) {
-                if ($map[$data->app] === false) {
+            if (isseT($map[trim($data->app)])) {
+                if ($map[trim($data->app)] === false) {
                     continue;
                 }
                 $fn = $dir .$map[$data->app]. '/' . $data->name . '.bjs';
@@ -54,11 +61,28 @@ class Pman_Builder_Dump extends Pman
                 print "<B>SKIP " . $fn . "</B>\n";
                 continue;
             }
-            echo "WRITE : " . $fn . "\n";
-            echo "                          " .htmlspecialchars(json_encode($data)) . "\n";
             
+            $dirs[dirname($fn)] = true;
+            echo "WRITE : " . $fn . "\n";
+            //echo "                          " .htmlspecialchars(json_encode($data)) . "\n";
+            file_put_contents($fn, json_encode($data));
             
              
+        }
+        print_r($dirs);
+        foreach($dirs as $d => $n)
+        {
+            
+            chdir($d);
+            $cmd  = 'git pull 2>&1';
+            echo $cmd ."\n" . `$cmd`;
+            
+            $cmd  = 'git add --all 2>&1';
+            echo $cmd ."\n" . `$cmd`;
+            $cmd  = "git commit -m 'add bjs' -a --author='Alan Knowles <alan@akbkhome.com>' 2>&1";
+            echo $cmd ."\n" . `$cmd`;
+            $cmd  = "git push  2>&1";
+            echo $cmd ."\n" . `$cmd`;
         }
         exit;