From: Stig Bakken Date: Mon, 18 Mar 2002 18:01:14 +0000 (+0000) Subject: * get rid of this hack X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~1263 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=41c1c084953a6a5024c56df2b79bcb1fad820633;p=php * get rid of this hack --- diff --git a/pear/scripts/pear-get.in b/pear/scripts/pear-get.in deleted file mode 100644 index 5ff308de03..0000000000 --- a/pear/scripts/pear-get.in +++ /dev/null @@ -1,58 +0,0 @@ -#!@prefix@/bin/php -Cq - | -// | Tomas V.V.Cox | -// +----------------------------------------------------------------------+ -// - -require_once 'PEAR.php'; -require_once 'PEAR/Remote.php'; - -error_reporting(E_ALL & ~E_NOTICE); - -$subcommands = array( - 'help' => 'help [command]', - 'install' => 'install [-r] ', - 'upgrade' => 'upgrade [-r] ', - 'list' => 'list', - 'info' => 'info ', -); - -$shortcuts = array( - 'list' => 'remote-list', - 'upgrade' => 'install', -); - -$command_options = array( - 'install' => 'fr', -); - -include "pearcmd-common.php"; - -if (isset($shortcuts[$command])) { - $realcommand = $shortcuts[$command]; -} else { - $realcommand = $command; -} - -if (isset($subcommands[$command])) { - include "pearcmd-$realcommand.php"; -} elseif (!$store_default_config && !$store_user_config) { - usage(); -} - -?> diff --git a/pear/scripts/pearcmd-common.php b/pear/scripts/pearcmd-common.php deleted file mode 100644 index 6293532451..0000000000 --- a/pear/scripts/pearcmd-common.php +++ /dev/null @@ -1,197 +0,0 @@ -getMessage()); -} -$options = Console_Getopt::getopt($argv, "c:C:d:D:h?sSqu:v"); -if (PEAR::isError($options)) { - usage($options); -} - -if (OS_WINDOWS) { - $pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pearsys.ini'; - $pear_user_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.ini'; -} else { - $pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.conf'; - $pear_user_config = getenv('HOME').DIRECTORY_SEPARATOR.'.pearrc'; -} - -$opts = $options[0]; - -foreach ($opts as $opt) { - switch ($opt[0]) { - case 'c': - $pear_user_config = $opt[1]; - break; - case 'C': - $pear_default_config = $opt[1]; - break; - } -} - -$config = new PEAR_Config($pear_user_config, $pear_default_config); -$store_user_config = false; -$store_default_config = false; -$verbose = 1; - -foreach ($opts as $opt) { - $param = $opt[1]; - switch ($opt[0]) { - case 'd': - list($key, $value) = explode('=', $param); - $config->set($key, $value); - break; - case 'D': - list($key, $value) = explode('=', $param); - $config->set($key, $value, true); - break; - case 's': - $store_user_config = true; - break; - case 'S': - $store_default_config = true; - break; - case 'u': - $config->toDefault($param); - break; - case 'v': - $verbose++; - break; - case 'q': - $verbose--; - break; - } -} - -if ($store_default_config) { - if (@is_writeable($pear_default_config)) { - $config->writeConfigFile($pear_default_config, 'default'); - } else { - die("You don't have write access to $pear_default_config, exiting!\n"); - } -} - -if ($store_user_config) { - $config->writeConfigFile($pear_user_config, 'userdefined'); -} - -$fallback_config = array( - 'master_server' => 'pear.php.net', - 'php_dir' => PEAR_INSTALL_DIR, - 'ext_dir' => PEAR_EXTENSION_DIR, - 'doc_dir' => PHP_DATADIR . DIRECTORY_SEPARATOR . 'pear' . - DIRECTORY_SEPARATOR . 'doc', - 'verbose' => true, -); -$fallback_done = array(); - -foreach ($fallback_config as $key => $value) { - if (!$config->isDefined($key)) { - $config->set($key, $value); - $fallback_done[$key] = true; - } -} - -//$verbose = $config->get("verbose"); -$script_dir = $config->get("php_dir"); -$ext_dir = $config->get("ext_dir"); -$doc_dir = $config->get("doc_dir"); - -$command = (isset($options[1][1])) ? $options[1][1] : null; -$rest = array_slice($options[1], 2); - -if (isset($command_options[$command])) { - $tmp = Console_Getopt::getopt($rest, $command_options[$command]); - if (PEAR::isError($tmp)) { - usage($tmp); - } - $cmdopts = $tmp[0]; - $cmdargs = $tmp[1]; -} else { - $cmdopts = array(); - $cmdargs = $rest; -} - -// {{{ usage() - -function usage($error = null, $helpsubject = null) -{ - global $progname, $subcommands; - $stderr = fopen('php://stderr', 'w'); - if (PEAR::isError($error)) { - fputs($stderr, $error->getMessage()); - } elseif ($error !== null) { - fputs($stderr, $error); - } - fputs($stderr, - "Usage: $progname [options] command [command-options] \n"); - if ($helpsubject == "options") { - fputs($stderr, - "Options:\n". - " -v increase verbosity level (default 1)\n". - " -q be quiet, decrease verbosity level\n". - " -c file find user configuration in `file'\n". - " -C file find system configuration in `file'\n". - " -d foo=bar set user config variable `foo' to `bar'\n". - " -D foo=bar set system config variable `foo' to `bar'\n". - " -s store user configuration\n". - " -S store system configuration\n". - " -u foo unset `foo' in the user configuration\n". - " -h, -? display help/usage (this message)\n"); - } else { - fputs($stderr, "Type \"$progname help options\" to list all options.\n"); - } - fputs($stderr, "Commands:".implode("\n ", $subcommands) . "\n"); - fclose($stderr); - exit; -} - -// }}} -// {{{ present_array() - -function present_array(&$arr, $keys = null) -{ - if ($keys === null) { - $keys = array_keys($arr); - } - $longest_key = max(array_map("strlen", array_keys($arr))) + 2; - $format_string = "%{$longest_key}s : %s\n"; - foreach ($keys as $k) { - if (is_array($arr[$k])) { - foreach ($arr[$k] as $i => $value) { - $x = "$k #$i"; - $cont = array(); - foreach(array_keys($value) as $val) { - $cont[] = "$val=" . $value[$val]; - } - $v = implode(", ", $cont); - printf($format_string, $x, $v); - } - continue; - } else { - $v = $arr[$k]; - printf($format_string, $k, $v); - } - } -} - -// }}} -// {{{ heading() - -function heading($text) -{ - $l = strlen(trim($text)); - print rtrim($text) . "\n" . str_repeat("=", $l) . "\n"; -} - -// }}} - -?> \ No newline at end of file diff --git a/pear/scripts/pearcmd-help.php b/pear/scripts/pearcmd-help.php deleted file mode 100644 index 5bb8b7db9f..0000000000 --- a/pear/scripts/pearcmd-help.php +++ /dev/null @@ -1,9 +0,0 @@ - \ No newline at end of file diff --git a/pear/scripts/pearcmd-info.php b/pear/scripts/pearcmd-info.php deleted file mode 100644 index 99b6b1c7f2..0000000000 --- a/pear/scripts/pearcmd-info.php +++ /dev/null @@ -1,10 +0,0 @@ -setErrorHandling(PEAR_ERROR_DIE, "pear info: %s\n"); -$info = $parser->infoFromTgzFile($cmdargs[0]); -unset($info['filelist']); -present_array($info); - -?> \ No newline at end of file diff --git a/pear/scripts/pearcmd-install.php b/pear/scripts/pearcmd-install.php deleted file mode 100644 index 4a4a349aef..0000000000 --- a/pear/scripts/pearcmd-install.php +++ /dev/null @@ -1,33 +0,0 @@ -setErrorHandling(PEAR_ERROR_DIE, - basename($pkgfile) . ": %s\n"); -$installer->debug = $verbose; -$install_options = array(); -if ($command == 'upgrade') { - $install_options['upgrade'] = true; -} -foreach ($cmdopts as $opt) { - switch ($opt[0]) { - case 'r': - // This option is for use by rpm and other package - // tools that can install files etc. by itself, but - // still needs to register the package as installed in - // PEAR's local registry. - $install_options['register_only'] = true; - break; - case 'f': - $install_options['force'] = true; - break; - } -} -if ($installer->install($pkgfile, $install_options, $config)) { - print "install ok\n"; -} else { - print "install failed\n"; -} - -?> \ No newline at end of file diff --git a/pear/scripts/pearcmd-list.php b/pear/scripts/pearcmd-list.php deleted file mode 100644 index 6bf0be52da..0000000000 --- a/pear/scripts/pearcmd-list.php +++ /dev/null @@ -1,20 +0,0 @@ -packageInfo(); -$i = $j = 0; -heading("Installed packages:"); -foreach ($installed as $package) { - if ($i++ % 20 == 0) { - if ($j++ > 0) { - print "\n"; - } - printf("%-20s %-10s %s\n", - "Package", "Version", "State"); - print str_repeat("-", 75)."\n"; - } - printf("%-20s %-10s %s\n", $package['package'], - $package['version'], $package['release_state']); -} - -?> \ No newline at end of file diff --git a/pear/scripts/pearcmd-package.php b/pear/scripts/pearcmd-package.php deleted file mode 100644 index 5cc485a937..0000000000 --- a/pear/scripts/pearcmd-package.php +++ /dev/null @@ -1,15 +0,0 @@ -setErrorHandling(PEAR_ERROR_DIE, "pear page: %s\n"); -$packager->debug = $verbose; -if (PEAR::isError($packager->Package($pkginfofile))) { - print "\npackage failed\n"; -} else { - print "package ok\n"; -} - - -?> \ No newline at end of file diff --git a/pear/scripts/pearcmd-remote-list.php b/pear/scripts/pearcmd-remote-list.php deleted file mode 100644 index c9db676745..0000000000 --- a/pear/scripts/pearcmd-remote-list.php +++ /dev/null @@ -1,30 +0,0 @@ -call('package.listAll', 1); -$i = $j = 0; - -if (PEAR::isError($result)) { - die("\n\n Error while executing command!\n\n"); -} - -heading("Available packages"); - -foreach ($result as $package => $info) { - if ($i++ % 20 == 0) { - if ($j++ > 0) { - print "\n"; - } - printf("%-20s %-10s %-15s %s\n", - "Package", "Stable", "Lead", "Category"); - print str_repeat("-", 75)."\n"; - } - if (empty($info['stable'])) { - $info['stable'] = '(none)'; - } - $stable = (string)$info['stable']; - printf("%-20s %-10s %-15s %s\n", $package, - $info['stable'], $info['lead'], $info['category']); -} - -?> \ No newline at end of file diff --git a/pear/scripts/pearcmd-show-config.php b/pear/scripts/pearcmd-show-config.php deleted file mode 100644 index 0ebc70a38a..0000000000 --- a/pear/scripts/pearcmd-show-config.php +++ /dev/null @@ -1,16 +0,0 @@ -getKeys(); -foreach ($keys as $key) { - $value = $config->get($key); - $xi = ""; - if ($config->isDefaulted($key)) { - $xi .= " (default)"; - } - if (isset($fallback_done[$key])) { - $xi .= " (built-in)"; - } - printf("%s = %s%s\n", $key, $value, $xi); -} - -?> \ No newline at end of file diff --git a/pear/scripts/pearcmd-uninstall.php b/pear/scripts/pearcmd-uninstall.php deleted file mode 100644 index 18f4e41931..0000000000 --- a/pear/scripts/pearcmd-uninstall.php +++ /dev/null @@ -1,26 +0,0 @@ -setErrorHandling(PEAR_ERROR_DIE, - basename($pkgfile) . ": %s\n"); -$installer->debug = $verbose; -$uninstall_options = array(); -foreach ($cmdopts as $opt) { - switch ($opt[0]) { - case 'r': - $uninstall_options['register_only'] = true; - break; - case 'f': - $uninstall_options['force'] = true; - break; - } -} -if ($installer->uninstall($pkgfile, $uninstall_options)) { - print "uninstall ok\n"; -} else { - print "uninstall failed\n"; -} - -?>