removed /etc and /opt

This commit is contained in:
cutemeli
2025-12-22 10:48:14 +00:00
parent 5ce7ca2c5d
commit 10d1afbb17
32559 changed files with 0 additions and 6756692 deletions

View File

@@ -1,92 +0,0 @@
#!/usr/bin/env bash
set -e
export -n CDPATH
if [ "$1" = "--debug" ]; then
export PHPENV_DEBUG=1
shift
fi
if [ -n "$PHPENV_DEBUG" ]; then
export PS4='+ [${BASH_SOURCE##*/}:${LINENO}] '
set -x
fi
resolve_link() {
$(type -p greadlink readlink | head -1) "$1"
}
abs_dirname() {
local cwd="$(pwd)"
local path="$1"
while [ -n "$path" ]; do
cd "${path%/*}"
local name="${path##*/}"
path="$(resolve_link "$name" || true)"
done
pwd
cd "$cwd"
}
if [ -z "${PHPENV_ROOT}" ]; then
PHPENV_ROOT="${HOME}/.phpenv"
else
PHPENV_ROOT="${PHPENV_ROOT%/}"
fi
export PHPENV_ROOT
if [ -z "${PHPENV_DIR}" ]; then
PHPENV_DIR="$(pwd)"
else
cd "$PHPENV_DIR" 2>/dev/null || {
echo "phpenv: cannot change working directory to \`$PHPENV_DIR'"
exit 1
} >&2
PHPENV_DIR="$(pwd)"
cd "$OLDPWD"
fi
export PHPENV_DIR
shopt -s nullglob
bin_path="$(abs_dirname "$0")"
for plugin_bin in "${PHPENV_ROOT}/plugins/"*/bin; do
bin_path="${bin_path}:${plugin_bin}"
done
export PATH="${bin_path}:${PATH}"
hook_path="${PHPENV_HOOK_PATH}:${PHPENV_ROOT}/phpenv.d:/usr/local/etc/phpenv.d:/etc/phpenv.d:/usr/lib/phpenv/hooks"
for plugin_hook in "${PHPENV_ROOT}/plugins/"*/etc/phpenv.d; do
hook_path="${hook_path}:${plugin_hook}"
done
export PHPENV_HOOK_PATH="$hook_path"
shopt -u nullglob
command="$1"
if [[ "$2" = "--help" || "$2" = "-h" ]]; then
phpenv-help "$command" >&2
exit 1
fi
case "$command" in
"" | "-h" | "--help" )
echo -e "$(phpenv-help)" >&2
;;
"-v" )
exec phpenv---version
;;
* )
command_path="$(command -v "phpenv-$command" || true)"
if [ -z "$command_path" ]; then
echo "phpenv: no such command \`$command'" >&2
exit 1
fi
shift 1
exec "$command_path" "$@"
;;
esac

View File

@@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Summary: Display the version of phpenv
#
# Displays the version number of this phpenv release, including the
# current revision from git, if available.
#
# The format of the git revision is:
# <version>-<num_commits>-<git_sha>
# where `num_commits` is the number of commits since `version` was
# tagged.
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
version="0.9.0-rc.1"
git_revision=""
cd "$PHPENV_ROOT"
git_revision="$(git describe --tags HEAD 2>/dev/null || true)"
git_revision="${git_revision#v}"
echo "phpenv v${git_revision:-$version}"

View File

