diff --git a/tools/generate_tables_sql.php b/tools/generate_tables_sql.php index 9f4f06465bc..3e731ed9799 100755 --- a/tools/generate_tables_sql.php +++ b/tools/generate_tables_sql.php @@ -23,14 +23,14 @@ // require all relevant OO class libraries require_once __DIR__ . "/../vendor/autoload.php"; -require_once "../php/libraries/Database.class.inc"; -require_once "../php/libraries/NDB_Config.class.inc"; -require_once "../php/libraries/NDB_BVL_Instrument.class.inc"; +require_once __DIR__ . "/../php/libraries/Database.class.inc"; +require_once __DIR__ . "/../php/libraries/NDB_Config.class.inc"; +require_once __DIR__ . "/../php/libraries/NDB_BVL_Instrument.class.inc"; // Get command line options $opts = getopt("D"); -$fp = fopen("ip_output.txt", "r"); +$fp = fopen(__DIR__ . "/ip_output.txt", "r"); $data = fread($fp, filesize("ip_output.txt")); fclose($fp); @@ -55,7 +55,7 @@ // generate the CREATE TABLE syntax case "table": $tablename = $bits[1]; - $filename = "../project/tables_sql/".$tablename.".sql"; + $filename = __DIR__ . "/../project/tables_sql/".$tablename.".sql"; $output = ""; if (isset($opts["D"])) { $output = "DROP TABLE IF EXISTS `$tablename`;\n"; diff --git a/tools/generate_tables_sql_and_testNames.php b/tools/generate_tables_sql_and_testNames.php index c1e7cca72b6..cf5151f3fca 100755 --- a/tools/generate_tables_sql_and_testNames.php +++ b/tools/generate_tables_sql_and_testNames.php @@ -21,9 +21,9 @@ // require all relevant OO class libraries require_once __DIR__ . "/../vendor/autoload.php"; -require_once "../php/libraries/Database.class.inc"; -require_once "../php/libraries/NDB_Config.class.inc"; -require_once "../php/libraries/NDB_BVL_Instrument.class.inc"; +require_once __DIR__ . "/../php/libraries/Database.class.inc"; +require_once __DIR__ . "/../php/libraries/NDB_Config.class.inc"; +require_once __DIR__ . "/../php/libraries/NDB_BVL_Instrument.class.inc"; $data = stream_get_contents(STDIN); @@ -38,14 +38,15 @@ foreach ($items as $item) { $paramId = ""; $bits = explode("{@}", trim($item)); + print_r($bits); if (preg_match("/Examiner[0-9]*/", $bits[1])) { continue; } switch ($bits[0]) { - // generate the CREATE TABLE syntax + // generate the CREATE TABLE syntax case "table": $tablename = $bits[1]; - $filename = "../project/tables_sql/".$tablename.".sql"; + $filename = __DIR__ . "/../project/tables_sql/".$tablename.".sql"; $output = "CREATE TABLE `$tablename` ( `CommentID` varchar(255) NOT NULL default '', `UserID` varchar(255) default NULL,