Fix create_schema.php to work with the current version of ISSO and BSDb
authorRobert Sesek <rsesek@bluestatic.org>
Wed, 9 Jul 2008 15:30:01 +0000 (11:30 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Wed, 9 Jul 2008 15:30:01 +0000 (11:30 -0400)
* docs/tools/create_schema.php

docs/tools/create_schema.php

index d5f78f8722b81e559554df10015e32449fa4e039..f1e87308a977e66acff677a1343f7f573b0b2506 100644 (file)
@@ -3,11 +3,15 @@
 // creates schema file output
 // $Id$
 
-ini_set('include_path', ini_get('include_path') . ':/Server/htdocs');
-require_once(ISSO . '/App.php');
+error_reporting(E_ALL ^ E_NOTICE);
 
-$db = BSApp::LoadModule('DbMySQL');
-$input = BSApp::LoadModule('Input');
+define('ISSO', dirname(dirname(getcwd())));
+require_once ISSO . '/App.php';
+require_once ISSO . '/DbMySqlI.php';
+require_once ISSO . '/Input.php';
+
+$db = BSApp::$db = new BSDbMySqlI();
+$input = BSApp::$input = new BSInput();
 
 if (empty($_REQUEST['submit']))
 {
@@ -35,13 +39,13 @@ if (empty($_REQUEST['submit']))
 }
 else
 {
-       $db->connect($input->in['server'], $input->in['username'], $input->in['password'], $input->in['database'], false);
+       $db->connect($input->in['server'], $input->in['username'], $input->in['password'], $input->in['database']);
        
        $t = ($input->in['encase'] ? '`' : '');
        $prefix = ($input->in['prefix'] ? '" . TABLE_PREFIX . "' : '');
        
        $tables = $db->query("SHOW TABLES");
-       while ($table = $db->fetchArray($tables, false))
+       while ($table = $tables->fetchArray(false))
        {
                $table = $table[0];
                $list = array();
@@ -50,7 +54,7 @@ else
                $build = "CREATE TABLE $t$prefix$table$t\n(\n";
                
                $indexes = $db->query("SHOW INDEX FROM $table");
-               while ($index = $db->fetchArray($indexes))
+               while ($index = $indexes->fetchArray())
                {
                        array_walk($index, 'trim');
                        
@@ -84,7 +88,7 @@ else
                }
        
                $fields = $db->query("DESCRIBE $table");
-               while ($field = $db->fetchArray($fields))
+               while ($field = $fields->fetchArray())
                {
                        array_walk($field, 'trim');