Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
opt
/
clwpos
/
Or
Select Your Path :
Upload File :
New :
File
Dir
//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 # change current working directory # we need this because if php code has relative imports # it looks for scripts inside current directory first # e.g. some providers add require('wp-salt.php') to config # https://stackoverflow.com/questions/75823716/ # the overall approach of relative import is not correct, # but we still need patch for this cd "${PATH_TO_WP}" 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