function update(array $arrPlugin, SC_Plugin_Installer $installer)
 {
     $base_dir = dirname(__FILE__);
     GC_Utils_Ex::gfPrintLog("[" . $arrPlugin["plugin_code"] . "]更新処理を実行します。", PLUGIN_LOG_REALFILE, FALSE);
     $log = "";
     $xdir = PLUGIN_UPLOAD_REALDIR . $arrPlugin["plugin_code"];
     if (!is_dir($xdir . "_" . date("Ymd") . "/")) {
         rename($xdir . "/", $xdir . "_" . date("Ymd") . "/");
     }
     SC_Helper_FileManager_Ex::deleteFile($xdir . "/", false);
     $log .= SC_Utils_Ex::sfCopyDir("{$base_dir}/", PLUGIN_UPLOAD_REALDIR . $arrPlugin["plugin_code"] . "/", '', true);
     // logo コピー
     $installer->copyDirectory("copy/plugin_dir/", "");
     GC_Utils_Ex::gfPrintLog($log, PLUGIN_LOG_REALFILE, false);
     $core = new SupportDeviceCore($arrPlugin);
     $plugin_version = $arrPlugin["plugin_version"];
     switch ($plugin_version) {
         case "0.0.0":
         case "0.0.1":
             // 再インストール
             $core->install($arrPlugin, $installer);
             $core->update($arrPlugin, $installer, "0.0.0");
             break;
         default:
             $core->update($arrPlugin, $installer, $plugin_version);
             break;
     }
     $core->createCash();
     $objQuery = SC_Query_Ex::getSingletonInstance();
     $objQuery->begin();
     GC_Utils_Ex::gfPrintLog("[" . $arrPlugin["plugin_code"] . "]更新処理を実行完了しました。", PLUGIN_LOG_REALFILE, FALSE);
 }
 function install(array $arrPlugin, SC_Plugin_Installer $installer)
 {
     $plugin_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
     $upload_plugin_dir = PLUGIN_UPLOAD_REALDIR . $arrPlugin["plugin_code"] . DIRECTORY_SEPARATOR;
     $backup_plugin_dir = PLUGIN_UPLOAD_REALDIR . $arrPlugin["plugin_code"] . "_" . date("Ymd") . DIRECTORY_SEPARATOR;
     if (!is_dir($backup_plugin_dir)) {
         SC_Utils_Ex::sfCopyDir($upload_plugin_dir, $backup_plugin_dir);
     }
     SC_Helper_FileManager_Ex::deleteFile($upload_plugin_dir, false);
     SC_Utils_Ex::sfCopyDir($plugin_dir . "/", $upload_plugin_dir);
     SC_Utils_Ex::sfCopyDir($plugin_dir . "/copy/Smarty/templates/admin/", TEMPLATE_ADMIN_REALDIR);
     SC_Utils_Ex::sfCopyDir($plugin_dir . "/copy/modules/", DATA_REALDIR . "module/");
     // logo コピー
     $installer->copyDirectory("copy/plugin_dir/", "");
     $table = "dtb_products";
     $fields = array('auto_display_status' => $this->intColumn('自動公開'), 'auto_display_start_date' => $this->timestampColumn('公開開始日'), 'auto_display_end_date' => $this->timestampColumn('公開終了日'));
     $type = "timestamp";
     $definition = compact("type");
     foreach ($fields as $name => $define) {
         $this->objDb->sfColumnExists($table, $name, $define["type"], "", true);
         $this->fieldComment($installer, $table, $name, $define["comment"]);
         switch ($define["type"]) {
             case "timestamp":
                 break;
             default:
                 continue;
         }
         $change = array();
         $change[$name] = compact('definition');
         $this->objManager->alterTable($table, compact("change"), false);
     }
     $this->objQuery->update("dtb_products", array(), "auto_display_start_date IS NULL", array(), array("auto_display_start_date" => "create_date"));
     $masterfields = array("id" => $this->intColumn("ID"), "name" => $this->textColumn("NAME"), "rank" => $this->intColumn("RANK"));
     $table = "atd_mtb_auto_display_status";
     if ($this->objDb->sfColumnExists($table, "id") == false) {
         $this->objManager->createTable($table, $masterfields);
     }
     foreach ($masterfields as $name => $define) {
         $this->objDb->sfColumnExists($table, $name, $define["type"], "", true);
         $this->fieldComment($installer, $table, $name, $define["comment"]);
     }
     $this->masterdata->deleteMasterData($table);
     $this->masterdata->clearCache($table);
     $this->masterdata->registMasterData($table, array(), explode(",", "常時公開,時限公開"));
     // $this->insertMasterData ( "PRODUCTS_RESULT_ROWSPAN", 1, '管理画面/商品管理一覧 行結合数' );
     // $this->insertMasterData ( "PRODUCTS_RESULT_COLUMN", 5, '管理画面/商品管理一覧 列位置' );
     // $this->insertMasterData ( "PRODUCTS_SEARCH_AUTO_DISPLAY", 1, '検索画面表示設定(1: ON/ 0:OFF)' );
     // $this->insertMasterData ( "PRODUCTS_DETAIL_AUTO_DISPLAY", 1, '検索画面表示設定(1: ON/ 0:OFF)' );
 }
 /**
  * @param array               $arrPlugin
  * @param SC_Plugin_Installer $objPluginInstaller
  * @see SC_Plugin_Base::install()
  */
 function install($arrPlugin, $objPluginInstaller = null)
 {
     // logo コピー
     $objPluginInstaller->copyDirectory("copy/plugin_dir/", "");
     SC_Utils_Ex::copyDirectory(KTC_COPY_MOD_DIR, DATA_REALDIR . "module/");
     SC_Utils_Ex::copyDirectory(KTC_COPY_CLASS_DIR, CLASS_REALDIR);
     SC_Utils_Ex::copyDirectory(KTC_COPY_CLASS_EX_DIR, CLASS_EX_REALDIR);
     SC_Utils_Ex::copyDirectory(KTC_COPY_HTML_DIR . "user_data/", HTML_REALDIR . USER_DIR);
     SC_Utils_Ex::copyDirectory(KTC_COPY_HTML_DIR . "au/", HTML_REALDIR . "au/");
     SC_Utils_Ex::copyDirectory(KTC_COPY_HTML_DIR . "products/", HTML_REALDIR . "products/");
     SC_Utils_Ex::copyDirectory(KTC_COPY_HTML_DIR . "frontparts/bloc", HTML_REALDIR . BLOC_DIR);
     SC_Utils_Ex::copyDirectory(KTC_COPY_HTML_DIR . "admin/", HTML_REALDIR . ADMIN_DIR);
     SC_Utils_Ex::copyDirectory(KTC_COPY_TMPL_DIR . "admin/", TEMPLATE_ADMIN_REALDIR);
     SC_Utils_Ex::copyDirectory(KTC_COPY_TMPL_DIR . "sphone/", SMARTPHONE_TEMPLATE_REALDIR);
     $this->initDB($arrPlugin, $objPluginInstaller);
     $this->updateTemplate($arrPlugin, $objPluginInstaller);
     $this->createCash();
 }
