diff --git a/src/createdb.php b/src/createdb.php index c5e8f40..2393dae 100644 --- a/src/createdb.php +++ b/src/createdb.php @@ -13,13 +13,13 @@ # use fireholdb.sqlite with fireholdb.class.php */ -if(!isset($_SERVER['argv'][1]) || !is_dir($_SERVER['argv'][1])) die("php createdb.php fireholdir\n"); +if(!isset($_SERVER['argv'][1]) || !is_dir($_SERVER['argv'][1])) die("php createdb.php fireholdir [dbfile]\n"); $update = true; $binaryip = true; $updatestamp = file_exists('updatestamp') ? file_get_contents('updatestamp') : 0; $lastmtime = 0; -$db = new PDO('sqlite:'.__DIR__.'/fireholdb.sqlite'); +$db = new PDO('sqlite:'.($_SERVER['argv'][2] ?? __DIR__.'/fireholdb.sqlite')); if(!$db->query("SELECT name FROM sqlite_master WHERE type = 'table' AND name='fireholdb'")->fetch()) { $queries = preg_split('~;\s*~i', file_get_contents(__DIR__.'/schema.sql'), -1, PREG_SPLIT_NO_EMPTY); foreach($queries as $query) {