ok

Mini Shell

Direktori : /proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/opt/clwpos/
Upload File :
Current File : //proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/opt/clwpos/wp-cli-wrapped

#!/bin/bash
#######################################
# Timed-out wrapper around wp-cli
# Arguments:
#   $1 - Path to PHP binary, full filesystem path
#   $2 - Path to Wordpress installation, full filesystem path
#   All the rest arguments ($@) are treated as WP-CLI command
# Outputs:
#   Writes result to stdout
#######################################
PATH_TO_PHP="$1"
PATH_TO_WP="$2"

shift 2;

# WPOS wp-cli
WP_CLI="/opt/clwpos/wp-cli"

# Defaults for PHP
PHP_DEFAULT_MEMORY_LIMIT="-d memory_limit=-1"
PHP_DEFAULT_EXTENSIONS="phar json mysqli"
# explicitly drop PHP disable_functions directive in order to avoid errors like
# 'Error: Cannot do 'launch': The PHP functions `proc_open()` and/or `proc_close()` are disabled'
# during plugin manipulations
PHP_DEFAULT_FUNCTIONS="-d disable_functions="
# suppress deprecation warnings from php
PHP_SUPPRESS_ERRORS="-d error_reporting=24575"

# Defaults for WP-CLI
WP_CLI_DEFAULT_OPTS="--skip-themes"

# Default timeout, formatted as for timeout command (GNU coreutils)
# 2 minutes (120 seconds)
TIMEOUT="2m"

# Construct PHP extensions to include
EXTS=""
for ext in $PHP_DEFAULT_EXTENSIONS
do
  if ! $PATH_TO_PHP -m | grep -i "$ext" 1>/dev/null; then
    EXTS+=" -d extension=$ext.so"
  fi
done

if [[ "$1" == "help" ]]; then
  exec timeout $TIMEOUT $PATH_TO_PHP $EXTS $PHP_SUPPRESS_ERRORS $PHP_DEFAULT_MEMORY_LIMIT $PHP_DEFAULT_FUNCTIONS $WP_CLI --path=$PATH_TO_WP $WP_CLI_DEFAULT_OPTS "$@" | cat
else
  exec timeout $TIMEOUT $PATH_TO_PHP $EXTS $PHP_SUPPRESS_ERRORS $PHP_DEFAULT_MEMORY_LIMIT $PHP_DEFAULT_FUNCTIONS $WP_CLI --path=$PATH_TO_WP $WP_CLI_DEFAULT_OPTS "$@"
fi

Zerion Mini Shell 1.0