From: Evan Prodromou Date: Mon, 22 Jun 2009 23:34:56 +0000 (-0700) Subject: triminboxes.php uses commandline.inc X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0582381c6631cb8b8e914cebbcf2e387b947c83f;p=quix0rs-gnu-social.git triminboxes.php uses commandline.inc --- diff --git a/scripts/triminboxes.php b/scripts/triminboxes.php index 0d545b3263..5575dd4fc1 100644 --- a/scripts/triminboxes.php +++ b/scripts/triminboxes.php @@ -18,31 +18,37 @@ * along with this program. If not, see . */ -# Abort if called from a web server -if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { - print "This script must be run from the command line\n"; - exit(1); -} +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); -ini_set("max_execution_time", "0"); -ini_set("max_input_time", "0"); -set_time_limit(0); -mb_internal_encoding('UTF-8'); +$shortoptions = 'u::'; +$longoptions = array('start-user-id::'); -define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); -define('LACONICA', true); +$helptext = << + --start-user-id= User ID to start after. Default is all. -$server = ($argc > 2) ? $argv[2] : null; -$path = ($argc > 3) ? $argv[3] : null; +END_OF_TRIM_HELP; -require_once(INSTALLDIR . '/lib/common.php'); +require_once INSTALLDIR.'/scripts/commandline.inc'; + +$id = null; + +if (have_option('-u')) { + $id = get_option_value('-u'); +} else if (have_option('--start-user-id')) { + $id = get_option_value('--start-user-id'); +} else { + $id = null; +} $user = new User(); -if ($argc > 1) { - $user->whereAdd('id > ' . $argv[1]); + +if (!empty($id)) { + $user->whereAdd('id > ' . $id); } + $cnt = $user->find(); while ($user->fetch()) {