| Server IP : 3.138.164.131 / Your IP : 216.73.216.136 Web Server : Apache System : Linux ns1.techtime.me 4.18.0-147.8.1.el8.lve.1.x86_64 #1 SMP Mon Jun 29 09:55:57 EDT 2020 x86_64 User : injazaat ( 1471) PHP Version : 8.1.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/opt/clwpos/ |
Upload File : |
#!/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