34 lines
901 B
PHP
34 lines
901 B
PHP
<?php
|
|
|
|
use PhangoApp\LeviathanUtils\Linux;
|
|
|
|
include('leviathanutils/vendor/autoload.php');
|
|
|
|
$user=get_current_user();
|
|
|
|
$file_wp='/usr/local/bin/wp';
|
|
|
|
Linux::json_log('Installing WP Wordpress utility...', $error=0, $status=0, $progress=0, $no_progress=1);
|
|
|
|
if(is_file($file_wp)) {
|
|
|
|
Linux::json_log('Installed, updating wp...', $error=0, $status=0, $progress=0, $no_progress=1);
|
|
|
|
Linux::shell_command(["sudo ${file_wp} cli update --yes"]);
|
|
|
|
}
|
|
else {
|
|
/*
|
|
if(!is_dir('./bin')) {
|
|
|
|
mkdir('./bin');
|
|
|
|
}*/
|
|
|
|
Linux::shell_command(['curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar']);
|
|
Linux::shell_command(['chmod +x wp-cli.phar']);
|
|
Linux::shell_command(["sudo mv wp-cli.phar /usr/local/bin/wp"]);
|
|
|
|
}
|
|
|
|
Linux::json_log('WP utility installed successfully', $error=0, $status=0, $progress=100, $no_progress=0);
|