Skip to content

Commit 145d12c

Browse files
committed
2 parents 816ebd1 + 8ece33a commit 145d12c

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

modules/installer/controller/setup.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ private function step1()
110110
$upload = $this->getUploads()->allocate('banner');
111111
$config = $this->loadCurrentConfig();
112112
$this->parseUploads();
113-
$config['app'] = array_merge($config['app'], $_POST['settings']);
114113
if($upload->isSuccess())
115114
{
116115
if($upload->move())
@@ -126,6 +125,7 @@ private function step1()
126125
$config['app']['name'] = $_POST['site_name'];
127126
$config['app']['debug'] = $_POST['debug']?true:false;
128127
$config['app']['ssl'] = $_POST['ssl']?true:false;
128+
$config['app'] = array_merge($config['app'], $_POST['settings']);
129129
if($this->saveConfig($config))
130130
{
131131
return true;
@@ -147,6 +147,7 @@ private function step2()
147147
$config['database']['username'] = $_POST['username'];
148148
$config['database']['password'] = $_POST['password'];
149149
$config['database']['database'] = $_POST['database'];
150+
$config['database']['port'] = $_POST['port'];
150151
try
151152
{
152153
if($this->getDb()->isSelected())
@@ -386,4 +387,4 @@ public function getInstallers()
386387
}
387388
return $result;
388389
}
389-
}
390+
}

modules/installer/view/steps/2.twig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,17 @@
2727
</div>
2828
</div>
2929
<div class="form-group">
30-
<label class="control-label col-lg-4">Dase de datos</label>
30+
<label class="control-label col-lg-4">Dase de datos</label>
3131
<div class="col-lg-8">
3232
<input class="form-control" name="database" value="{{ _POST.database | default(mainconfig.database.database ) }}">
3333
</div>
3434
</div>
35+
<div class="form-group">
36+
<label class="control-label col-lg-4">Puerto</label>
37+
<div class="col-lg-8">
38+
<input class="form-control" name="port" value="{{ _POST.port | default(mainconfig.database.port ) }}" placeholder="(Opcional)">
39+
</div>
40+
</div>
3541
<div class="form-group">
3642
<div class="col-lg-8 col-lg-offset-4">
3743
<input type="submit" class="btn btn-success" name="save" value="Siguiente Paso">
@@ -66,4 +72,4 @@
6672
GRANT ALL ON &lt;databasename&gt;.* TO '&lt;username&gt;'@'localhost' IDENTIFIED BY '&lt;password&gt;';</pre>
6773
</p>
6874
</div>
69-
</div>
75+
</div>

src/Database/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ abstract class Connection
4141
* @param $password
4242
* @return mixed
4343
*/
44-
abstract public function connect($hostname, $username, $password);
44+
abstract public function connect($hostname, $username, $password, $port = null);
4545

4646
/**
4747
* TODO

src/Database/MySQLConnection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ class MySQLConnection extends Connection
5959
* @param $password
6060
* @return bool
6161
*/
62-
public function connect($hostname, $username, $password)
62+
public function connect($hostname, $username, $password, $port = null)
6363
{
6464
try {
65-
$this->pdo = new \PDO('mysql:host=' . $hostname . ';', $username, $password);
65+
$this->pdo = new \PDO('mysql:host=' . $hostname . ';' . ($port>0?"port=" . $port . ";":""), $username, $password);
6666
$result = Events::dispatch('onPDOCreated', array(&$this->pdo));
6767
if (intval($this->pdo->errorCode()) === 0) {
6868
$this->pdo->exec('SET NAMES utf8');

src/DatabaseManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ public function connect()
155155
$host = $config['database']['hostname'];
156156
$user = $config['database']['username'];
157157
$pass = $config['database']['password'];
158-
if ($conn->connect($host, $user, $pass)) {
158+
$port = $config['database']['port'];
159+
if ($conn->connect($host, $user, $pass, $port)) {
159160
$this->connection = $conn;
160161
$this->createCache();
161162
return true;

0 commit comments

Comments
 (0)