Changeset 22673
- Timestamp:
- 2013/03/10 02:16:05 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/camp/camp-2_13-plugin/data/class/plugin/SC_Plugin_Installer.php
r22665 r22673 23 23 class SC_Plugin_Installer { 24 24 25 protected $exec_func; 26 25 27 protected $plugin_code; 26 28 … … 29 31 protected $arrInstallData; 30 32 31 public function __construct($arrPlugin) { 33 public function __construct($exec_func, $arrPlugin) { 34 define('PLUGIN_LOG_REALFILE', DATA_REALDIR . "logs/plugin.log"); 35 $this->exec_func = $exec_func; 36 $this->plugin_code = $arrPlugin['plugin_code']; 32 37 $this->arrPlugin = $arrPlugin; 33 38 $this->arrInstallData = array(); … … 45 50 46 51 $objQuery =& SC_Query::getSingletonInstance(); 47 $objQuery->begin();48 52 49 53 // テーブル作成SQLなどを実行 … … 76 80 } 77 81 78 $objQuery->commit();79 82 GC_Utils_Ex::gfPrintLog("end install: " . $this->arrPlugin['plugin_code']); 80 83 } 81 84 85 public function execPlugin($exec_func) { 86 $this->log("start"); 87 88 $plugin_code = $this->arrPlugin['plugin_code']; 89 90 $objQuery =& SC_Query::getSingletonInstance(); 91 92 // テーブル作成SQLなどを実行 93 $arrSql = $this->arrInstallData['sql']; 94 95 foreach ($arrSql as $sql) { 96 $this->log("exec sql: " . $sql['sql']); 97 $objQuery->query($sql['sql'], $sql['params']); 98 } 99 100 // プラグインのディレクトリコピー 101 $arrCopyDirectories = $this->arrInstallData['copy_directory']; 102 103 foreach ($arrCopyDirectories as $directory) { 104 $this->log("exec dir copy: " . $directory['src'] . ' -> ' . $directory['dist']); 105 // ディレクトリコピー -> HTML配下とDATA配下を別関数にする 106 SC_Utils::copyDirectory( 107 PLUGIN_UPLOAD_REALDIR . $plugin_code . DIRECTORY_SEPARATOR . $directory['src'], 108 PLUGIN_HTML_REALDIR . $plugin_code . DIRECTORY_SEPARATOR . $directory['dist']); 109 } 110 111 // プラグインのファイルコピー 112 $arrCopyFiles = $this->arrInstallData['copy_file']; 113 114 foreach ($arrCopyFiles as $file) { 115 $this->log("exec file copy: " . $file['src'] . ' -> ' . $file['dist']); 116 // ファイルコピー 117 copy(PLUGIN_UPLOAD_REALDIR . $plugin_code . DIRECTORY_SEPARATOR . $file['src'], 118 PLUGIN_HTML_REALDIR . $plugin_code . DIRECTORY_SEPARATOR . $file['dist']); 119 } 120 121 $this->log("end"); 122 } 123 82 124 public function copyFile($src, $dist) { 83 125 $this->arrInstallData['copy_file'][] = array( … … 116 158 $this->sql($sql, $params); 117 159 } 160 161 protected function log($msg) { 162 $msg = sprintf("%s %s: %s", $this->exec_func, $this->plugin_code, $msg); 163 GC_Utils::gfPrintLog($msg, PLUGIN_LOG_REALFILE); 164 } 118 165 }
Note: See TracChangeset
for help on using the changeset viewer.