34 lines
920 B
PHP
34 lines
920 B
PHP
<?php
|
|
|
|
use PhangoApp\LeviathanUtils\Linux;
|
|
|
|
include('leviathanutils/vendor/autoload.php');
|
|
|
|
$user=get_current_user();
|
|
|
|
$file_wp='./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(['./bin/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(["mv wp-cli.phar ./bin/wp && sudo ln -s /home/${user}/bin/wp /usr/local/bin/wp"]);
|
|
|
|
}
|
|
|
|
Linux::json_log('WP utility installed successfully', $error=0, $status=0, $progress=100, $no_progress=0);
|