if ($this->getProtocol() === 'hosting') {
return new Local($this, '/mnt/hosting/');
}
+ if ($this->getProtocol() === 'ushosting') {
+ return new Local($this, '/application/usstorage/hosting/');
+ }
}
+ public static function verifyServerConnexion($id, $data = [])
+ {
+ $server = self::find($id);
+ $protocol = $data['protocol'] ?? $server->protocol;
+ $usr = $data['username'] ?? $server->username;
+ $pwd = $data['password'] ?? $server->password;
+ $host = $data['host'] ?? $server->host;
+
+ if($protocol !== "hosting") {
+ if(!$host) {
+ throw new \Exception('Host missing');
+ } else {
+ try {
+ $connection = ssh2_connect($host, 22);
+ } catch (\Exception $e) {
+
+ }
+ try {
+ self::$isValidConnexion = ssh2_auth_password($connection, $usr, $pwd);
+ } catch (\Exception $e) {
+
+ }
+ ssh2_disconnect($connection);
+ }
+ } else {
+ self::$isValidConnexion = file_exists("/mnt/hosting/status");
+ }
+
+ return self::$isValidConnexion;
+ }
+
}