From 6cc3f5887d7af3ad3b505a6f0fa62752314be1fe Mon Sep 17 00:00:00 2001 From: alecpl Date: Wed, 20 Apr 2011 13:10:45 +0000 Subject: - Use clisetup.php where possible, remove redundant code --- bin/cleandb.sh | 7 ++----- bin/decrypt.sh | 7 ++----- bin/dumpschema.sh | 7 ++----- bin/installto.sh | 5 +---- bin/update.sh | 3 --- 5 files changed, 7 insertions(+), 22 deletions(-) diff --git a/bin/cleandb.sh b/bin/cleandb.sh index 98f52d0cf..978b17dfa 100755 --- a/bin/cleandb.sh +++ b/bin/cleandb.sh @@ -20,12 +20,9 @@ */ -if (php_sapi_name() != 'cli') { - die('Not on the "shell" (php-cli).'); -} - define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' ); -require INSTALL_PATH.'program/include/iniset.php'; + +require INSTALL_PATH.'program/include/clisetup.php'; // mapping for table name => primary key $primary_keys = array( diff --git a/bin/decrypt.sh b/bin/decrypt.sh index e19da82c3..c1ddd1cf2 100755 --- a/bin/decrypt.sh +++ b/bin/decrypt.sh @@ -52,12 +52,9 @@ * - you are dealing with counterfeit header data. */ -if (php_sapi_name() != 'cli') { - die("Not on the 'shell' (php-cli).\n"); -} - define('INSTALL_PATH', realpath(dirname(__FILE__).'/..') . '/'); -require INSTALL_PATH . 'program/include/iniset.php'; + +require INSTALL_PATH . 'program/include/clisetup.php'; if ($argc < 2) { die("Usage: " . basename($argv[0]) . " encrypted-hdr-part [encrypted-hdr-part ...]\n"); diff --git a/bin/dumpschema.sh b/bin/dumpschema.sh index 2f323ea1c..da1dffa72 100755 --- a/bin/dumpschema.sh +++ b/bin/dumpschema.sh @@ -20,12 +20,9 @@ */ -if (php_sapi_name() != 'cli') { - die('Not on the "shell" (php-cli).'); -} - define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' ); -require INSTALL_PATH.'program/include/iniset.php'; + +require INSTALL_PATH.'program/include/clisetup.php'; /** callback function for schema dump **/ function print_schema($dump) diff --git a/bin/installto.sh b/bin/installto.sh index f953419ce..b1e2956a1 100755 --- a/bin/installto.sh +++ b/bin/installto.sh @@ -19,12 +19,9 @@ */ -if (php_sapi_name() != 'cli') { - die('Not on the "shell" (php-cli).'); -} define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' ); -require_once INSTALL_PATH . 'program/include/iniset.php'; +require_once INSTALL_PATH . 'program/include/clisetup.php'; $target_dir = unslashify($_SERVER['argv'][1]); diff --git a/bin/update.sh b/bin/update.sh index 094e5b72b..9f91c8ecd 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -19,9 +19,6 @@ */ -if (php_sapi_name() != 'cli') { - die('Not on the "shell" (php-cli).'); -} define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' ); require_once INSTALL_PATH . 'program/include/clisetup.php'; -- cgit v1.2.3