Commit 7071368f authored by Antonio.Suerte's avatar Antonio.Suerte

Library Composing Tool

parent e55bed4c
......@@ -298,6 +298,51 @@ class DevTools extends DevComponents {
}
}
private function composing(){
$composerSettings = $this -> getDevSetting("composer_conf");
$settingValue = $this -> getColumnData($composerSettings, "dev_setting_value");
if($this -> isJSON($settingValue))
$composerSettings = json_decode($settingValue);
$extDir = SITE_ROOT."system/lib/ext/";
$pharCreation = false;
$pharInstallationLog = [];
chdir($extDir);
if(@file_exists($extDir)){
if(!@file_exists("composer.phar")){
copy("https://getcomposer.org/installer", "composer-setup.php");
if(hash_file("sha384", "composer-setup.php") == $composerSettings -> hashed_file_key){
exec("php composer-setup.php", $pharInstallationLog);
unlink("composer-setup.php");
if(@file_exists("composer.phar"))
$pharCreation = "Installed.";
}else{
$pharCreation = "Corrupted";
unlink("composer-setup.php");
}
}
$output = [];
$returnCode = -VAL_INT_1;
exec("php composer.phar {$this -> decodedPayload -> cstring} 2>&1", $output, $returnCode);
$commandOutput = [
"pharOut" => $pharCreation,
"pharInstallationLog" => $pharInstallationLog,
"code" => $returnCode,
"output" => $output
];
echo json_encode($commandOutput);
}
}
public function listen(){
switch($this -> decodedPayload -> purpose){
case "authentication":{
......@@ -312,6 +357,10 @@ class DevTools extends DevComponents {
$this -> settingsPurpose();
break;
}
case "composer":{
$this -> composing();
break;
}
default:{
echo json_encode([
"code" => "W01",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment