Ejemplo n.º 1
0
 public function read($silent)
 {
     if ($silent && !$this->requested["sshhost"]["valore-valido"] && !$this->requested["sshhost"]["valore-valido-default"]) {
         $this->exitWork("SSH host is not correct, specific a valid name.");
     }
     if ($silent && !$this->requested["sshhost"]["valore-valido"] && $this->requested["sshhost"]["valore-valido-default"]) {
         $this->requested["sshhost"]["valore"] = $this->requested["sshhost"]["valore-default"];
         $this->requested["sshhost"]["valore-valido"] = true;
     }
     $attemps = Config::get('workbench.attemps');
     $attemp = 0;
     if (!$silent && !$this->requested["sshhost"]["valore-valido"] && !$this->command->confirm('Do you want use ssh to ' . $this->requested["action"]["valore"] . ' virtualhost?')) {
         return false;
     }
     while (!$silent && (!$this->requested["sshhost"]["valore-valido"] || empty($this->requested["sshhost"]["valore"])) && $attemp < $attemps) {
         $this->command->error("This host '" . $this->requested["sshhost"]["valore"] . "' is not valid");
         $this->requested["sshhost"]["valore"] = $this->command->ask('SSH host IP', $this->requested["sshhost"]["valore-valido-default"] ? $this->requested["sshhost"]["valore-default"] : $this->requested["sshhost"]["valore"]);
         $this->requested["sshhost"]["valore-valido"] = Sshhost::isValidValue($this->requested["sshhost"]["valore"]);
         $attemp++;
         if ($attemp == $attemps) {
             return $this->command->error("Exit for invalid host");
         }
     }
     $this->command->getWorkbenchSettings()->setRequested($this->requested);
     return $this->requested["sshhost"]["valore-valido"];
 }
Ejemplo n.º 2
0
 private function readParameters($option, $argument)
 {
     $silent = $option["silent"];
     $filehost = $option["filehosts"];
     $this->validate($argument, $option);
     $domain = new Parameters\Domain($this);
     $domain->read($silent);
     $action = new Parameters\Action($this);
     $action->read($silent);
     $type = new Parameters\Type($this);
     $type->read($silent);
     if ($this->workbenchSettings->requested["action"]["valore"] == "delete" && substr($this->workbenchSettings->requested["type"]['valore'], -7) == 'package') {
         $this->info("No action for delete a package");
         exit;
     }
     if (substr($this->workbenchSettings->requested["type"]['valore'], -7) != 'package') {
         $sshhost = new Parameters\Sshhost($this);
         if ($sshhost->read($silent)) {
             $sshuser = new Parameters\Sshuser($this);
             $sshuser->read($silent);
             $sshpassword = new Parameters\Sshpassword($this);
             $sshpassword->read($silent);
         }
     }
     if ($this->workbenchSettings->requested["action"]["valore"] == "delete") {
         $this->error("Attention the virtual host file of " . $this->workbenchSettings->requested["domain"]["valore"] . " will be deleted.");
         if (!$silent) {
             $this->confirm("Delete the virtual host file of " . $this->workbenchSettings->requested["domain"]["valore"] . "?");
         }
         $this->deleteVirtualHost($option["filehosts"]);
         //ToDo
         $this->info("Deleted complete");
         exit;
     }
     $organization = new Parameters\Organization($this);
     $organization->read($silent);
     $dirtype = new Parameters\Dirtype($this);
     $dirtype->read($silent);
     $git = new Parameters\Git($this);
     if ($git->read($silent)) {
         //$gitaction = new Parameters\Gitaction($this);
         //$gitaction->read($silent);
         $user = new Parameters\User($this);
         $user->read($silent);
         $password = new Parameters\Password($this);
         $password->read($silent);
         $email = new Parameters\Email($this);
         $email->read($silent);
         $githookenable = new Parameters\Githookenable($this);
         $githookenable->read($silent);
         //$organization = new Parameters\Organization($this);
         //$organization->read($silent);
     }
     $packagename = new Parameters\Packagename($this);
     $packagename->read($silent);
     $packagedescr = new Parameters\Packagedescr($this);
     $packagedescr->read($silent);
     $packagekeywords = new Parameters\Packagekeywords($this);
     $packagekeywords->read($silent);
     $this->info("Parameters read");
     return true;
 }