結局、reload 関数を、以下のようにしました。
function reload($plugin, $key) {
// クラスファイルを読み込み.
$plugin_class_file_path = $this->getPluginFilePath($plugin['plugin_code'], $plugin['class_name']);
$arrErr = $this->requirePluginFile($plugin_class_file_path, $key);
if ($this->isError($arrErr) === true) {
return $arrErr;
}
// プラグインが有効な場合に無効化処理を実行
$plugin_enable = false;
if ($plugin['enable'] == PLUGIN_ENABLE_TRUE){
$plugin_enable = true;
// 無効化処理を実行します.
$arrErr = $this->execPlugin($plugin, $plugin['class_name'], 'disable');
if ($this->isError($arrErr) === true) {
return $arrErr;
}
// プラグインを無効にします.
$this->updatePluginEnable($plugin['plugin_id'], PLUGIN_ENABLE_FALSE);
}
// アンインストール処理を実行します.
$arrErr = $this->execPlugin($plugin, $plugin['class_name'], 'uninstall');
SC_Plugin_Util_Ex::deletePluginByPluginId($plugin['plugin_id']);
// plugin_infoを読み込み.
$arrErr = $this->requirePluginFile(PLUGIN_UPLOAD_REALDIR . $plugin['plugin_code'] . '/' . 'plugin_info.php', $key);
if ($this->isError($arrErr) === true) {
return $arrErr;
}
// リフレクションオブジェクトを生成.
$objReflection = new ReflectionClass('plugin_info');
$arrPluginInfo = $this->getPluginInfo($objReflection);
// プラグイン情報をDB登録
if ($this->registerData($arrPluginInfo) === false) {
$arrErr[$key] = '※ DB登録に失敗しました。<br/>';
return $arrErr;
}
// プラグイン情報を取得
$plugin = SC_Plugin_Util_Ex::getPluginByPluginCode($arrPluginInfo['PLUGIN_CODE']);
// クラスファイルを読み込み.
$plugin_class_file_path = $this->getPluginFilePath($plugin['plugin_code'], $plugin['class_name']);
$arrErr = $this->requirePluginFile($plugin_class_file_path, $key);
if ($this->isError($arrErr) === true) {
return $arrErr;
}
$arrErr = $this->execPlugin($plugin, $plugin['class_name'], 'install');
if ($this->isError($arrErr) === true) {
return $arrErr;
}
// プラグインが有効だったか
if ($plugin_enable === true) {
// 有効化処理を実行します.
$arrErr = $this->execPlugin($plugin, $plugin['class_name'], 'enable');
if ($this->isError($arrErr) === true) {
return $arrErr;
}
// プラグインを有効にします.
$this->updatePluginEnable($plugin['plugin_id'], PLUGIN_ENABLE_TRUE);
}
return $arrErr;
}