From 1f2dde39636828635639a5f6efd12acfc620c3f9 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Thu, 9 Aug 2018 19:16:20 +0200 Subject: [PATCH] Removed default mysql port settings from files and left empty values (#403) --- config.php.sample | 4 ++-- docs/install.rst | 2 +- puphpet/files/exec-once/psminstall.sh | 2 +- src/psm/Module/Install/Controller/InstallController.php | 4 ++-- src/psm/Service/Database.php | 9 +++++---- src/templates/default/module/install/config_new.tpl.html | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/config.php.sample b/config.php.sample index a90981a3..31d490d7 100755 --- a/config.php.sample +++ b/config.php.sample @@ -4,5 +4,5 @@ define('PSM_DB_USER', 'db_user'); define('PSM_DB_PASS', 'db_pass'); define('PSM_DB_NAME', 'db_name'); define('PSM_DB_HOST', 'localhost'); -define('PSM_DB_PORT', '3306'); -define('PSM_BASE_URL', ''); +define('PSM_DB_PORT', '3306'); //3306 is the default port for MySQL. If no specfic port is used, leave it empty. +define('PSM_BASE_URL', ''); \ No newline at end of file diff --git a/docs/install.rst b/docs/install.rst index 04573d65..93898e36 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -27,7 +27,7 @@ To change these values correctly, only update the second parameter of the functi define('PSM_DB_NAME', 'db_name'); define('PSM_DB_USER', 'db_user'); define('PSM_DB_PASS', 'db_user_password'); - define('PSM_DB_PORT', '3306'); + define('PSM_DB_PORT', 'most likely 3306, may also be empty'); For example: to change your username you should ONLY change the 'db\_user' part. Do NOT remove the quotes around your username as that will result in an error. diff --git a/puphpet/files/exec-once/psminstall.sh b/puphpet/files/exec-once/psminstall.sh index b115800f..055e04d1 100644 --- a/puphpet/files/exec-once/psminstall.sh +++ b/puphpet/files/exec-once/psminstall.sh @@ -6,7 +6,7 @@ define('PSM_DB_USER', 'psm'); \ define('PSM_DB_PASS', 'psm'); \ define('PSM_DB_NAME', 'psm'); \ define('PSM_DB_HOST', 'localhost'); \ -define('PSM_DB_PORT', '3306'); \ +define('PSM_DB_PORT', ''); \ ?>" > /var/www/default/psm/config.php echo " 'localhost', - 'db_port' => '3306', + 'db_port' => '', 'db_name' => '', 'db_user' => '', 'db_pass' => '', @@ -315,7 +315,7 @@ class InstallController extends AbstractController { 'pass' => '', 'name' => '', 'host' => '', - 'port' => '3306' + 'port' => '' ); $pattern = "/define\('SM_{key}', '(.*?)'/u"; diff --git a/src/psm/Service/Database.php b/src/psm/Service/Database.php index 4aba875a..c75690df 100644 --- a/src/psm/Service/Database.php +++ b/src/psm/Service/Database.php @@ -37,9 +37,9 @@ class Database { /** * DB port - * @var string $db_port + * @var string|integer $db_port */ - protected $db_port = 3306; + protected $db_port; /** * DB name @@ -86,11 +86,12 @@ class Database { * @param string $user * @param string $pass * @param string $db + * @param string|integer $port */ - function __construct($host = null, $user = null, $pass = null, $db = null, $port = null) { + function __construct($host = null, $user = null, $pass = null, $db = null, $port = '') { if ($host != null && $user != null && $pass !== null && $db != null) { $this->db_host = $host; - $this->db_port = (!empty($port)) ? $port : 3306; + $this->db_port = $port; $this->db_name = $db; $this->db_user = $user; $this->db_pass = $pass; diff --git a/src/templates/default/module/install/config_new.tpl.html b/src/templates/default/module/install/config_new.tpl.html index c54bbe4c..347171e6 100644 --- a/src/templates/default/module/install/config_new.tpl.html +++ b/src/templates/default/module/install/config_new.tpl.html @@ -27,7 +27,7 @@
- +