From bb5d9e91b710bd56d0da91c294536faa8a7ef9bf Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Tue, 5 Dec 2023 05:00:06 +0000 Subject: [PATCH] Delete files with no licenses --- scripts/check-underdocumented.php | 67 ------ scripts/create-phpdoc-setup.php | 292 --------------------------- scripts/gen-ide-json.php | 111 ---------- scripts/helpers/phpdoc-completion.sh | 36 ---- scripts/mk_ini_set_table.sh | 92 --------- 5 files changed, 598 deletions(-) delete mode 100644 scripts/check-underdocumented.php delete mode 100644 scripts/create-phpdoc-setup.php delete mode 100755 scripts/gen-ide-json.php delete mode 100755 scripts/helpers/phpdoc-completion.sh delete mode 100755 scripts/mk_ini_set_table.sh diff --git a/scripts/check-underdocumented.php b/scripts/check-underdocumented.php deleted file mode 100644 index df6b57a54..000000000 --- a/scripts/check-underdocumented.php +++ /dev/null @@ -1,67 +0,0 @@ -getPathname(); - $filename = $file->getBasename(); - - if (strpos($filepath, '.svn')) { - continue; - } - - if (!$file->isFile() || pathinfo($filepath, PATHINFO_EXTENSION) !== 'xml') { - continue; - } - - $fileid = str_replace($phpdoc_path, '', $filepath); - $ext = strtok($fileid, DIRECTORY_SEPARATOR); - - if (file_exists($phpdoc_path . $fileid)) { - $contents = file_get_contents($phpdoc_path . $fileid); - if (false !== strpos($contents, 'warn.undocumented.func')) { - $undocumented[$ext][] = $fileid; - ++$count; - } - continue; - } -} - -echo 'List of underdocumented functions/methods', PHP_EOL; -print_r($undocumented); -echo "Number underdocumented: ", $count, PHP_EOL; - -function usage() { - echo PHP_EOL, 'USAGE:', PHP_EOL; - echo 'php ', $_SERVER['SCRIPT_FILENAME'], ' -p /path/to/phpdoc/en/reference/', PHP_EOL; - exit; -} \ No newline at end of file diff --git a/scripts/create-phpdoc-setup.php b/scripts/create-phpdoc-setup.php deleted file mode 100644 index 89c660d7e..000000000 --- a/scripts/create-phpdoc-setup.php +++ /dev/null @@ -1,292 +0,0 @@ -&1'); - -if (false !== strpos($out, 'All good. Saving')) { - echo_line('Yes.'); -} else { - // Hmm.... this should never happen ;) - echo_line('No.'); -} - -// PhD installation -if (!$configs['PATH_PHD']) { - echo_line('Running: Attempting to install PhD.'); - - if ($configs['PATH_PEAR']) { - - $command = $configs['PATH_PEAR'] . ' install doc.php.net/PhD doc.php.net/PhD_PHP'; - $out = shell_exec($command); - - if (!$configs['PATH_PHD'] = get_installed_path('phd', $configs['PATH_PHD'], '-V')) { - echo_line('Warning: Attempted and failed to install PhD. Here was the output:'); - print_r($out); - } else { - echo_line('Status: PhD is now installed.'); - } - } else { - // Then use PhD from SVN instead? - echo_line('Warning: I decided to not install PhD, without PEAR.'); - } -} - -echo_line(); -echo_line('INFO: Done. You now have the PHP Documentation checked out:'); -echo_line('-- PHP Documentation SVN path: '. $configs['DIR_SVN']); -echo_line('-- PhD Installed: '. (empty($configs['PATH_PHD']) ? 'no' : $configs['PATH_PHD'])); -echo_line(); -echo_line('INFO: Now, some things you might want to do:'); -echo_line('-- Go there : cd ' . $configs['DIR_SVN']); -echo_line('-- Validate XML : php doc-base/configure.php'); -echo_line('-- Render XHTML : phd --docbook doc-base/.manual.xml --package PHP --format xhtml'); -echo_line('-- View it : open output/php-chunked-xhtml/index.html &'); -echo_line('-- Edit docs : vim en/reference/strings/functions/strlen.xml'); -echo_line('-- See diff : svn diff -u en/reference/strings/functions/strlen.xml'); -echo_line('-- Is Validate? : php doc-base/configure.php'); -echo_line('-- Commit :) : svn commit en/reference/strings/functions/strlen.xml'); - -/******* Function library ****************************************************/ -function get_installed_path($program, $test_path = NULL, $version = '--version') { - - // Test $test_path, if provided by user - if (!empty($test_path)) { - $command = "$test_path $version 2>&1"; - $out = shell_exec($command); - if (false !== strpos($out, 'command not found')) { - return $test_path; - } else { - // Yes, bad to echo here, but oh well - echo_line("Warning: The desired program ($program) was not found at path ($test_path). Will try finding it myself."); - } - } - - // Now try finding it ourselves... - // FIXME: will this always work? - $command = "which $program 2>&1"; - $out = shell_exec($command); - if (false !== strpos($out, '/' . $program)) { - return trim($out); - } - return false; -} -function usage() { - $descriptions = array( - 'h' => 'Help : This help', - 't' => 'TEST Mode: Test mode. Writes nothing. Displays your configs', - 'l' => 'Language : Country code, typically two letters. Default: en', - 'b' => 'SVN dir : Full path to the SVN base dir, where PHP will be checked out', - 's' => 'SVN path: Full path to the SVN binary', - 'd' => 'PhD path: PhD renders the manual, you probably do not have it installed', - 'r' => 'PEAR path: Full path to the pear command', - 'p' => 'PHP path: Full path to the PHP binary', - 'u' => 'SVN Up : Update the existing SVN checkout', - ); - echo_line(); - echo_line('This script checks out PHP from SVN, and installs PhD.'); - echo_line('The following options are available. All but -b are optional.'); - echo_line(); - echo_line('Example: php ' . $_SERVER['SCRIPT_NAME'] . ' -b /my/svn -l en'); - echo_line('Creates: /my/svn/doc-en/ with full php documentation checkout'); - echo_line(); - foreach ($descriptions as $config_n => $config_v) { - echo_line(' -' . $config_n . ' : ' . $config_v); - } - exit; -} -// Questionable -function do_getopts() { - // Intentionally 'require' everything, as 'optional' is broken. - $options = getopt('b:l:p:r:d:s:uht'); - $defaults = $configs = array( - 'h' => '', // Show usage/help information - 'b' => '', // Base directory for the SVN Checkout - 'l' => 'en', // Language (en, or lang code for translation) - 'p' => '', // PHP binary Path - 'r' => '', // PEAR binary Path - 'd' => '', // PHD binary Path - 's' => '', // SVN binary Path - 'u' => '', // Update the checkout, instead of checkout - 't' => '', // Test. Outputs your configuration. - ); - foreach ($options as $option_k => $option_v) { - - // This means it was set. But, I don't like false being the value. - if (in_array($option_k, array('h','u','t')) && $option_v === false) { - $option_v = true; - } - - if (!empty($option_v)) { - $configs[$option_k] = $option_v; - } - } - $configs = array( - 'BASEDIR_SVN' => $configs['b'], - 'LANG_CODE' => $configs['l'], - 'PATH_PHP' => $configs['p'], - 'PATH_PEAR' => $configs['r'], - 'PATH_PHD' => $configs['d'], - 'PATH_SVN' => $configs['s'], - 'UPDATE_CO' => $configs['u'], - 'HELP' => $configs['h'], - 'TEST' => $configs['t'], - ); - - if (!empty($configs['BASEDIR_SVN'])) { - $configs['DIR_SVN'] = $configs['BASEDIR_SVN'] . '/doc-' . $configs['LANG_CODE']; - } - return $configs; -} -function is_phpdoc_checkout($configs) { - if (empty($configs['DIR_SVN'])) { - echo_line('Warning: Configuration is not set properly while testing the checkout. Massive fail!'); - exit; - } - // TODO: Improve this check - if (file_exists($configs['DIR_SVN'] . '/en/reference/apc/book.xml') && file_exists($configs['DIR_SVN'] . '/doc-base/configure.php')) { - return true; - } else { - return false; - } -} -function echo_line($line = '', $newline = TRUE) { - echo $line; - if ($newline) { - echo PHP_EOL; - } -} diff --git a/scripts/gen-ide-json.php b/scripts/gen-ide-json.php deleted file mode 100755 index 3f8ce7382..000000000 --- a/scripts/gen-ide-json.php +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env php -getFunctionList(); - -$json_arr = array(); -foreach ($functions as $function_name) { - - // @todo fix source so trim() isn't needed - $function_name = trim($function_name); - - $function = $api->getFunctionByName($function_name); - $prototype = (string) $function; - - // @todo fix this. Replaces class.method with class::method - // @todo fix this? Replaces NULL with null, to remain consistent - $function_name_fixed = str_replace('.', '::', (string) $function_name); - $prototype = str_replace($function_name, $function_name_fixed, $prototype); - $prototype = str_replace('NULL', 'null', $prototype); - - // Some contain new lines, let's remove them - $purpose = str_replace("\n", '', (string) $function->getPurpose()); - // @todo fix bug when return description contains tables (example: variant_and()) - $return = str_replace("\n", '', (string) $function->getReturnDescription()); - - // Some 'function names' contain spaces, like 'Constants for PDO_4D' - // @todo fix this bug in the source - if (false !== strpos($function_name_fixed, ' ')) { - continue; - } - - /* Define our array structure for json. Example entries: - [strlen] = Array - ( - [id] => function.strlen - [purpose] => Get string length - [prototype] => int strlen(string $string) - [return] => The length of the string on success, and 0 if the string is empty. - [versions] => PHP 4, PHP 5 - ) - [HttpRequest::addHeaders] => Array - ( - [id] => function.httprequest-addheaders - [purpose] => Add headers - [prototype] => bool HttpRequest::addHeaders(array $headers) - [return] => Returns TRUE on success or FALSE on failure. - [versions] => - ) - */ - - // @todo Describe (implement?) other options like ->getParams(), ->getSeeAlsoEntries(), ->getChangelogEntries() - $json_arr[$function_name_fixed] = array( - - // Example usage: php.net/$id works - 'id' => (string) $function->getManualId(), - - 'purpose' => (string) $purpose, - - 'prototype' => (string) $prototype, - - // Return description. It contains text (including tables) so may be large and odd - 'return' => (string) $return, - - // @todo This appears empty for class::method's -- why? - 'versions' => (string) $function->getVersion(), - ); -} - -$json_text = json_encode($json_arr); -if (!$json_text) { - echo 'Fatal Error: Could not create valid json.' . PHP_EOL; - echo 'Information: json array has count of ' . count($json_arr) . PHP_EOL; - exit; -} - -if (!file_put_contents(FILENAME_JSON, $json_text)) { - echo 'Fatal Error: Could not save JSON to ' . FILENAME_JSON . PHP_EOL; - exit; -} - -echo 'Success. Saved json to ' . FILENAME_JSON . '. String length = ' . strlen($json_text) . PHP_EOL; diff --git a/scripts/helpers/phpdoc-completion.sh b/scripts/helpers/phpdoc-completion.sh deleted file mode 100755 index ecef9d50a..000000000 --- a/scripts/helpers/phpdoc-completion.sh +++ /dev/null @@ -1,36 +0,0 @@ -# ex: ts=4 sw=4 et filetype=sh - -_phpdoc() -{ - local cur opts - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - opts=" - --help - --version - --quiet - --srcdir= - --basedir= - --rootdir= - --enable-force-dom-save - --enable-chm - --enable-howto - --with-lang= - --disable-segfault-error - --disable-segfault-speed - --disable-version-files - --disable-libxml-check - --with-php= - --with-partial= - --generate= - --output= - --disable-broken-file-listing - --redirect-stderr-to-stdout" - - if [[ ${cur} == -* ]] ; then - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - fi -} - -complete -F _phpdoc phpdoc \ No newline at end of file diff --git a/scripts/mk_ini_set_table.sh b/scripts/mk_ini_set_table.sh deleted file mode 100755 index d7f1e5f32..000000000 --- a/scripts/mk_ini_set_table.sh +++ /dev/null @@ -1,92 +0,0 @@ -#! /bin/sh - -# Quick hack to make a table of PHP options -# and where they can be changed -# Uses GNU grep and GNU awk -# Author: Jesus M. Castagnetto -# Created: Mon Mar 19 04:57:02 PST 2001 -# Updated: Thu Apr 25 11:42:26 PDT 2002 -# - look through all PHP_INI_ containing files -# - save table in the new split dir for the function -# Updated: Wed Nov 20 18:16:12 PST 2002 -# - rearrange the order of the tables, put the PHP_INI_* definitions first. - -cfiles=`grep -rl PHP_INI_ ../php4/*` -ini_set_table="en/reference/info/functions/ini_set_table"; - -awk 'BEGIN { - print ""; - print " "; - print " The PHP_INI_* constants used in the table below are defined as follows:"; - print " "; - print " "; - print " "; - print " Constant"; - print " Value"; - print " Meaning"; - print " "; - print " "; - print " "; - print " "; - print " PHP_INI_USER"; - print " 1"; - print " Entry can be set in user scripts"; - print " "; - print " "; - print " PHP_INI_PERDIR"; - print " 2"; - print " Entry can be set in .htaccess"; - print " "; - print " "; - print " PHP_INI_SYSTEM"; - print " 4"; - print " Entry can be set in php.ini or"; - print " httpd.conf"; - print " "; - print " "; - print " PHP_INI_ALL"; - print " 7"; - print " Entry can be set anywhere"; - print " "; - print " "; - print "
"; - print "
"; - print "
"; - print "\n Configuration options" - print " "; - print " "; - print " "; - print " Name"; - print " Default"; - print " Changeable"; - print " "; - print " "; - print " "; -} -$0 ~ /PHP_INI_.*\(/ && $0 !~ /^static/ && $0 !~ /PHP_INI_(BEGIN|END)/ { -nf = split($0,tmp,","); - -varname = substr(tmp[1], index(tmp[1], "\"")); -gsub("\"", "", varname); - -vardef = tmp[2]; -gsub("(\t| )+", "", vardef); -#if (index(vardef, "\"")) -# gsub("\"", "", vardef); - -varmod = tmp[3]; -gsub("(\t| )+", "", varmod); - -print " "; -print " " varname "" -print " " vardef "" -print " " varmod "" -print " "; -}; -END { - print " "; - print " "; - print "
"; - }' $cfiles > $ini_set_table - -ls -l $ini_set_table