Minahito
minah****@users*****
2005年 12月 28日 (水) 23:16:48 JST
Index: xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php diff -u xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php:1.1.2.3 xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php:1.1.2.4 --- xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php:1.1.2.3 Wed Dec 28 22:54:29 2005 +++ xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php Wed Dec 28 23:16:47 2005 @@ -112,68 +112,7 @@ function _installPreference() { - $configInfos = $this->mModule->getInfo('config'); - - // - // Insert comment config by old style. - // - if ($this->mModule->getVar('hascomments') !=0 ) { - require_once XOOPS_ROOT_PATH . "/include/comment_constants.php"; - - $configInfos[] = array('name' => 'com_rule', - 'title' => '_CM_COMRULES', - 'description' => '', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 1, - 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN) - ); - - $configInfos[] = array('name' => 'com_anonpost', - 'title' => '_CM_COMANONPOST', - 'description' => '', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0 - ); - } - - // TODO comment - - // TODO notification - - $configHandler =& xoops_gethandler('config'); - - $count = 0; - foreach ($configInfos as $configInfo) { - $config =& $configHandler->createConfig(); - - $config->setVar('conf_modid', $this->mModule->getVar('mid')); - $config->setVar('conf_catid', 0); - $config->setVar('conf_name', $configInfo['name']); - $config->setVar('conf_title', $configInfo['title'], true); - $config->setVar('conf_desc', $configInfo['description'], true); - $config->setVar('conf_formtype', $configInfo['formtype'], true); - $config->setVar('conf_valuetype', $configInfo['valuetype'], true); - $config->setConfValueForInput($configInfo['default'], true); - $config->setVar('conf_order', $count++); - - if (isset($configInfo['options']) && is_array($configInfo['options'])) { - foreach ($configInfo['options'] as $key => $value) { - $configOption =& $configHandler->createConfigOption(); - $configOption->setVar('confop_name', $key, true); - $configOption->setVar('confop_value', $value, true); - $config->setConfOptions($configOption); - unset($configOption); - } - } - - if (!$configHandler->insertConfig($config)) { - $this->mLog->addError("ERROR: Could not insert config " . $configInfo['name']); - } - - unset($config); - } + Legacy_ModuleUtils::insertAllConfigs($this->mModule, $this->mLog); } } Index: xoops2jp/html/modules/base/admin/class/ModuleUninstaller.class.php diff -u xoops2jp/html/modules/base/admin/class/ModuleUninstaller.class.php:1.1.2.4 xoops2jp/html/modules/base/admin/class/ModuleUninstaller.class.php:1.1.2.5 --- xoops2jp/html/modules/base/admin/class/ModuleUninstaller.class.php:1.1.2.4 Wed Dec 28 22:54:29 2005 +++ xoops2jp/html/modules/base/admin/class/ModuleUninstaller.class.php Wed Dec 28 23:16:48 2005 @@ -118,20 +118,7 @@ function _installPreference() { - if ($this->mModule->getVar('hasconfig') == 0) { - return; - } - - $configHandler =& xoops_gethandler('config'); - $configs =& $configHandler->getConfigs(new Criteria('conf_modid', $this->mModule->getVar('mid'))); - - if (count($configs) == 0) { - return; - } - - foreach ($configs as $config) { - $configHandler->deleteConfig($config); - } + Legacy_ModuleUtils::deleteAllConfigs($this->mModule, $this->mLog); } } Index: xoops2jp/html/modules/base/admin/class/ModuleUpdater.class.php diff -u xoops2jp/html/modules/base/admin/class/ModuleUpdater.class.php:1.1.2.1 xoops2jp/html/modules/base/admin/class/ModuleUpdater.class.php:1.1.2.2 --- xoops2jp/html/modules/base/admin/class/ModuleUpdater.class.php:1.1.2.1 Fri Dec 16 18:56:11 2005 +++ xoops2jp/html/modules/base/admin/class/ModuleUpdater.class.php Wed Dec 28 23:16:48 2005 @@ -165,6 +165,12 @@ } */ } + + function _installPreference() + { + Legacy_ModuleUtils::deleteAllConfigs($this->mModule, $this->mLog); + Legacy_ModuleUtils::insertAllConfigs($this->mModule, $this->mLog); + } } ?> \ No newline at end of file