Minahito
minah****@users*****
2006年 11月 16日 (木) 19:08:07 JST
Index: xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php:1.1.2.15 xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php:1.1.2.16 --- xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php:1.1.2.15 Wed Nov 15 20:33:20 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php Thu Nov 16 19:08:07 2006 @@ -381,115 +381,6 @@ return true; } - - /** - * Tries to smart update all of preferences & notifications. - * - * @todo This method is perhaps uncompleted. If you have written more smart - * function, please contribute it to us. - * @note The utility method for the custom-update-installer. - */ - function _upgradePreferences() - { - $configHandler =& xoops_gethandler('config'); - - // - // At the start, load config items of this time. - // - $criteria =& new CriteriaCompo(); - $criteria->add(new Criteria('conf_modid', $this->_mTargetXoopsModule->get('mid'))); - $criteria->add(new Criteria('conf_catid', 0)); - - $activeConfigArr =& $configHandler->getConfigs($criteria); - - // - // Next, load config item from xoops_version.php. - // - $newConfigArr = array(); - $t_configInfoArr = Legacy_ModuleInstallUtils::getConfigInfosFromManifesto($this->_mTargetXoopsModule); - - $count = 0; - if (is_array($t_configInfoArr)) { - foreach ($t_configInfoArr as $t_configInfo) { - $config =& $configHandler->createConfig(); - $config->loadFromConfigInfo($this->_mTargetXoopsModule->get('mid'), $t_configInfo, $count++); - $newConfigArr[] =& $config; - unset($config); - } - } - - // - // If some active configs were deleted, remove them form database. - // - foreach (array_keys($activeConfigArr) as $t_actkey) { - $findFlag = false; - foreach (array_keys($newConfigArr) as $t_newkey) { - - if ($activeConfigArr[$t_actkey]->get('conf_name') == $newConfigArr[$t_newkey]->get('conf_name')) { - $findFlag = true; - if (!$activeConfigArr[$t_actkey]->isEqual($newConfigArr[$t_newkey])) { - // - // Update object - // - $activeConfigArr[$t_actkey]->set('conf_title', $newConfigArr[$t_newkey]->get('conf_title')); - $activeConfigArr[$t_actkey]->set('conf_value', $newConfigArr[$t_newkey]->get('conf_value')); - $activeConfigArr[$t_actkey]->set('conf_desc', $newConfigArr[$t_newkey]->get('conf_desc')); - $activeConfigArr[$t_actkey]->set('conf_formtype', $newConfigArr[$t_newkey]->get('conf_formtype')); - $activeConfigArr[$t_actkey]->set('conf_valuetype', $newConfigArr[$t_newkey]->get('conf_valuetype')); - - // - // Delete config options. - // - $t_optionArr =& $activeConfigArr[$t_actkey]->getOptionItems(); - foreach (array_keys($t_optionArr) as $t_optionKey) { - $configHandler->_oHandler->delete($t_optionArr[$t_optionKey]); //< Exception!! - } - - $activeConfigArr[$t_actkey]->setConfOptions($newConfigArr[$t_newkey]->getConfOptions()); - - $configHandler->insertConfig($activeConfigArr[$t_actkey]); //< FIXME need log. - } - } - } - - if (!$findFlag) { - $configHandler->deleteConfig($activeConfigArr[$t_actkey]); - unset($activeConfigArr[$t_actkey]); - } - } - - // - // If some new configs were registered, insert them into database. - // - $maxOrder = 0; - foreach (array_keys($activeConfigArr) as $t_actkey) { - if ($activeConfigArr[$t_actkey]->get('conf_order') > $maxOrder) { - $maxOrder = $activeConfigArr[$t_actkey]->get('conf_order'); - } - } - - $order = $maxOrder + 1; - - foreach (array_keys($newConfigArr) as $t_newkey) { - $newFlag = true; - foreach (array_keys($activeConfigArr) as $t_actkey) { - if ($newConfigArr[$t_newkey]->isEqual($activeConfigArr[$t_actkey])) { - $newFlag = false; - break; - } - } - - if ($newFlag) { - $newConfigArr[$t_newkey]->set('conf_order', $order); - if ($configHandler->insertConfig($newConfigArr[$t_newkey])) { - $this->mLog->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_INSERT_CONFIG, $newConfigArr[$t_newkey]->get('conf_name'))); - } - else { - $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_INSERT_CONFIG, $newConfigArr[$t_newkey]->get('conf_name'))); - } - } - } - } } ?> \ No newline at end of file