From: Michael M Slusarz Date: Fri, 19 Mar 2010 19:41:32 +0000 (-0600) Subject: These scripts belong in horde, not the packages X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=fda725bb4ae99a441f8786dbf4ac3aa425739543;p=horde.git These scripts belong in horde, not the packages --- diff --git a/framework/Memcache/package.xml b/framework/Memcache/package.xml index 87433be1d..9cac16514 100644 --- a/framework/Memcache/package.xml +++ b/framework/Memcache/package.xml @@ -25,18 +25,10 @@ http://pear.php.net/dtd/package-2.0.xsd"> beta LGPL - * Initial Horde 4 package. + * Remove Horde_Core dependency. + * Initial Horde 4 package. - - - - - - - - - @@ -53,10 +45,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> 1.5.0 - Core - pear.horde.org - - Exception pear.horde.org @@ -68,7 +56,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> - diff --git a/framework/Memcache/scripts/Horde/Memcache/stats.php b/framework/Memcache/scripts/Horde/Memcache/stats.php deleted file mode 100755 index 81887d93e..000000000 --- a/framework/Memcache/scripts/Horde/Memcache/stats.php +++ /dev/null @@ -1,120 +0,0 @@ -#!@php_bin@ - - * @package Horde_Memcache - */ - -// The base file path of horde. -$horde_base = '/path/to/horde'; - -require_once $horde_base . '/lib/Application.php'; -Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true)); - -/* Make sure there's no compression. */ -@ob_end_clean(); - -$c = new Console_Getopt(); -$argv = $c->readPHPArgv(); -array_shift($argv); -$options = $c->getopt2($argv, '', array('all', 'flush', 'lookup=', 'raw', 'summary')); -if (PEAR::isError($options)) { - $cli->writeln($cli->red("ERROR: Invalid arguments.")); - exit; -} - -$all = $raw = $summary = false; -$memcache = $injector->getInstance('Horde_Memcache'); - -foreach ($options[0] as $val) { - switch ($val[0]) { - case '--all': - $all = true; - break; - - case '--flush': - if ($cli->prompt($cli->red('Are you sure you want to flush all data?'), array('y' => 'Yes', 'n' => 'No'), 'n') == 'y') { - $memcache->flush(); - $cli->writeln($cli->green('Done.')); - } - exit; - - case '--lookup': - $data = $memcache->get($val[1]); - if (!empty($data)) { - $cli->writeln(print_r($data, true)); - } else { - $cli->writeln('[Key not found.]'); - } - exit; - - case '--raw': - $raw = true; - break; - - case '--summary': - $summary = true; - break; - } -} - -$stats = $memcache->stats(); - -if ($raw) { - $cli->writeln(print_r($stats, true)); -} elseif (!$summary) { - $all = true; -} - -if ($all || $summary) { - if ($summary) { - $total = array(); - $total_keys = array('bytes', 'limit_maxbytes', 'curr_items', 'total_items', 'get_hits', 'get_misses', 'curr_connections', 'bytes_read', 'bytes_written'); - foreach ($total_keys as $key) { - $total[$key] = 0; - } - } - - $i = $s_count = count($stats); - - foreach ($stats as $key => $val) { - if ($summary) { - foreach ($total_keys as $k) { - $total[$k] += $val[$k]; - } - } - - if ($all) { - $cli->writeln($cli->green('Server: ' . $key . ' (Version: ' . $val['version'] . ' - ' . $val['threads'] . ' thread(s))')); - _outputInfo($val, $cli); - if (--$i || $summary) { - $cli->writeln(); - } - } - } - - if ($summary) { - $cli->writeln($cli->green('Memcache pool (' . $s_count . ' server(s))')); - _outputInfo($total, $cli); - } -} - -function _outputInfo($val, $cli) -{ - $cli->writeln($cli->indent('Size: ' . sprintf("%0.2f", $val['bytes'] / 1048576) . ' MB (Max: ' . sprintf("%0.2f", ($val['limit_maxbytes']) / 1048576) . ' MB - ' . ((!empty($val['limit_maxbytes']) ? round(($val['bytes'] / $val['limit_maxbytes']) * 100, 1) : 'N/A')) . '% used)')); - $cli->writeln($cli->indent('Items: ' . $val['curr_items'] . ' (Total: ' . $val['total_items'] . ')')); - $cli->writeln($cli->indent('Cache Ratio: ' . $val['get_hits'] . ' hits, ' . $val['get_misses'] . ' misses')); - $cli->writeln($cli->indent('Connections: ' . $val['curr_connections'])); - $cli->writeln($cli->indent('Traffic: ' . sprintf("%0.2f", $val['bytes_read'] / 1048576) . ' MB in, ' . sprintf("%0.2f", $val['bytes_written'] / 1048576) . ' MB out')); -} diff --git a/framework/Scheduler/package.xml b/framework/Scheduler/package.xml index 0f7dad1ac..3a8e82085 100644 --- a/framework/Scheduler/package.xml +++ b/framework/Scheduler/package.xml @@ -24,19 +24,11 @@ http://pear.php.net/dtd/package-2.0.xsd"> beta LGPL - * Initial Horde 4 package. + * Removed Horde-specific command line script. + * Initial Horde 4 package. - - - - - - - - - @@ -74,7 +66,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> - diff --git a/framework/Scheduler/scripts/Horde/Scheduler/horde-crond.php b/framework/Scheduler/scripts/Horde/Scheduler/horde-crond.php deleted file mode 100755 index e778799f2..000000000 --- a/framework/Scheduler/scripts/Horde/Scheduler/horde-crond.php +++ /dev/null @@ -1,25 +0,0 @@ -#!@php_bin@ - 'none', 'cli' => true)); - -// Get an instance of the cron scheduler. -$daemon = Horde_Scheduler::factory('Cron'); - -// Now add some cron jobs to do, or add parsing to read a config file. -// $daemon->addTask('ls', '0,5,10,15,20,30,40 * * * *'); - -// Start the daemon going. -$daemon->run(); diff --git a/framework/SessionHandler/package.xml b/framework/SessionHandler/package.xml index c180a12f9..55382562a 100644 --- a/framework/SessionHandler/package.xml +++ b/framework/SessionHandler/package.xml @@ -37,19 +37,11 @@ http://pear.php.net/dtd/package-2.0.xsd"> beta LGPL - * Initial Horde 4 package. + * Removed Horde-specific session counting script. + * Initial Horde 4 package. - - - - - - - - - @@ -77,11 +69,11 @@ http://pear.php.net/dtd/package-2.0.xsd"> - Horde_Memcache + Memcache pear.horde.org - Horde_SQL + SQL pear.horde.org @@ -95,7 +87,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> - diff --git a/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php b/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php deleted file mode 100755 index a8ff63a8f..000000000 --- a/framework/SessionHandler/scripts/Horde/SessionHandler/horde-active-sessions.php +++ /dev/null @@ -1,46 +0,0 @@ -#!@php_bin@ - 'none', 'cli' => true)); - -/* Check for sessionhandler object. */ -$registry->setupSessionHandler(); -if (!$registry->sessionHandler) { - throw new Horde_Exception('Horde is unable to load the session handler'); -} - -$type = !empty($conf['sessionhandler']['type']) - ? $conf['sessionhandler']['type'] - : 'builtin'; - -if ($type == 'external') { - throw new Horde_Exception('Session counting is not supported in the \'external\' SessionHandler.'); -} - -$sessions = $registry->sessionHandler->getSessionsInfo(); - -if (($argc < 2) || (($argv[1] != '-l') && ($argv[1] != '-ll'))) { - $cli->writeln(count($sessions)); -} else { - foreach ($sessions as $data) { - if ($argv[1] == '-ll') { - $cli->writeln($data['userid'] . ' [' . date('r', $data['timestamp']) . ']'); - } else { - $cli->writeln($data['userid']); - } - } - $cli->writeln($cli->green('Total Sessions: ' . count($sessions))); -} diff --git a/horde/bin/active_sessions b/horde/bin/active_sessions new file mode 100755 index 000000000..a536192f9 --- /dev/null +++ b/horde/bin/active_sessions @@ -0,0 +1,48 @@ +#!/usr/bin/env php + + */ + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true)); + +/* Check for sessionhandler object. */ +$registry->setupSessionHandler(); +if (!$registry->sessionHandler) { + throw new Horde_Exception('Horde is unable to load the session handler.'); +} + +$type = !empty($conf['sessionhandler']['type']) + ? $conf['sessionhandler']['type'] + : 'builtin'; + +if ($type == 'external') { + throw new Horde_Exception('Session counting is not supported in the \'external\' SessionHandler.'); +} + +$sessions = $registry->sessionHandler->getSessionsInfo(); + +if (($argc < 2) || (($argv[1] != '-l') && ($argv[1] != '-ll'))) { + $cli->writeln(count($sessions)); +} else { + foreach ($sessions as $data) { + if ($argv[1] == '-ll') { + $cli->writeln($data['userid'] . ' [' . date('r', $data['timestamp']) . ']'); + } else { + $cli->writeln($data['userid']); + } + } + $cli->writeln($cli->green('Total Sessions: ' . count($sessions))); +} diff --git a/horde/bin/crond b/horde/bin/crond new file mode 100755 index 000000000..6fe68f2b9 --- /dev/null +++ b/horde/bin/crond @@ -0,0 +1,36 @@ +#!/usr/bin/env php + '0,5,10,15,20 * * * *' +); + +// End Configuration + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true)); + +// Get an instance of the cron scheduler. +$daemon = Horde_Scheduler::factory('Cron'); + +// Add cron tasks. +foreach ($cron_tasks as $key => $val) { + $daemon->addTask($key, $val); +} + +// Start the daemon going. +$daemon->run(); diff --git a/horde/bin/memcache_stats b/horde/bin/memcache_stats new file mode 100755 index 000000000..bb8266bbc --- /dev/null +++ b/horde/bin/memcache_stats @@ -0,0 +1,116 @@ +#!/usr/bin/env php + + */ + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('horde', array('authentication' => 'none', 'cli' => true)); + +/* Make sure there's no compression. */ +@ob_end_clean(); + +$c = new Console_Getopt(); +$argv = $c->readPHPArgv(); +array_shift($argv); +$options = $c->getopt2($argv, '', array('all', 'flush', 'lookup=', 'raw', 'summary')); +if (PEAR::isError($options)) { + $cli->writeln($cli->red("ERROR: Invalid arguments.")); + exit; +} + +$all = $raw = $summary = false; +$memcache = $injector->getInstance('Horde_Memcache'); + +foreach ($options[0] as $val) { + switch ($val[0]) { + case '--all': + $all = true; + break; + + case '--flush': + if ($cli->prompt($cli->red('Are you sure you want to flush all data?'), array('y' => 'Yes', 'n' => 'No'), 'n') == 'y') { + $memcache->flush(); + $cli->writeln($cli->green('Done.')); + } + exit; + + case '--lookup': + $data = $memcache->get($val[1]); + if (!empty($data)) { + $cli->writeln(print_r($data, true)); + } else { + $cli->writeln('[Key not found.]'); + } + exit; + + case '--raw': + $raw = true; + break; + + case '--summary': + $summary = true; + break; + } +} + +$stats = $memcache->stats(); + +if ($raw) { + $cli->writeln(print_r($stats, true)); +} elseif (!$summary) { + $all = true; +} + +if ($all || $summary) { + if ($summary) { + $total = array(); + $total_keys = array('bytes', 'limit_maxbytes', 'curr_items', 'total_items', 'get_hits', 'get_misses', 'curr_connections', 'bytes_read', 'bytes_written'); + foreach ($total_keys as $key) { + $total[$key] = 0; + } + } + + $i = $s_count = count($stats); + + foreach ($stats as $key => $val) { + if ($summary) { + foreach ($total_keys as $k) { + $total[$k] += $val[$k]; + } + } + + if ($all) { + $cli->writeln($cli->green('Server: ' . $key . ' (Version: ' . $val['version'] . ' - ' . $val['threads'] . ' thread(s))')); + _outputInfo($val, $cli); + if (--$i || $summary) { + $cli->writeln(); + } + } + } + + if ($summary) { + $cli->writeln($cli->green('Memcache pool (' . $s_count . ' server(s))')); + _outputInfo($total, $cli); + } +} + +function _outputInfo($val, $cli) +{ + $cli->writeln($cli->indent('Size: ' . sprintf("%0.2f", $val['bytes'] / 1048576) . ' MB (Max: ' . sprintf("%0.2f", ($val['limit_maxbytes']) / 1048576) . ' MB - ' . ((!empty($val['limit_maxbytes']) ? round(($val['bytes'] / $val['limit_maxbytes']) * 100, 1) : 'N/A')) . '% used)')); + $cli->writeln($cli->indent('Items: ' . $val['curr_items'] . ' (Total: ' . $val['total_items'] . ')')); + $cli->writeln($cli->indent('Cache Ratio: ' . $val['get_hits'] . ' hits, ' . $val['get_misses'] . ' misses')); + $cli->writeln($cli->indent('Connections: ' . $val['curr_connections'])); + $cli->writeln($cli->indent('Traffic: ' . sprintf("%0.2f", $val['bytes_read'] / 1048576) . ' MB in, ' . sprintf("%0.2f", $val['bytes_written'] / 1048576) . ' MB out')); +}