Custom WordPress Core upgrade through wp-cli

This is a php script that can execute wp-cli, Keep the file in wp-admin/ folder and visit www.example-wordpress.com/wp-admin/execute_cli.php to run the script. This is just for test purposes and not a good way to use.

execute_cli.php

<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', '1');
echo "<PRE>\n";

if(!defined('STDIN'))  define('STDIN',  fopen('php://stdin',  'r'));
if(!defined('STDOUT')) define('STDOUT', fopen('php://stdout', 'w'));
if(!defined('STDERR')) define('STDERR', fopen('php://stdout', 'w'));

echo "Started\n\n";
$return_status = false;
$output = array();
//$executable="/path/to/php-executable -c /path/to/php.ini -d error_reporting="E_ALL & ~E_NOTICE" -d memory_limit="2048M" -d max_execution_time=43200 wp-cli.phar ";
//Redirect stdERR so we see warnings/errors
$suffix = ' 2>&1';
//echo 'Built executable=".$executable."\n";

//$command = "user delete johnsmithfake --network --yes';
$command = 'wp core update';
//$full_command = $executable.$command.$suffix;
$full_command = $command.$suffix;

echo "About to execute command=\n{$full_command}\n";
exec($full_command, $output, $return_var);

echo "---------------\n";
echo implode("\n", $output)."\n";
echo "---------------\n";
echo "Return status (false/0 is success)=".($return_status?1:0)."\n";

echo "\nDone</PRE>\n";