コード例 #1
0
ファイル: Config.php プロジェクト: VonUniGE/consh
 public function run($args)
 {
     $cli = new CLImate();
     if (file_exists(CONSH_CONFIG_FILE)) {
         $input = $cli->confirm('It looks like there is a consh config file already. Do you want to reconfigure consh and overwrite the existing file?');
         if (!$input->confirmed()) {
             $cli->output('Canceled');
             return;
         }
     }
     $cli->output("Please provide the following information");
     $input = $cli->input("Remote host (ie: site.domain.com):");
     $host = $input->prompt();
     $input = $cli->input("Remote user:"******"Remote home folder [/home/{$user}/]");
     $input->defaultTo("/home/{$user}/");
     $remote_home = $input->prompt();
     $input = $cli->input("Remote document root (relative to home folder) [public_html/]");
     $input->defaultTo("public_html/");
     $doc_root = $input->prompt();
     $cli->output("SSH Connection Information");
     $input = $cli->input("SSH Public Key File [~/.ssh/id_rsa.pub]");
     $input->defaultTo("~/.ssh/id_rsa.pub");
     $pub_key = $input->prompt();
     $input = $cli->input("SSH Private Key File [~/.ssh/id_rsa]");
     $input->defaultTo("~/.ssh/id_rsa");
     $priv_key = $input->prompt();
     $input = $cli->input("SSH Port [22]");
     $input->defaultTo(22);
     $port = $input->prompt();
     $cli->output("Remote MySQL Connection Details");
     $input = $cli->input("Remote MySQL host [localhost]");
     $input->defaultTo("localhost");
     $mysql_host = $input->prompt();
     $input = $cli->input("Remote MySQL user [{$user}]");
     $input->defaultTo($user);
     $mysql_user = $input->prompt();
     $input = $cli->input("Remote MySQL password");
     $mysql_pass = $input->prompt();
     $input = $cli->input("Remote MySQL database [{$user}]");
     $input->defaultTo($user);
     $mysql_db = $input->prompt();
     $input = $cli->input("Local MySQL host [localhost]");
     $input->defaultTo('localhost');
     $local_mysql_host = $input->prompt();
     $input = $cli->input('Local MySQL user [root]');
     $input->defaultTo('root');
     $local_mysql_user = $input->prompt();
     $input = $cli->input('Local MySQL password []');
     $local_mysql_pass = $input->prompt();
     $input = $cli->input("Local MySQL database [{$user}]");
     $input->defaultTo($user);
     $local_mysql_db = $input->prompt();
     $home = getenv("HOME");
     $pub_key = str_replace("~", $home, $pub_key);
     $priv_key = str_replace("~", $home, $priv_key);
     $config = array('remote' => array('host' => $host, 'user' => $user, 'home' => $remote_home, 'doc_root' => $doc_root), 'ssh' => array('pub_key' => $pub_key, 'priv_key' => $priv_key, 'port' => $port), 'mysql' => array('host' => $mysql_host, 'user' => $mysql_user, 'pass' => $mysql_pass, 'db' => $mysql_db), 'local-mysql' => array('user' => $local_mysql_user, 'host' => $local_mysql_host, 'pass' => $local_mysql_pass, 'db' => $local_mysql_db), 'rsync' => array('excludes' => array('cache/', 'thumbnails/')), 'consh' => array('db_backup_folder' => CONSH_CONFIG_FOLDER . '/db_backup'));
     Setting::createSettings($config);
 }
コード例 #2
0
ファイル: CsvBench.php プロジェクト: nyamsprod/csv-benchmarks
 /**
  * runs all the benchmarks tests
  */
 public function __invoke()
 {
     $nb_tests = count($this->collection) * 2 - 1;
     $this->terminal->output("<green>CSV Benchmark</green>");
     $this->terminal->output("Runtime: <yellow>" . PHP_VERSION . "</yellow>");
     $this->terminal->output("Host: <yellow>" . php_uname() . "</yellow>");
     $this->terminal->output("Packages tested: <yellow>" . count($this->collection) . "</yellow>");
     $this->terminal->output("Rows to be inserted/read: <yellow>{$this->nbrows}</yellow>");
     $this->terminal->output("Cells to be inserted/read: <yellow>" . $this->nbrows * $this->nbcells . "</yellow>");
     $this->terminal->output("CSV document output: <yellow>{$this->path}</yellow>");
     $this->terminal->output("Test Iteration: <yellow>" . $this->iteration . "</yellow>");
     $tests = new CallbackFilterIterator($this->collection->getIterator(), function (Driver $driver) {
         return $this->packages->has($driver->getName());
     });
     foreach ($tests as $driver) {
         $driver->setRowCount($this->nbrows);
         $driver->setCellCount($this->nbcells);
         $driver->setPath($this->path);
         $driver->setIterationCount($this->iteration);
         $package = $driver->getName();
         $this->results[$package] = $driver();
     }
     $this->cliOutput();
 }
コード例 #3
0
ファイル: Backup.php プロジェクト: VonUniGE/consh
 public function help()
 {
     $cli = new CLImate();
     $cli->output("creates a backup of the remote database stored on the local system");
 }
コード例 #4
0
ファイル: Pull.php プロジェクト: VonUniGE/consh
 public function help()
 {
     $cli = new CLImate();
     $cli->output("pull down a copy of the remote database and import it into the local database");
 }
コード例 #5
0
ファイル: Debug.php プロジェクト: VonUniGE/consh
 public function help()
 {
     $cli = new CLImate();
     $cli->output("Whatever stuff I'm currently debugging");
 }