DataObjects/Core_watch.php
[Pman.Core] / UpdateDatabase.php
index 13071c9..3bb92ef 100644 (file)
@@ -101,8 +101,8 @@ class Pman_Core_UpdateDatabase extends Pman
                     continue;
                 }
                 // .my.sql but not .pg.sql
-                if (preg_match('/#.[a-z]{2}\.sql#i', basename($bfn))
-                    && !preg_match('/#\.my\.sql#i', basename($bfn))
+                if (preg_match('#\.[a-z]{2}\.sql#i', basename($fn))
+                    && !preg_match('#\.my\.sql#i', basename($fn))
                 ) { // skip migration scripts at present..
                     continue;
                 }
@@ -186,7 +186,7 @@ class Pman_Core_UpdateDatabase extends Pman
                 // files ending in .pg.sql are native postgres files..
                 $fn = preg_match('#\.pg\.sql$#', basename($bfn)) ? false : $this->convertToPG($bfn);
                 
-                $cmd = "$psql_cmd -f  " . escapeshellarg($fn ? $fn : $bfn) . ' 2>&1' ;
+                $cmd = "$psql_cmd  < " . escapeshellarg($fn ? $fn : $bfn) . ' 2>&1' ;
                 
                 echo "$bfn:   $cmd ". ($this->cli ? "\n" : "<BR>\n");
                 
@@ -201,27 +201,26 @@ class Pman_Core_UpdateDatabase extends Pman
             
             
             $fd = $this->rootDir. "/Pman/$m/sql";
-            
+            // sql directory  - we try to convert..
             foreach(glob($fd.'/*.sql') as $bfn) {
                 $fn =  $this->convertToPG($bfn);
-                $cmd = "$psql_cmd -f < " . escapeshellarg($fn) ;
+                $cmd = "$psql_cmd  < " . escapeshellarg($fn) ;
                 echo $cmd. ($this->cli ? "\n" : "<BR>\n");
                 passthru($cmd);
             }
             
+            // postgres specific directory..
+            
             $fd = $this->rootDir. "/Pman/$m/pgsql";
             
             foreach(glob($fd.'/*.sql') as $fn) {
-                $cmd = "$psql_cmd -f < " . escapeshellarg($fn) ;
+                $cmd = "$psql_cmd   < " . escapeshellarg($fn) ;
                 echo $cmd. ($this->cli ? "\n" : "<BR>\n");
                 passthru($cmd);
             }
             
             
             
-            
-            
-            
         }
         
     }