Ticket #2181 (new 改善提案) — at Version 2
開発合宿:プラグインのインストーラ
| Reported by: | adachi | Owned by: | somebody |
|---|---|---|---|
| Priority: | 中 | Milestone: | EC-CUBE2.13.0 |
| Component: | フロント | Version: | 2.12.3 |
| Keywords: | Cc: | ||
| 修正済み: | yes |
Description (last modified by adachi) (diff)
以下は、現状プラグイン任せなので、エラーがおきやすい
・インストール ・アンインストール ・有効 ・無効
インストール用ユーティリティを用意し、プラグイン作成者に使ってもらう ※テーブル作成、ファイルコピー、ブロック追加など
利用イメージ
function install($arrPlugin) {
$objInstaller->sql("create table xxx")
$objInstaller->copyfiles("media/product.css", "media/product.css");
$objInstaller->sql("alter table add column xxx int");
※このタイミングでは、SQLやファイルコピーは実行されない。
※実行は上のレイヤで制御
}
使い方
install($arrPlugin, $objPluginInstaller) {
// カラム追加
$objPluginInstaller->sql("alter table dtb_products add column plg_plugin_code_hoge text");
// テーブル追加
$objPluginInstaller->sql(
"create table plg_plugin_code_hogehugatable (
hoge_id int not null primary key
hoge_name text)");
// data/downloads/plugin/plugin_code/media/hoge.cssをhtml/plugin/plugin_code/media/huga.cssへコピー
$objPluginInstaller->copyFile("media/hoge.css", "media/huga.css");
// data/downloads/plugin/plugin_code/js/以下をhtml/plugin/plugin_code/js/へコピー
$objPluginInstaller->copyDirectory("js", "js");
}
uninstall($arrPlugin, $objPluginInstaller) {
// カラム追加
$objPluginInstaller->sql("alter table dtb_products drop column plg_plugin_code_hoge");
// テーブル削除
$objPluginInstaller->sql("drop table plg_plugin_code_hoge");
// ファイル削除
html以下はアンインストール時にまるっと削除される
}
Change History
Changed 13 years ago by h_yoshimoto
-
attachment
plugin_info2.tar.gz
added
comment:1 Changed 13 years ago by adachi
使い方:
install($arrPlugin, $objPluginInstaller) {
// カラム追加
$objPluginInstaller->sql("alter table dtb_products add column plg_plugin_code_hoge text");
// テーブル追加
$objPluginInstaller->sql(
"create table plg_plugin_code_hogehugatable (
hoge_id int not null primary key
hoge_name text)");
// data/downloads/plugin/plugin_code/media/hoge.cssをhtml/plugin/plugin_code/media/huga.cssへコピー
$objPluginInstaller->copyFile("media/hoge.css", "media/huga.css");
// data/downloads/plugin/plugin_code/js/以下をhtml/plugin/plugin_code/js/へコピー
$objPluginInstaller->copyDirectory("js", "js");
}
Changed 13 years ago by h_yoshimoto
-
attachment
CategoryContents_error.tar.gz
added
エラー出るプラグインをアップデート
Note: See
TracTickets for help on using
tickets.

エラー出るプラグイン