Browse Source

refactor parent class

feature/refactor-php
prabuddha 9 years ago
parent
commit
4d02beda52
  1. 20
      php/Stack/apt.php
  2. 20
      php/Stack/package_manager.php

20
php/Stack/apt.php

@ -12,29 +12,13 @@ class APT extends PKG_MANAGER {
function __construct($data=array())
{
parent::__construct($this->stack_os_scope);
$this->pkg = $data;
print_r($this->pkg); //debugging purpose only
//print_r($this->pkg); //debugging purpose only
}
public function validate_stack_type($stacktype){
$os_type = EE_CLI\Utils\get_OS();
$flag = false;
foreach ($this->stack_os_scope as $value) {
if ($value == trim($os_type['DISTRIB_ID'])) {
$flag = true;
print_r($os_type['DISTRIB_ID']);
return $flag;
}
}
if (!$flag) die("Configuration doesnot match with system status \n");
}
public function install() {
$process = EE_CLI\Process::create( "sudo apt-get install {$this->pkg['package_name']}" );

20
php/Stack/package_manager.php

@ -12,7 +12,25 @@ abstract class PKG_MANAGER {
protected $stack_os_scope ;
public function __construct() {}
function __construct($stack=array()) {
$this->stack_os_scope = $stack;
}
function validate_stack_type($stacktype){
$os_type = EE_CLI\Utils\get_OS();
$flag = false;
foreach ($this->stack_os_scope as $value) {
if ($value == trim($os_type['DISTRIB_ID'])) {
$flag = true;
print_r($os_type['DISTRIB_ID']);
return $flag;
}
}
if (!$flag) die("Configuration does not match with system status \n");
}
}

Loading…
Cancel
Save