Ignore:
Timestamp:
2013/08/26 15:52:37 (11 years ago)
Author:
m_uehara
Message:

#2348 r23116 - r23125 をマージ

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13_0/data/class/plugin/SC_Plugin_Installer.php

    r22990 r23126  
    2121 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
    2222 */ 
    23 class SC_Plugin_Installer { 
    24      
     23class SC_Plugin_Installer 
     24{ 
    2525    protected $exec_func; 
    26      
     26 
    2727    protected $plugin_code; 
    28      
     28 
    2929    protected $arrPlugin; 
    30      
     30 
    3131    protected $arrInstallData; 
    32      
    33     public function __construct($exec_func, $arrPlugin) { 
     32 
     33    public function __construct($exec_func, $arrPlugin) 
     34    { 
    3435        $this->exec_func   = $exec_func; 
    3536        $this->plugin_code = $arrPlugin['plugin_code']; 
     
    4546        $this->arrInstallData['remove_directory'] = array(); 
    4647    } 
    47      
    48     public function execPlugin() { 
     48 
     49    public function execPlugin() 
     50    { 
    4951        $this->log("start"); 
    50          
     52 
    5153        $plugin_code = $this->arrPlugin['plugin_code']; 
    5254 
     
    6567            } 
    6668        } 
    67          
     69 
    6870        if (count($arrErr) > 0) { 
    6971            return $arrErr; 
    7072        } 
    71          
     73 
    7274        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    73          
     75 
    7476        // SQLの実行 
    7577        foreach ($arrSql as $sql) { 
     
    7779            $objQuery->query($sql['sql'], $sql['params']); 
    7880        } 
    79          
     81 
    8082        $arrInsertQuery = $this->arrInstallData['insert']; 
    8183        foreach ($arrInsertQuery as $query) { 
     
    8991            ); 
    9092        } 
    91          
     93 
    9294        $arrUpdateQuery = $this->arrInstallData['update']; 
    9395        foreach ($arrUpdateQuery as $query) { 
     
    101103            ); 
    102104        } 
    103          
     105 
    104106        // プラグインのディレクトリコピー 
    105107        $arrCopyDirectories = $this->arrInstallData['copy_directory']; 
     
    122124                 PLUGIN_HTML_REALDIR   . $plugin_code . DIRECTORY_SEPARATOR . $file['dist']); 
    123125        } 
    124          
    125         $this->log("end");          
    126     } 
    127  
    128     public function copyFile($src, $dist) { 
     126 
     127        $this->log("end"); 
     128    } 
     129 
     130    public function copyFile($src, $dist) 
     131    { 
    129132        $this->arrInstallData['copy_file'][] = array( 
    130133            'src'  => $src, 
     
    132135        ); 
    133136    } 
    134   
    135     public function copyDirectory($src, $dist) { 
     137 
     138    public function copyDirectory($src, $dist) 
     139    { 
    136140        $this->arrInstallData['copy_directory'][] = array( 
    137141            'src'  => $src, 
    138142            'dist' => $dist 
    139         );         
    140     } 
    141      
    142     public function removeFile($dist) { 
     143        ); 
     144    } 
     145 
     146    public function removeFile($dist) 
     147    { 
    143148        $this->arrInstallData['remove_file'][] = array( 
    144149            'dist' => $dist 
    145150        ); 
    146151    } 
    147      
    148     public function removeDirectory($dist) { 
     152 
     153    public function removeDirectory($dist) 
     154    { 
    149155       $this->arrInstallData['remove_directory'][] = array( 
    150156            'dist' => $dist 
    151         );      
    152     } 
    153  
    154     public function sql($sql, array $params = array()) { 
     157        ); 
     158    } 
     159 
     160    public function sql($sql, array $params = array()) 
     161    { 
    155162        $this->arrInstallData['sql'][] = array( 
    156163            'sql'    => $sql, 
     
    158165        ); 
    159166    } 
    160      
    161     protected function log($msg) { 
     167 
     168    protected function log($msg) 
     169    { 
    162170        $msg = sprintf("%s %s: %s", $this->plugin_code, $this->exec_func, $msg); 
    163171        GC_Utils::gfPrintLog($msg, PLUGIN_LOG_REALFILE); 
    164172    } 
    165      
     173 
    166174    /** 
    167175     * カラム追加クエリの追加 
    168      *  
     176     * 
    169177     * @param type $table 
    170178     * @param type $col 
    171      * @param type $type  
     179     * @param type $type 
    172180     */ 
    173     function addColumn($table_name, $col_name, $col_type) { 
     181    public function addColumn($table_name, $col_name, $col_type) 
     182    { 
    174183        $sql = "ALTER TABLE $table_name ADD $col_name $col_type "; 
    175184        $this->sql($sql); 
    176185    } 
    177      
     186 
    178187    /** 
    179188     * カラム削除クエリの追加 
    180      *  
     189     * 
    181190     * @param type $table 
    182191     * @param type $col 
    183      * @param type $type  
     192     * @param type $type 
    184193     */ 
    185     function dropColumn($table_name, $col_name) { 
     194    public function dropColumn($table_name, $col_name) 
     195    { 
    186196        $sql = "ALTER TABLE $table_name DROP $col_name"; 
    187197        $this->sql($sql); 
    188198    } 
    189      
    190     function insert($table, $arrVal, $arrSql = array(), $arrSqlVal = array(), $from = '', $arrFromVal = array()) { 
     199 
     200    public function insert($table, $arrVal, $arrSql = array(), $arrSqlVal = array(), $from = '', $arrFromVal = array()) 
     201    { 
    191202        $this->arrInstallData['insert'][] = array( 
    192203            'table' => $table, 
    193             'arrVal' => $arrVal,  
    194             'arrSql' => $arrSql,  
    195             'arrSqlVal' => $arrSqlVal,  
     204            'arrVal' => $arrVal, 
     205            'arrSql' => $arrSql, 
     206            'arrSqlVal' => $arrSqlVal, 
    196207            'form' =>$from, 
    197208            'arrFromVal' => $arrFromVal 
    198209        ); 
    199210    } 
    200      
    201     function update($table, $arrVal, $where = '', $arrWhereVal = array(), $arrRawSql = array(), $arrRawSqlVal = array()) { 
     211 
     212    public function update($table, $arrVal, $where = '', $arrWhereVal = array(), $arrRawSql = array(), $arrRawSqlVal = array()) 
     213    { 
    202214        $this->arrInstallData['update'][] = array( 
    203215            'table' => $table, 
    204             'arrVal' => $arrVal,  
    205             'where' => $where,  
    206             'arrWhereVal' => $arrWhereVal,  
     216            'arrVal' => $arrVal, 
     217            'where' => $where, 
     218            'arrWhereVal' => $arrWhereVal, 
    207219            'arrRawSql' =>$arrRawSql, 
    208220            'arrRawSqlVal' => $arrRawSqlVal 
    209221        ); 
    210222    } 
    211      
     223 
    212224    /** 
    213      *  
     225     * 
    214226     * @param string $sql 
    215      * @param type $params 
     227     * @param type   $params 
    216228     */ 
    217     protected function verifySql($sql, $params) { 
     229    protected function verifySql($sql, $params) 
     230    { 
    218231        // FIXME $paramsのチェックも行いたい. 
    219232        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    220          
     233 
    221234        // force runを有効にし, システムエラーを回避する 
    222235        $objQuery->force_run = true; 
     
    228241            $error_message = $sth->message . ":" . $sth->userinfo; 
    229242            $objQuery->force_run = false; 
     243 
    230244            return $error_message; 
    231245        } 
    232          
     246 
    233247        $sth->free(); 
    234248        // force_runをもとに戻す. 
    235249        $objQuery->force_run = false; 
    236          
     250 
    237251        return $error_message; 
    238252    } 
Note: See TracChangeset for help on using the changeset viewer.