From: Vincent Vanwaelscappel Date: Wed, 22 Nov 2023 11:42:38 +0000 (+0100) Subject: Merge branch 'backpack5' into serverExt X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=dd3dc2aa75209af6dd7e4268058c0ed84d3a6963;p=fluidbook-toolbox.git Merge branch 'backpack5' into serverExt # Conflicts: # app/Models/FluidbookCollection.php # app/Models/FluidbookPublication.php --- dd3dc2aa75209af6dd7e4268058c0ed84d3a6963 diff --cc app/Models/FluidbookExternalInstallServer.php index f395fc606,5a9e7614f..ee1ae3ade --- a/app/Models/FluidbookExternalInstallServer.php +++ b/app/Models/FluidbookExternalInstallServer.php @@@ -87,37 -83,9 +87,40 @@@ class FluidbookExternalInstallServer ex 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; + } + }