install.php
changeset 27 dd659f6ba891
parent 21 663fcf528726
child 32 4d87aad3c4c0
--- a/install.php	Tue Jun 26 22:01:17 2007 -0400
+++ b/install.php	Wed Jun 27 00:59:42 2007 -0400
@@ -1044,11 +1044,45 @@
       // Not anymore!! :-D
       // $schema = str_replace('{{BETA_VERSION}}', ENANO_BETA_VERSION,                              $schema);
       
-      if(isset($_POST['wiki_mode'])) $schema = str_replace('{{WIKI_MODE}}', '1', $schema);
-      else $schema = str_replace('{{WIKI_MODE}}', '0', $schema);
+      if(isset($_POST['wiki_mode']))
+      {
+        $schema = str_replace('{{WIKI_MODE}}', '1', $schema);
+      }
+      else
+      {
+        $schema = str_replace('{{WIKI_MODE}}', '0', $schema);
+      }
       
       // Build an array of queries      
+      $schema = explode("\n", $schema);
+      
+      foreach ( $schema as $i => $sql )
+      {
+        $query =& $schema[$i];
+        $t = trim($query);
+        if ( empty($t) || preg_match('/^(\#|--)/i', $t) )
+        {
+          unset($schema[$i]);
+          unset($query);
+        }
+      }
+      
+      $schema = array_values($schema);
+      $schema = implode("\n", $schema);
       $schema = explode(";\n", $schema);
+      
+      foreach ( $schema as $i => $sql )
+      {
+        $query =& $schema[$i];
+        if ( substr($query, ( strlen($query) - 1 ), 1 ) != ';' )
+        {
+          $query .= ';';
+        }
+      }
+      
+      // echo '<pre>' . htmlspecialchars(print_r($schema, true)) . '</pre>';
+      // break;
+      
       echo 'done!<br />Executing schema.sql...';
       
       // OK, do the loop, baby!!!