From 617adeea6f45d2f3ed5f8578f5af3e99ca4e8c84 Mon Sep 17 00:00:00 2001 From: TacticalFreak Date: Sun, 2 May 2021 14:08:23 +0200 Subject: [PATCH 1/3] Support for mysql unix socket This will add support for connecting with a unix socket path to the mysql database. Users will need to set their `PSM_DB_HOST` the unix socket path starting with an ":" symbol, like so `:/home/xxxxxx/var/run/mysql.sock` I stole this way idea of using the database host to store the unix socket path from Nextcloud. They do the same. Related: https://github.com/phpservermon/phpservermon/issues/1118 --- src/psm/Service/Database.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/psm/Service/Database.php b/src/psm/Service/Database.php index 5d69dd55..c839c24e 100644 --- a/src/psm/Service/Database.php +++ b/src/psm/Service/Database.php @@ -533,16 +533,29 @@ class Database */ protected function connect() { + $isHostUnixSocket = strpos($this->db_host, ':') === 0; + // Initizale connection try { - $this->pdo = new \PDO( - 'mysql:host=' . $this->db_host . - ';port=' . $this->db_port . - ';dbname=' . $this->db_name . - ';charset=utf8', - $this->db_user, - $this->db_pass - ); + if ($isHostUnixSocket) { + $this->pdo = new \PDO( + 'mysql:unix_socket=' . ltrim($this->db_host, ':') . + ';dbname=' . $this->db_name . + ';charset=utf8', + $this->db_user, + $this->db_pass + ); + } else { + $this->pdo = new \PDO( + 'mysql:host=' . $this->db_host . + ';port=' . $this->db_port . + ';dbname=' . $this->db_name . + ';charset=utf8', + $this->db_user, + $this->db_pass + ); + } + $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $this->status = true; } catch (\PDOException $e) { From 4693ff3910074df10bc16178a74da9ca3c4de081 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Mar 2022 19:00:44 +0000 Subject: [PATCH 2/3] Bump viharm/psm-ldap-auth from 1.1.3 to 1.1.4 Bumps [viharm/psm-ldap-auth](https://gitlab.com/viharm/PsmLDAPauth) from 1.1.3 to 1.1.4. - [Release notes](https://gitlab.com/viharm/PsmLDAPauth/tags) - [Commits](https://gitlab.com/viharm/PsmLDAPauth/compare/v1.1.3...v1.1.4) --- updated-dependencies: - dependency-name: viharm/psm-ldap-auth dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 59 ++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/composer.lock b/composer.lock index 990ffd04..0ac4f53c 100644 --- a/composer.lock +++ b/composer.lock @@ -86,20 +86,20 @@ }, { "name": "mnsami/composer-custom-directory-installer", - "version": "1.1.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/mnsami/composer-custom-directory-installer.git", - "reference": "8cc82e0c5801cc3bf53ba452afdcaa5c6ff645a5" + "reference": "85f66323978d0b1cb0e6acc7f69b3e7b912f82d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mnsami/composer-custom-directory-installer/zipball/8cc82e0c5801cc3bf53ba452afdcaa5c6ff645a5", - "reference": "8cc82e0c5801cc3bf53ba452afdcaa5c6ff645a5", + "url": "https://api.github.com/repos/mnsami/composer-custom-directory-installer/zipball/85f66323978d0b1cb0e6acc7f69b3e7b912f82d9", + "reference": "85f66323978d0b1cb0e6acc7f69b3e7b912f82d9", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0", + "composer-plugin-api": "^1.0 || ^2.0", "php": ">=5.3" }, "type": "composer-plugin", @@ -136,9 +136,9 @@ ], "support": { "issues": "https://github.com/mnsami/composer-custom-directory-installer/issues", - "source": "https://github.com/mnsami/composer-custom-directory-installer/tree/master" + "source": "https://github.com/mnsami/composer-custom-directory-installer/tree/2.0.0" }, - "time": "2016-05-25T08:26:02+00:00" + "time": "2020-08-18T11:00:11+00:00" }, { "name": "paragonie/random_compat", @@ -1023,20 +1023,20 @@ }, { "name": "viharm/php-db-auth", - "version": "v2.7.0", + "version": "v2.7.1", "source": { "type": "git", "url": "https://bitbucket.org/viharm/phpdbauth.git", - "reference": "60c1b0a28d26178d5e4960d49185af85734643c6" + "reference": "27ea793aae007d0d222650311f2af9a1f88865b3" }, "dist": { "type": "zip", - "url": "https://bitbucket.org/viharm/phpdbauth/get/60c1b0a28d26178d5e4960d49185af85734643c6.zip", - "reference": "60c1b0a28d26178d5e4960d49185af85734643c6", + "url": "https://bitbucket.org/viharm/phpdbauth/get/27ea793aae007d0d222650311f2af9a1f88865b3.zip", + "reference": "27ea793aae007d0d222650311f2af9a1f88865b3", "shasum": "" }, "require": { - "mnsami/composer-custom-directory-installer": "1.1.*", + "mnsami/composer-custom-directory-installer": "^2.0.0", "php": ">=5.3.0", "viharm/php-khelper": "^1.4.1" }, @@ -1069,9 +1069,9 @@ ], "support": { "issues": "https://bitbucket.org/viharm/phpdbauth/issues", - "source": "https://bitbucket.org/viharm/phpdbauth/src/60c1b0a28d26178d5e4960d49185af85734643c6/?at=master" + "source": "https://bitbucket.org/viharm/phpdbauth/src/27ea793aae007d0d222650311f2af9a1f88865b3/?at=v2.7.1" }, - "time": "2020-01-05T11:48:12+00:00" + "time": "2022-03-13T23:01:02+00:00" }, { "name": "viharm/php-khelper", @@ -1114,20 +1114,20 @@ }, { "name": "viharm/php-ldap-auth", - "version": "v2.5.1", + "version": "v2.5.2", "source": { "type": "git", "url": "https://bitbucket.org/viharm/phpldapauth.git", - "reference": "3a60e626bfb63eda786dad30f09bd75fd5172cb1" + "reference": "260c158ebbd0ae5069dc30e2a840c8541ed2ad24" }, "dist": { "type": "zip", - "url": "https://bitbucket.org/viharm/phpldapauth/get/3a60e626bfb63eda786dad30f09bd75fd5172cb1.zip", - "reference": "3a60e626bfb63eda786dad30f09bd75fd5172cb1", + "url": "https://bitbucket.org/viharm/phpldapauth/get/260c158ebbd0ae5069dc30e2a840c8541ed2ad24.zip", + "reference": "260c158ebbd0ae5069dc30e2a840c8541ed2ad24", "shasum": "" }, "require": { - "mnsami/composer-custom-directory-installer": "1.1.*", + "mnsami/composer-custom-directory-installer": "^2.0.0", "php": ">=5.3.0", "viharm/php-khelper": "^1.4.1" }, @@ -1162,28 +1162,28 @@ ], "support": { "issues": "https://bitbucket.org/viharm/phpldapauth/issues", - "source": "https://bitbucket.org/viharm/phpldapauth/src/3a60e626bfb63eda786dad30f09bd75fd5172cb1/?at=v2.5.1" + "source": "https://bitbucket.org/viharm/phpldapauth/src/260c158ebbd0ae5069dc30e2a840c8541ed2ad24/?at=v2.5.2" }, - "time": "2020-11-24T21:56:47+00:00" + "time": "2022-03-13T23:14:26+00:00" }, { "name": "viharm/psm-ldap-auth", - "version": "v1.1.3", + "version": "v1.1.4", "source": { "type": "git", "url": "https://gitlab.com/viharm/PsmLDAPauth.git", - "reference": "1addeb0403a19e457f2c622a67156f52568da308" + "reference": "7c84d7ba6b23e9ea226be671f74f48fec62bed73" }, "dist": { "type": "zip", - "url": "https://gitlab.com/api/v4/projects/viharm%2FPsmLDAPauth/repository/archive.zip?sha=1addeb0403a19e457f2c622a67156f52568da308", - "reference": "1addeb0403a19e457f2c622a67156f52568da308", + "url": "https://gitlab.com/api/v4/projects/viharm%2FPsmLDAPauth/repository/archive.zip?sha=7c84d7ba6b23e9ea226be671f74f48fec62bed73", + "reference": "7c84d7ba6b23e9ea226be671f74f48fec62bed73", "shasum": "" }, "require": { "php": ">=5.3.0", "viharm/php-db-auth": "^2.6.0", - "viharm/php-ldap-auth": "^2.4.0" + "viharm/php-ldap-auth": "^2.5.1" }, "type": "library", "notification-url": "https://packagist.org/downloads/", @@ -1210,9 +1210,10 @@ "psm" ], "support": { - "issues": "https://gitlab.com/viharm/PsmLDAPauth/issues" + "issues": "https://gitlab.com/viharm/PsmLDAPauth/issues", + "source": "https://gitlab.com/viharm/PsmLDAPauth/-/tree/v1.1.4" }, - "time": "2020-11-24T22:57:57+00:00" + "time": "2022-03-13T19:46:17+00:00" } ], "packages-dev": [], @@ -1231,5 +1232,5 @@ "ext-xml": "*" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.2.0" } From 7f5b5878daade2a54c4c8258dd25defeb706c15b Mon Sep 17 00:00:00 2001 From: Germs2004 <5519340+Germs2004@users.noreply.github.com> Date: Sun, 27 Mar 2022 16:36:17 -0400 Subject: [PATCH 3/3] Clarify description of permission setting This setting only says it controls which users this server is visible to. But it also affects which users get notifications when this server's status changes. This pull request clarifies the setting's description so users will understand that it affects both visibility and notifications. --- src/lang/en_US.lang.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index 856fd14c..25adb2c6 100644 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -189,7 +189,7 @@ $sm_lang = array( 'website_password_description' => 'Password to access the site. The password is encrypted in the database.', 'fieldset_monitoring' => 'Monitoring', 'fieldset_permissions' => 'Permissions', - 'permissions' => 'Server will be visible for the following users', + 'permissions' => 'Users who can view and be notified about this server', 'port' => 'Port', 'custom_port' => 'Custom Port', 'popular_ports' => 'Popular Ports',