ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Opened 12 years ago

Closed 12 years ago

#3624 closed enhancement (fixed)

openpne:install タスクでポート番号を指定できるようにする

Reported by: ebihara Owned by: Yuki Kaoru
Priority: minor Milestone: OpenPNE3.0.2
Component: core Version: 3.0.x
Keywords: Cc:

Description

openpne:install タスクでポート番号を指定できるようにする。

[openpne-dev:461] にて Yuki Kaoru さんから提供していただいたパッチを取り込む。

http://groups.google.co.jp/group/openpne-dev/browse_thread/thread/a9eda12213ef378c/11832235591374cc

Index: lib/task/openpneInstallTask.class.php
===================================================================
--- lib/task/openpneInstallTask.class.php	(リビジョン 10734)
+++ lib/task/openpneInstallTask.class.php	(作業コピー)
       !($hostname = $this->ask('Type database hostname'))
     );
 
+    $port = $this->ask('Type database port number (optional)');
+
     while (
       !($dbname = $this->ask('Type database name'))
     );
 
     $sock = '';
-    if ($dbms == 'mysql' && $hostname == 'localhost') {
+    if ($dbms == 'mysql' && ($hostname == 'localhost' || $hostname == '127.0.0.1')) {
       $sock = $this->ask('Type database socket path (optional)');
     }
 
@@ -57,26 +59,27 @@
     }
 
     $this->log($this->formatList(array(
-      'The DBMS             ' => $dbms,
-      'The Database Username' => $username,
-      'The Database Password' => $maskedPassword,
-      'The Database Hostname' => $hostname,
-      'The Database Name    ' => $dbname,
-      'The Database Socket  ' => $sock,
+      'The DBMS                 ' => $dbms,
+      'The Database Username    ' => $username,
+      'The Database Password    ' => $maskedPassword,
+      'The Database Hostname    ' => $hostname,
+      'The Database Port number ' => $port,
+      'The Database Name        ' => $dbname,
+      'The Database Socket      ' => $sock,
     )));
 
     if ($this->askConfirmation('Is it OK to start this task? (y/n)'))
     {
       @$this->fixPerms();
       @$this->clearCache();
-      $this->configureDatabase($dbms, $username, $password, $hostname, $dbname, $sock);
+      $this->configureDatabase($dbms, $username, $password, $hostname, $port, $dbname, $sock);
       $this->buildDb();
       $this->publishAssets();
       $this->clearCache();
     }
   }
 
-  protected function createDSN($dbms, $hostname, $dbname, $sock)
+  protected function createDSN($dbms, $hostname, $port, $dbname, $sock)
   {
     $result = $dbms.':';
 
@@ -92,6 +95,11 @@
       $data[] = 'hostname='.$hostname;
     }
 
+    if ($port)
+    {
+      $data[] = 'port='.$port;
+    }
+
     if ($sock)
     {
       $data[] = 'unix_socket='.$sock;
@@ -101,9 +109,9 @@
     return $result;
   }
 
-  protected function configureDatabase($dbms, $username, $password, $hostname, $dbname, $sock)
+  protected function configureDatabase($dbms, $username, $password, $hostname, $port, $dbname, $sock)
   {
-    $dsn = $this->createDSN($dbms, $hostname, $dbname, $sock);
+    $dsn = $this->createDSN($dbms, $hostname, $port, $dbname, $sock);
 
     $file = sfConfig::get('sf_config_dir').'/databases.yml';
     $config = array('dev' => array('propel' => array('param' => array(

Change History (5)

comment:1 Changed 12 years ago by ebihara

Owner: changed from nobody to ebihara
Status: newassigned

取り込みます

comment:2 Changed 12 years ago by ebihara

Resolution: fixed
Status: assignedclosed

r10735 で対応しました。パッチを作成していただいた Yuki Kaoru さん、ありがとうございました。

comment:3 Changed 12 years ago by ebihara

Resolution: fixed
Status: closedreopened

owner 変更のため reopen

comment:4 Changed 12 years ago by ebihara

Owner: changed from ebihara to Yuki Kaoru
Status: reopenednew

comment:5 Changed 12 years ago by ebihara

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.