%PDF- %PDF-
Direktori : /proc/4193076/root/opt/clwpos/ |
Current File : //proc/4193076/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=" # 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 exec timeout $TIMEOUT $PATH_TO_PHP $EXTS $PHP_DEFAULT_MEMORY_LIMIT $PHP_DEFAULT_FUNCTIONS $WP_CLI --path=$PATH_TO_WP $WP_CLI_DEFAULT_OPTS "$@"