[Pkg-owncloud-commits] [owncloud] 34/107: Add unix_socket support for mysql during initial installation - fixes #20210
David Prévot
taffit at moszumanska.debian.org
Thu Dec 17 19:40:34 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit ac3c3231444bee7cf0ba3670cc85ff215a470f80
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date: Mon Dec 7 12:00:31 2015 +0100
Add unix_socket support for mysql during initial installation - fixes #20210
---
lib/private/setup/mysql.php | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/lib/private/setup/mysql.php b/lib/private/setup/mysql.php
index f2d2b15..e8b88eb 100644
--- a/lib/private/setup/mysql.php
+++ b/lib/private/setup/mysql.php
@@ -89,15 +89,28 @@ class MySQL extends AbstractDatabase {
* @throws \OC\DatabaseSetupException
*/
private function connect() {
- $type = 'mysql';
+
$connectionParams = array(
- 'host' => $this->dbHost,
- 'user' => $this->dbUser,
- 'password' => $this->dbPassword,
- 'tablePrefix' => $this->tablePrefix,
+ 'host' => $this->dbHost,
+ 'user' => $this->dbUser,
+ 'password' => $this->dbPassword,
+ 'tablePrefix' => $this->tablePrefix,
);
+
+ // adding port support
+ if (strpos($this->dbHost, ':')) {
+ // Host variable may carry a port or socket.
+ list($host, $portOrSocket) = explode(':', $this->dbHost, 2);
+ if (ctype_digit($portOrSocket)) {
+ $connectionParams['port'] = $portOrSocket;
+ } else {
+ $connectionParams['unix_socket'] = $portOrSocket;
+ }
+ $connectionParams['host'] = $host;
+ }
+
$cf = new ConnectionFactory();
- return $cf->getConnection($type, $connectionParams);
+ return $cf->getConnection('mysql', $connectionParams);
}
/**
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list