arrPlugin = $arrPlugin; } function execInstall() { GC_Utils_Ex::gfPrintLog("start install"); $plugin_code = $this->arrPlugin['plugin_code']; $objQuery =& SC_Query::getSingletonInstance(); $objQuery->begin(); // テーブル作成SQLなどを実行 $arrSql = $this->arrInstallData[$plugin_code]['sql']; foreach ($arrSql as $sql) { GC_Utils_Ex::gfPrintLog("exec sql:" . $sql['sql']); $objQuery->query($sql['sql'], $sql['params']); } // プラグインのディレクトリコピー $arrCopyDirectories = $this->arrInstallData[$plugin_code]['copy_directory']; foreach ($arrCopyDirectories as $directory) { GC_Utils_Ex::gfPrintLog("exec dir copy:" . $directory['src']); // ディレクトリコピー -> HTML配下とDATA配下を別関数にする SC_Utils::copyDirectory( PLUGIN_UPLOAD_REALDIR . $plugin_code . DIRECTORY_SEPARATOR . $directory['src'], PLUGIN_HTML_REALDIR . $plugin_code . DIRECTORY_SEPARATOR . $directory['dist']); } // プラグインのファイルコピー $arrCopyFiles = $this->arrInstallData[$plugin_code]['copy_file']; foreach ($arrCopyFiles as $file) { GC_Utils_Ex::gfPrintLog("exec file copy:" . $file['src']); // ファイルコピー copy(PLUGIN_UPLOAD_REALDIR . $plugin_code . DIRECTORY_SEPARATOR . $file['src'], PLUGIN_HTML_REALDIR . $plugin_code . DIRECTORY_SEPARATOR . $file['dist']); } $objQuery->commit(); GC_Utils_Ex::gfPrintLog("end install"); } function copyFile($src, $dist) { $plugin_code = $this->arrPlugin['plugin_code']; $this->arrInstallData[$plugin_code]['copy_file'] = array( 'src' => $src, 'dist' => $dist ); } function copyDirectory($src, $dist) { $plugin_code = $this->arrPlugin['plugin_code']; $this->arrInstallData[$plugin_code]['copy_directory'] = array( 'src' => $src, 'dist' => $dist ); } function removeFile($dist) { } public function sql($sql, array $params = array()) { $plugin_code = $this->arrPlugin['plugin_code']; $this->arrInstallData[$plugin_code]['sql'] = array( 'sql' => $sql, 'params' => $params ); } }