コード例 #1
0
ファイル: server.php プロジェクト: kyroskoh/rokket
 public function create($array)
 {
     $id = $this->id;
     $SSH = rp::get('SSH');
     $host = $SSH['ip'];
     $user = $SSH['user'];
     $pass = $SSH['password'];
     unset($SSH);
     $sftp = new sftp($host, $user, $pass);
     $sftp->makedir((string) $id);
     $sftp->chdir((string) $id);
     $control = games::replaceControl($this->sql->get('gameID'), $array);
     $this->createControl($control);
     $dir = dir::backup("control/{$id}/");
     $sftp->put('control.sh', $dir . 'control.sh', NET_SFTP_LOCAL_FILE);
     $sftp->chmod(0777, 'control.sh');
     $sftp->makedir("functions");
     $sftp->chdir("functions");
     $functions = ['fn_install', 'fn_install_complete', 'fn_install_config'];
     foreach ($functions as $file) {
         $path = dir::functions('control/' . $file);
         $sftp->put($file, $path, NET_SFTP_LOCAL_FILE);
         $sftp->chmod(0777, $file);
     }
     return true;
 }