@@ -1,41 +0,0 @@
#!/usr/bin/env bash
# Summary: List all available phpenv commands
# Usage: phpenv commands [--sh|--no-sh]
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
# Provide phpenv completions
if [ "$1" = "--complete" ]; then
echo --sh
echo --no-sh
exit
fi
if [ "$1" = "--sh" ]; then
sh=1
shift
elif [ "$1" = "--no-sh" ]; then
nosh=1
shift
fi
shopt -s nullglob
{ for path in ${PATH//:/$'\n'}; do
for command in "${path}/phpenv-"*; do
command="${command##*phpenv-}"
if [ -n "$sh" ]; then
if [ ${command:0:3} = "sh-" ]; then
echo ${command##sh-}
fi
elif [ -n "$nosh" ]; then
if [ ${command:0:3} != "sh-" ]; then
echo ${command##sh-}
fi
else
echo ${command##sh-}
fi
done
done
} | sort | uniq

View File

@@ -1,17 +0,0 @@
#!/usr/bin/env bash
# Usage: phpenv completions <command> [arg1 arg2...]
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
COMMAND="$1"
if [ -z "$COMMAND" ]; then
phpenv-help --usage completions >&2
exit 1
fi
COMMAND_PATH="$(command -v "phpenv-$COMMAND" || command -v "phpenv-sh-$COMMAND")"
if grep -i "^# provide phpenv completions" "$COMMAND_PATH" >/dev/null; then
shift
exec "$COMMAND_PATH" --complete "$@"
fi

View File

@@ -1,23 +0,0 @@
#!/usr/bin/env bash
# Summary: Edit the current PHP's php.ini configuration file at location
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
if [ "$VISUAL" ]; then
cmd="$VISUAL"
fi
if ! [ "$cmd" ] && [ "$EDITOR" ]; then
cmd="$EDITOR"
fi
if ! [ "$cmd" ] && type vim >/dev/null 2>&1; then
cmd="vim"
fi
if ! [ "$cmd" ]; then
cmd="vi"
fi
"$cmd" "$(php --ini|grep Loaded|awk '{print $NF}')"

View File

@@ -1,43 +0,0 @@
#!/usr/bin/env bash
#
# Summary: Run an executable with the selected PHP version
#
# Usage: phpenv exec <command> [arg1 arg2...]
#
# Runs an executable by first preparing PATH so that the selected PHP
# version's `bin' directory is at the front.
#
# For example, if the currently selected PHP version is 1.9.3-p327:
# phpenv exec bundle install
#
# is equivalent to:
# PATH="$PHPENV_ROOT/versions/1.9.3-p327/bin:$PATH" bundle install
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
# Provide phpenv completions
if [ "$1" = "--complete" ]; then
exec phpenv shims --short
fi
export PHPENV_VERSION="$(phpenv-version-name)"
PHPENV_COMMAND="$1"
if [ -z "$PHPENV_COMMAND" ]; then
phpenv-help --usage exec >&2
exit 1
fi
PHPENV_COMMAND_PATH="$(phpenv-which "$PHPENV_COMMAND")"
PHPENV_BIN_PATH="${PHPENV_COMMAND_PATH%/*}"
for script in $(phpenv-hooks exec); do
source "$script"
done
shift 1
if [ "$PHPENV_VERSION" != "system" ]; then
export PATH="${PHPENV_BIN_PATH}:${PATH}"
fi
exec -a "$PHPENV_COMMAND" "$PHPENV_COMMAND_PATH" "$@"

View File

@@ -1,63 +0,0 @@
#!/usr/bin/env bash
#
# Summary: Set or show the global PHP version and update the Apache apxs
# library link
#
# Usage: phpenv global <version>
# phpenv global --unset
#
# Sets the global PHP version. You can override the global version at
# any time by setting a directory-specific version with `phpenv local'
# or by setting the `PHPENV_VERSION' environment variable.
#
# <version> should be a string matching a PHP version known to phpenv.
# The special version string `system' will use your default system PHP.
# Run `phpenv versions' for a list of available PHP versions.
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
# Provide phpenv completions
if [ "$1" = "--complete" ]; then
echo system --unset
exec phpenv-versions --bare
fi
PHPENV_VERSION="$1"
PHPENV_VERSION_FILE="${PHPENV_ROOT}/version"
if [ "$1" == "--unset" ]; then
rm -f "$PHPENV_VERSION_FILE"
PHPENV_VERSION=""
fi
if [ -n "$PHPENV_VERSION" ]; then
phpenv-version-file-write "$PHPENV_VERSION_FILE" "$PHPENV_VERSION"
else
PHPENV_VERSION=$(phpenv-version-file-read "$PHPENV_VERSION_FILE") ||
PHPENV_VERSION=$(phpenv-version-file-read "${PHPENV_ROOT}/global") ||
PHPENV_VERSION=$(phpenv-version-file-read "${PHPENV_ROOT}/default") ||
PHPENV_VERSION=system
fi
echo ${PHPENV_VERSION}
# Link Apache apxs lib
rm -f "${PHPENV_ROOT}"/lib/libphp*.so
LIBPHP_SO_FILE="libphp$(php-config --version | cut -c1).so"
APXS=""
if [ "${PHPENV_VERSION}" == "system" ]; then
DEFAULT_APXS="$(which apxs 2>/dev/null)"
if [ -n "${DEFAULT_APXS}" -a -f "$(${DEFAULT_APXS} -q LIBEXECDIR)/${LIBPHP_SO_FILE}" ]; then
APXS="${DEFAULT_APXS}"
fi
fi
php-config --configure-options 2>/dev/null | grep -q apxs && \
APXS="$(php-config --configure-options| sed 's/.*=\(.*apxs[^ ]*\) .*/\1/')"
[[ -d "${PHPENV_ROOT}/lib" ]] || mkdir "${PHPENV_ROOT}/lib"
if [ -n "${APXS}" ]; then
[[ "${PHPENV_VERSION}" == "system" ]] && \
ln -fs "$(${APXS} -q LIBEXECDIR)/${LIBPHP_SO_FILE}" "${PHPENV_ROOT}/lib/${LIBPHP_SO_FILE}" || \
ln -fs "${PHPENV_ROOT}/versions/${PHPENV_VERSION}/libexec/${LIBPHP_SO_FILE}" "${PHPENV_ROOT}/lib/${LIBPHP_SO_FILE}";
fi

View File

@@ -1,165 +0,0 @@
#!/usr/bin/env bash
#
# Summary: Display help for a command
#
# Usage: phpenv help [--usage] COMMAND
#
# Parses and displays help contents from a command's source file.
#
# A command is considered documented if it starts with a comment block
# that has a `Summary:' or `Usage:' section. Usage instructions can
# span multiple lines as long as subsequent lines are indented.
# The remainder of the comment block is displayed as extended
# documentation.
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
command_path() {
local command="$1"
command -v phpenv-"$command" || command -v phpenv-sh-"$command" || true
}
extract_initial_comment_block() {
sed -ne "
/^#/ !{
q
}
s/^#$/# /
/^# / {
s/^# //
p
}
"
}
collect_documentation() {
awk '
/^Summary:/ {
summary = substr($0, 10)
next
}
/^Usage:/ {
reading_usage = 1
usage = usage "\n" $0
next
}
/^( *$| )/ && reading_usage {
usage = usage "\n" $0
next
}
{
reading_usage = 0
help = help "\n" $0
}
function escape(str) {
gsub(/[`\\$"]/, "\\\\&", str)
return str
}
function trim(str) {
sub(/^\n*/, "", str)
sub(/\n*$/, "", str)
return str
}
END {
if (usage || summary) {
print "summary=\"" escape(summary) "\""
print "usage=\"" escape(trim(usage)) "\""
print "help=\"" escape(trim(help)) "\""
}
}
'
}
documentation_for() {
local filename="$(command_path "$1")"
if [ -n "$filename" ]; then
extract_initial_comment_block < "$filename" | collect_documentation
fi
}
print_summary() {
local command="$1"
local summary usage help
eval "$(documentation_for "$command")"
if [ -n "$summary" ]; then
printf " %-9s %s\n" "$command" "$summary"
fi
}
print_summaries() {
for command; do
print_summary "$command"
done
}
print_help() {
local command="$1"
local summary usage help
eval "$(documentation_for "$command")"
[ -n "$help" ] || help="$summary"
if [ -n "$usage" -o -n "$summary" ]; then
local buffer="$(
print_usage $command;
if [ -n "$help" ]; then \
echo -e "\n$help\n";
fi
)"
echo "${buffer}"|$([[ $(tput lines) -lt $(echo "${buffer}"| wc -l ) ]] && echo less || echo cat)
else
echo "Sorry, this command isn't documented yet." >&2
return 1
fi
}
print_usage() {
local command="$1"
local summary usage help
eval "$(documentation_for "$command")"
echo "${command}:"
echo ${command//?/=}=
[[ -n "$summary" ]] && printf " %s\n\n" "$summary"
[[ -z "$usage" ]] || echo "$usage"
}
unset usage
if [ "$1" = "--usage" ]; then
usage="1"
shift
fi
if [ -z "$1" ] || [ "$1" == "phpenv" ]; then
echo "phpenv:"
printf "%0.1s" "="{1..7}
echo -e "\n PHP multi-version installation and management utility.\n"
echo "Usage: phpenv <command> [<args>]"
[ -z "$usage" ] || exit
echo
echo "Some useful phpenv commands are:"
print_summaries commands configure local global shell install uninstall rehash version versions which whence
echo
echo "See \`phpenv help <command>' for information on a specific command."
echo "For full documentation, see: https://github.com/phpenv/phpenv#readme"
else
command="$1"
if [ -n "$(command_path "$command")" ]; then
if [ -n "$usage" ]; then
print_usage "$command"
else
print_help "$command"
fi
else
echo "phpenv: no such command \`$command'" >&2
exit 1
fi
fi

View File

@@ -1,63 +0,0 @@
#!/usr/bin/env bash
# Summary: List hook scripts for a given phpenv command
# Usage: phpenv hooks <command>
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
# Provide phpenv completions
if [ "$1" = "--complete" ]; then
echo exec
echo rehash
echo which
exit
fi
PHPENV_COMMAND="$1"
if [ -z "$PHPENV_COMMAND" ]; then
phpenv-help --usage hooks >&2
exit 1
fi
#PHPENV_COMMAND_HOOK="$2"
#if [ -z "$PHPENV_COMMAND_HOOK" ]; then
# PHPENV_COMMAND_HOOK="*"
#fi
resolve_link() {
$(type -p greadlink readlink | head -1) $1
}
realpath() {
local cwd="$(pwd)"
local base="$(basename $1)"
local path="$1"
while [ -n "$path" ]; do
cd "${path%/*}"
local name="${path##*/}"
path="$(resolve_link "$name" || true)"
done
echo "$(pwd)/$base"
cd "$cwd"
}
shopt -s nullglob
for path in ${PHPENV_HOOK_PATH//:/$'\n'}; do
for script in $path/"$PHPENV_COMMAND"/*.bash; do
echo $(realpath $script)
done
done
#
#for path in ${PHPENV_HOOK_PATH//:/$'\n'}; do
# files="${path}/${PHPENV_COMMAND}/${PHPENV_COMMAND_HOOK}.bash"
# for script in $files; do
# if [ "$PHPENV_COMMAND_HOOK" != "*" ] && [ -x $script ]; then
# exec "$script"
# elif [ -f $script ]; then
# echo $(realpath $script)
# fi
# done
#done
shopt -u nullglob

View File

@@ -1,151 +0,0 @@
#!/usr/bin/env bash
# Summary: Configure the shell environment for phpenv
# Usage: eval "$(phpenv init - [--no-rehash] [<shell>])"
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
print=""
no_rehash=""
for args in "$@"
do
if [ "$args" = "-" ]; then
print=1
shift
fi
if [ "$args" = "--no-rehash" ]; then
no_rehash=1
shift
fi
done
shell="$1"
if [ -z "$shell" ]; then
shell="$(basename "$SHELL")"
fi
resolve_link() {
$(type -p greadlink readlink | head -1) $1
}
abs_dirname() {
local cwd="$(pwd)"
local path="$1"
while [ -n "$path" ]; do
cd "${path%/*}"
local name="${path##*/}"
path="$(resolve_link "$name" || true)"
done
pwd
cd "$cwd"
}
root="$(abs_dirname "$0")/.."
if [ -z "$print" ]; then
case "$shell" in
bash )
profile='~/.bash_profile'
;;
zsh )
profile='~/.zshrc'
;;
ksh )
profile='~/.profile'
;;
fish )
profile='~/.config/fish/config.fish'
;;
* )
profile='your profile'
;;
esac
{ echo "# Load phpenv automatically by adding"
echo "# the following to ${profile}:"
echo
case "$shell" in
fish )
echo 'status --is-interactive; and source (phpenv init -|psub)'
;;
* )
echo 'eval "$(phpenv init -)"'
;;
esac
echo
} >&2
exit 1
fi
mkdir -p "${PHPENV_ROOT}/"{shims,versions}
case "$shell" in
fish )
echo "set -gx PATH '${PHPENV_ROOT}/shims' \$PATH"
;;
* )
echo 'export PATH="'${PHPENV_ROOT}'/shims:${PATH}"'
;;
esac
case "$shell" in
bash | zsh | fish )
echo "source \"$root/completions/phpenv.${shell}\""
;;
esac
if [ -z "$no_rehash" ]; then
echo 'phpenv rehash 2>/dev/null'
fi
commands=(`phpenv-commands --sh`)
case "$shell" in
fish )
cat <<EOS
function phpenv
set command \$argv[1]
set -e argv[1]
switch "\$command"
case ${commands[*]}
source (phpenv "sh-\$command" \$argv|psub)
case '*'
command phpenv "\$command" \$argv
end
end
EOS
;;
ksh )
cat <<EOS
function phpenv {
typeset command
EOS
;;
* )
cat <<EOS
phpenv() {
local command
EOS
;;
esac
if [ "$shell" != "fish" ]; then
IFS="|"
cat <<EOS
command="\$1"
if [ "\$#" -gt 0 ]; then
shift
fi
case "\$command" in
${commands[*]})
eval \`phpenv "sh-\$command" "\$@"\`;;
*)
command phpenv "\$command" "\$@";;
esac
}
EOS
fi

View File

@@ -1,57 +0,0 @@
#!/usr/bin/env bash
#
# Summary: Set or show the local application-specific PHP version
#
# Usage: phpenv local <version>
# phpenv local --unset
#
# Sets the local application-specific PHP version by writing the
# version name to a file named `.php-version'.
#
# When you run a PHP command, phpenv will look for a `.php-version'
# file in the current directory and each parent directory. If no such
# file is found in the tree, phpenv will use the global PHP version
# specified with `phpenv global'. A version specified with the
# `PHPENV_VERSION' environment variable takes precedence over local
# and global versions.
#
# For backwards compatibility, phpenv will also read version
# specifications from `.phpenv-version' files, but a `.php-version'
# file in the same directory takes precedence.
#
# <version> should be a string matching a PHP version known to phpenv.
# The special version string `system' will use your default system PHP.
# Run `phpenv versions' for a list of available PHP versions.
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
# Provide phpenv completions
if [ "$1" = "--complete" ]; then
echo --unset
echo system
exec phpenv-versions --bare
fi
PHPENV_VERSION="$1"
if [ "$PHPENV_VERSION" = "--unset" ]; then
rm -f .php-version .phpenv-version
PHPENV_VERSION=""
elif [ -n "$PHPENV_VERSION" ]; then
if [ "$(PHPENV_VERSION= phpenv-version-origin)" -ef .phpenv-version ]; then
rm -f .phpenv-version
{ echo "phpenv: removed existing \`.phpenv-version' file and migrated"
echo " local version specification to \`.php-version' file"
} >&2
fi
phpenv-version-file-write .php-version "$PHPENV_VERSION"
echo "$PHPENV_VERSION" >&2
fi
if [ -z "$PHPENV_VERSION" ]; then
phpenv-version-file-read .php-version ||
phpenv-version-file-read .phpenv-version ||
{ echo "phpenv: no local version configured for this directory"
exit 1
} >&2
fi

View File

@@ -1,37 +0,0 @@
#!/usr/bin/env bash
# Summary: Display prefix for a PHP version
# Usage: phpenv prefix [<version>]
#
# Displays the directory where a PHP version is installed. If no
# version is given, `phpenv prefix' displays the location of the
# currently selected version.
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
# Provide phpenv completions
if [ "$1" = "--complete" ]; then
echo system
exec phpenv-versions --bare
fi
if [ -n "$1" ]; then
export PHPENV_VERSION="$1"
elif [ -z "$PHPENV_VERSION" ]; then
PHPENV_VERSION="$(phpenv-version-name)"
fi
if [ "$PHPENV_VERSION" = "system" ]; then
PHP_PATH="$(phpenv-which php)"
PHP_PATH="${PHP_PATH%/*}"
echo "${PHP_PATH%/bin}"
exit
fi
PHPENV_PREFIX_PATH="${PHPENV_ROOT}/versions/${PHPENV_VERSION}"
if [ ! -d "$PHPENV_PREFIX_PATH" ]; then
echo "phpenv: version \`${PHPENV_VERSION}' not installed" >&2
exit 1
fi
echo "$PHPENV_PREFIX_PATH"

View File

@@ -1,151 +0,0 @@
#!/usr/bin/env bash
# Summary: Rehash phpenv shims (run this after installing executables)
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
SHIM_PATH="${PHPENV_ROOT}/shims"
PROTOTYPE_SHIM_PATH="${SHIM_PATH}/.phpenv-shim"
# Create the shims directory if it doesn't already exist.
mkdir -p "$SHIM_PATH"
# Ensure only one instance of phpenv-rehash is running at a time by
# setting the shell's `noclobber` option and attempting to write to
# the prototype shim file. If the file already exists, print a warning
# to stderr and exit with a non-zero status.
set -o noclobber
{ echo > "$PROTOTYPE_SHIM_PATH"
} 2>/dev/null ||
{ echo "phpenv: cannot rehash: $PROTOTYPE_SHIM_PATH exists"
exit 1
} >&2
set +o noclobber
# If we were able to obtain a lock, register a trap to clean up the
# prototype shim when the process exits.
trap remove_prototype_shim EXIT
remove_prototype_shim() {
rm -f "$PROTOTYPE_SHIM_PATH"
}
# The prototype shim file is a script that re-execs itself, passing
# its filename and any arguments to `phpenv exec`. This file is
# hard-linked for every executable and then removed. The linking
# technique is fast, uses less disk space than unique files, and also
# serves as a locking mechanism.
create_prototype_shim() {
cat > "$PROTOTYPE_SHIM_PATH" <<SH
#!/usr/bin/env bash
set -e
[ -n "\$PHPENV_DEBUG" ] && set -x
program="\${0##*/}"
if [ "\$program" = "php" ]; then
for arg; do
case "\$arg" in
-e* | -- ) break ;;
*/* )
if [ -f "\$arg" ]; then
export PHPENV_DIR="\${arg%/*}"
break
fi
;;
esac
done
fi
export PHPENV_ROOT="$PHPENV_ROOT"
exec "$(command -v phpenv)" exec "\$program" "\$@"
SH
chmod +x "$PROTOTYPE_SHIM_PATH"
}
# If the contents of the prototype shim file differ from the contents
# of the first shim in the shims directory, assume phpenv has been
# upgraded and the existing shims need to be removed.
remove_outdated_shims() {
for shim in *; do
if ! diff "$PROTOTYPE_SHIM_PATH" "$shim" >/dev/null 2>&1; then
for shim in *; do rm -f "$shim"; done
fi
break
done
}
# The basename of each argument passed to `make_shims` will be
# registered for installation as a shim. In this way, plugins may call
# `make_shims` with a glob to register many shims at once.
make_shims() {
local shims="$@"
for file in $shims; do
local shim="${file##*/}"
register_shim "$shim"
done
}
# Create an empty array for the list of registered shims and an empty
# string to use as a search index.
registered_shims=()
registered_shims_index=""
# We will keep track of shims registered for installation with the
# global `registered_shims` array and with a global search index
# string. The array will let us iterate over all registered shims. The
# index string will let us quickly check whether a shim with the given
# name has been registered or not.
register_shim() {
local shim="$@"
registered_shims["${#registered_shims[@]}"]="$shim"
registered_shims_index="$registered_shims_index/$shim/"
}
# To install all the registered shims, we iterate over the
# `registered_shims` array and create a link if one does not already
# exist.
install_registered_shims() {
local shim
for shim in "${registered_shims[@]}"; do
[ -e "$shim" ] || ln -f "$PROTOTYPE_SHIM_PATH" "$shim"
done
}
# Once the registered shims have been installed, we make a second pass
# over the contents of the shims directory. Any file that is present
# in the directory but has not been registered as a shim should be
# removed.
remove_stale_shims() {
local shim
for shim in *; do
if [[ "$registered_shims_index" != *"/$shim/"* ]]; then
rm -f "$shim"
fi
done
}
# Change to the shims directory.
cd "$SHIM_PATH"
shopt -s nullglob
# Create the prototype shim, then register shims for all known
# executables.
create_prototype_shim
remove_outdated_shims
make_shims ../versions/*/*bin/*
# Restore the previous working directory.
cd "$OLDPWD"
# Allow plugins to register shims.
for script in $(phpenv-hooks rehash); do
source "$script"
done
# Change back to the shims directory to install the registered shims
# and remove stale shims.
cd "$SHIM_PATH"
install_registered_shims
remove_stale_shims

View File

@@ -1,3 +0,0 @@
#!/usr/bin/env bash
# Summary: Display the root directory where versions and shims are kept
echo $PHPENV_ROOT

View File

@@ -1,51 +0,0 @@
#!/usr/bin/env bash
#
# Summary: Set or show the shell-specific PHP version
#
# Usage: phpenv shell <version>
# phpenv shell --unset
#
# Sets a shell-specific PHP version by setting the `PHPENV_VERSION'
# environment variable in your shell. This version overrides local
# application-specific versions and the global version.
#
# <version> should be a string matching a PHP version known to phpenv.
# The special version string `system' will use your default system PHP.
# Run `phpenv versions' for a list of available PHP versions.
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
# Provide phpenv completions
if [ "$1" = "--complete" ]; then
echo --unset
echo system
exec phpenv-versions --bare
fi
version="$1"
if [ "$version" = "--unset" ]; then
echo "unset PHPENV_VERSION" 2>/dev/null
PHPENV_VERSION=""; version=""
fi
if [ -z "$version" ]; then
if [ -z "$PHPENV_VERSION" ]; then
echo "phpenv: no shell-specific version configured" >&2
exit 1
else
echo "echo \"\$PHPENV_VERSION\""
exit
fi
fi
# Make sure the specified version is installed.
if phpenv-prefix "$version" >/dev/null; then
echo "export PHPENV_VERSION=\"${version}\""
echo "$version" >&2
else
echo "return 1"
exit 1
fi

View File

@@ -1,20 +0,0 @@
#!/usr/bin/env bash
# Summary: List existing phpenv shims
# Usage: phpenv shims [--short]
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
# Provide phpenv completions
if [ "$1" = "--complete" ]; then
echo --short
exit
fi
for command in "${PHPENV_ROOT}/shims/"*; do
if [ "$1" = "--short" ]; then
echo "${command##*/}"
else
echo "$command"
fi
done | sort

View File

@@ -1,11 +0,0 @@
#!/usr/bin/env bash
# Summary: Show the current PHP version and its origin
#
# Shows the currently selected PHP version and how it was
# selected. To obtain only the version string, use `phpenv
# version-name'.
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
echo "$(phpenv-version-name) (set by $(phpenv-version-origin))"

View File

@@ -1,33 +0,0 @@
#!/usr/bin/env bash
# Summary: Detect the file that sets the current phpenv version
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
find_local_version_file() {
local root="$1"
while [ -n "$root" ]; do
if [ -e "${root}/.php-version" ]; then
echo "${root}/.php-version"
exit
elif [ -e "${root}/.phpenv-version" ]; then
echo "${root}/.phpenv-version"
exit
fi
root="${root%/*}"
done
}
find_local_version_file "$PHPENV_DIR"
[ "$PHPENV_DIR" = "$PWD" ] || find_local_version_file "$PWD"
global_version_file="${PHPENV_ROOT}/version"
if [ -e "$global_version_file" ]; then
echo "$global_version_file"
elif [ -e "${PHPENV_ROOT}/global" ]; then
echo "${PHPENV_ROOT}/global"
elif [ -e "${PHPENV_ROOT}/default" ]; then
echo "${PHPENV_ROOT}/default"
else
echo "$global_version_file"
fi

View File

@@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Usage: phpenv version-file-read <file>
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
VERSION_FILE="$1"
if [ -e "$VERSION_FILE" ]; then
# Read the first non-whitespace word from the specified version file.
# Be careful not to load it whole in case there's something crazy in it.
version=""
while read -a words; do
word="${words[0]}"
if [ -z "$version" ] && [ -n "$word" ]; then
version="$word"
fi
done < <( cat "$VERSION_FILE" && echo )
if [ -n "$version" ]; then
echo "$version"
exit
fi
fi
exit 1

View File

@@ -1,19 +0,0 @@
#!/usr/bin/env bash
# Usage: phpenv version-file-write <file> <version>
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
PHPENV_VERSION_FILE="$1"
PHPENV_VERSION="$2"
if [ -z "$PHPENV_VERSION" ] || [ -z "$PHPENV_VERSION_FILE" ]; then
phpenv-help --usage version-file-write >&2
exit 1
fi
# Make sure the specified version is installed.
phpenv-prefix "$PHPENV_VERSION" >/dev/null
# Write the version out to disk.
echo "$PHPENV_VERSION" > "$PHPENV_VERSION_FILE"

View File

@@ -1,31 +0,0 @@
#!/usr/bin/env bash
# Summary: Show the current PHP version
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
if [ -z "$PHPENV_VERSION" ]; then
PHPENV_VERSION_FILE="$(phpenv-version-file)"
PHPENV_VERSION="$(phpenv-version-file-read "$PHPENV_VERSION_FILE" || true)"
fi
if [ -z "$PHPENV_VERSION" ] || [ "$PHPENV_VERSION" = "system" ]; then
echo "system"
exit
fi
version_exists() {
local version="$1"
[ -d "${PHPENV_ROOT}/versions/${version}" ]
}
if version_exists "$PHPENV_VERSION"; then
echo "$PHPENV_VERSION"
elif version_exists "${PHPENV_VERSION#php-}"; then
{ echo "warning: ignoring extraneous \`php-' prefix in version \`${PHPENV_VERSION}'"
echo " (set by $(phpenv-version-origin))"
} >&2
echo "${PHPENV_VERSION#php-}"
else
echo "phpenv: version \`$PHPENV_VERSION' is not installed" >&2
exit 1
fi

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
# Summary: Explain how the current PHP version is set
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
if [ -n "$PHPENV_VERSION" ]; then
echo "PHPENV_VERSION environment variable"
else
phpenv-version-file
fi

View File

@@ -1,39 +0,0 @@
#!/usr/bin/env bash
# Summary: List all PHP versions available to phpenv
# Usage: phpenv versions [--bare]
#
# Lists all PHP versions found in `$PHPENV_ROOT/versions/*'.
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
if [ "$1" = "--bare" ]; then
hit_prefix=""
miss_prefix=""
current_version=""
include_system=""
else
hit_prefix="* "
miss_prefix=" "
current_version="$(phpenv-version-name || true)"
include_system="1"
fi
print_version() {
if [ "$1" == "$current_version" ]; then
echo "${hit_prefix}$(phpenv-version 2>/dev/null)"
else
echo "${miss_prefix}$1"
fi
}
# Include "system" in the non-bare output, if it exists
if [ -n "$include_system" ] && PHPENV_VERSION=system phpenv-which php >/dev/null 2>&1; then
print_version system
fi
for path in "${PHPENV_ROOT}/versions/"*; do
if [ -d "$path" ]; then
print_version "${path##*/}"
fi
done

View File

@@ -1,38 +0,0 @@
#!/usr/bin/env bash
# Summary: List all PHP versions that contain the given executable
# Usage: phpenv whence [--path] <command>
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
# Provide phpenv completions
if [ "$1" = "--complete" ]; then
echo --path
exec phpenv shims --short
fi
if [ "$1" = "--path" ]; then
print_paths="1"
shift
else
print_paths=""
fi
whence() {
local command="$1"
phpenv-versions --bare | while read version; do
path="$(phpenv-prefix "$version")/bin/${command}"
if [ -x "$path" ]; then
[ "$print_paths" ] && echo "$path" || echo "$version"
fi
done
}
PHPENV_COMMAND="$1"
if [ -z "$PHPENV_COMMAND" ]; then
phpenv-help --usage whence >&2
exit 1
fi
result="$(whence "$PHPENV_COMMAND")"
[ -n "$result" ] && echo "$result"

View File

@@ -1,88 +0,0 @@
#!/usr/bin/env bash
#
# Summary: Display the full path to an executable
#
# Usage: phpenv which <command>
#
# Displays the full path to the executable that phpenv will invoke when
# you run the given command.
set -e
[ -n "$PHPENV_DEBUG" ] && set -x
# Provide phpenv completions
if [ "$1" = "--complete" ]; then
exec phpenv shims --short
fi
expand_path() {
if [ ! -d "$1" ]; then
return 1
fi
local cwd="$(pwd)"
cd "$1"
pwd
cd "$cwd"
}
remove_from_path() {
local path_to_remove="$(expand_path "$1")"
local result=""
if [ -z "$path_to_remove" ]; then
echo "${PATH}"
return
fi
local paths
IFS=: paths=($PATH)
for path in "${paths[@]}"; do
path="$(expand_path "$path" || true)"
if [ -n "$path" ] && [ "$path" != "$path_to_remove" ]; then
result="${result}${path}:"
fi
done
echo "${result%:}"
}
PHPENV_VERSION="$(phpenv-version-name)"
PHPENV_COMMAND="$1"
if [ -z "$PHPENV_COMMAND" ]; then
phpenv-help --usage which >&2
exit 1
fi
if [ "$PHPENV_VERSION" = "system" ]; then
PATH="$(remove_from_path "${PHPENV_ROOT}/shims")"
PHPENV_COMMAND_PATH="$(command -v "$PHPENV_COMMAND" || true)"
else
PHPENV_COMMAND_PATH="${PHPENV_ROOT}/versions/${PHPENV_VERSION}/bin/${PHPENV_COMMAND}"
if ! [ -x "$PHPENV_COMMAND_PATH" ]; then
PHPENV_COMMAND_PATH="${PHPENV_ROOT}/versions/${PHPENV_VERSION}/sbin/${PHPENV_COMMAND}"
fi
fi
for script in $(phpenv-hooks which); do
source "$script"
done
if [ -x "$PHPENV_COMMAND_PATH" ]; then
echo "$PHPENV_COMMAND_PATH"
else
echo "phpenv: $PHPENV_COMMAND: command not found" >&2
versions="$(phpenv-whence "$PHPENV_COMMAND" || true)"
if [ -n "$versions" ]; then
{ echo
echo "The \`$1' command exists in these PHP versions:"
echo "$versions" | sed 's/^/ /g'
echo
} >&2
fi
exit 127
fi