Exemplo n.º 4
0
 function update(array $arrPlugin, SC_Plugin_Installer $installer)
 {
     require_once DOWNLOADS_TEMP_PLUGIN_UPDATE_DIR . "KisekaeTouchCore.php";
     $plugin_code = $arrPlugin["plugin_code"];
     $date = date("Ymd");
     define("KTC_PLG_ORG_DIR", PLUGIN_UPLOAD_REALDIR . "{$plugin_code}/");
     define("KTC_PLG_UPD_DIR", DOWNLOADS_TEMP_PLUGIN_UPDATE_DIR);
     define("KTC_PLG_BKU_DIR", PLUGIN_UPLOAD_REALDIR . "{$plugin_code}_{$date}/");
     if (file_exists(KTC_PLG_BKU_DIR)) {
         // nop
     } else {
         SC_Utils_Ex::recursiveMkdir(KTC_PLG_BKU_DIR);
         $log = SC_Utils_Ex::sfCopyDir(KTC_PLG_ORG_DIR, KTC_PLG_BKU_DIR, "", TRUE);
         GC_Utils_Ex::gfPrintLog($log, PLUGIN_LOG_REALFILE, FALSE);
     }
     SC_Helper_FileManager_Ex::deleteFile(KTC_PLG_ORG_DIR, FALSE);
     $log = SC_Utils_Ex::sfCopyDir(KTC_PLG_UPD_DIR, KTC_PLG_ORG_DIR, "", TRUE);
     GC_Utils_Ex::gfPrintLog($log, PLUGIN_LOG_REALFILE, FALSE);
     $installer->copyDirectory("copy/plugin_dir/", "");
     $core = new KisekaeTouchCore($arrPlugin);
     $plugin_version = $arrPlugin["plugin_version"];
     $core->update($arrPlugin, $installer, $plugin_version);
     $core->createCash();
 }