# HG changeset patch # User Matti Hamalainen # Date 1382176795 -10800 # Node ID 3939cb04bdce5c3bb6a91ba968c61c8b80f9d392 # Parent 2169c3177f4718a4a6c9ef9ccb70a9e30789b18b Cleanup. diff -r 2169c3177f47 -r 3939cb04bdce createdb.php --- a/createdb.php Fri Oct 18 20:30:55 2013 +0300 +++ b/createdb.php Sat Oct 19 12:59:55 2013 +0300 @@ -3,36 +3,6 @@ require "mconfig.inc.php"; require "msite.inc.php"; -// -// CLI utility helper functions -// -function stCArg($index) -{ - global $argc, $argv; - if ($index < $argc) - return $argv[$index]; - else - return FALSE; -} - -function stCArgLC($index) -{ - global $argc, $argv; - if ($index < $argc) - return strtolower($argv[$index]); - else - return FALSE; -} - - -function stCSQLError($sql) -{ - global $db; - die("Error executing SQL query: ".implode("; ", $db->errorInfo())." in statement \"".$sql."\"\n"); - exit; -} - - // Check if we are running from commandline or not if (php_sapi_name() != "cli" || !empty($_SERVER["REMOTE_ADDR"])) { @@ -41,7 +11,6 @@ } - // The defaults we put in $siteDefaults = array( "maxAttendees" => array(VT_INT, 60, "Maximum attendees (soft limit)"), @@ -217,6 +186,33 @@ // // Helper functions // +function stCArg($index) +{ + global $argc, $argv; + if ($index < $argc) + return $argv[$index]; + else + return FALSE; +} + +function stCArgLC($index) +{ + global $argc, $argv; + if ($index < $argc) + return strtolower($argv[$index]); + else + return FALSE; +} + + +function stCSQLError($sql) +{ + global $db; + die("Error executing SQL query: ".implode("; ", $db->errorInfo())." in statement \"".$sql."\"\n"); + exit; +} + + function stConnectDB($dbspec) { global $db; @@ -322,7 +318,7 @@ if (!isset($siteSettings["voteKeyMode"]) || $siteSettings["voteKeyMode"] < 0) { - echo "FATAL ERROR! VoteKeyMode not set in site settings! This setting " + echo "FATAL ERROR! VoteKeyMode not set in site settings! This setting ". "MUST be defined and should not be changed after database creation.\n"; exit; }