Minahito
minah****@users*****
2006年 11月 16日 (木) 19:10:25 JST
Index: xoops2jp/html/modules/legacy/admin/class/ModuleInstallInformation.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleInstallInformation.class.php:1.1.2.4 xoops2jp/html/modules/legacy/admin/class/ModuleInstallInformation.class.php:1.1.2.5 --- xoops2jp/html/modules/legacy/admin/class/ModuleInstallInformation.class.php:1.1.2.4 Wed Nov 15 22:26:50 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleInstallInformation.class.php Thu Nov 16 19:10:25 2006 @@ -7,6 +7,7 @@ define('LEGACY_INSTALLINFO_STATUS_LOADED', "loaded"); define('LEGACY_INSTALLINFO_STATUS_UPDATED', "updated"); +define('LEGACY_INSTALLINFO_STATUS_ORDER_UPDATED', "order_updated"); define('LEGACY_INSTALLINFO_STATUS_NEW', "new"); define('LEGACY_INSTALLINFO_STATUS_DELETED', "deleted"); @@ -294,15 +295,30 @@ { $currentOrder = 0; foreach (array_keys($this->mPreferences) as $idx) { - $this->mPreferences[$idx]->mOrder = $currentOrder++; + if ($this->mPreferences[$idx]->mOrder != $currentOrder) { + $this->mPreferences[$idx]->mStatus = LEGACY_INSTALLINFO_STATUS_ORDER_UPDATED; + $this->mPreferences[$idx]->mOrder = $currentOrder; + } + + $currentOrder++; } foreach (array_keys($this->mComments) as $idx) { - $this->mComments[$idx]->mOrder = $currentOrder++; + if ($this->mComments[$idx]->mOrder != $currentOrder) { + $this->mComments[$idx]->mStatus = LEGACY_INSTALLINFO_STATUS_ORDER_UPDATED; + $this->mComments[$idx]->mOrder = $currentOrder; + } + + $currentOrder++; } foreach (array_keys($this->mNotifications) as $idx) { - $this->mNotifications[$idx]->mOrder = $currentOrder++; + if ($this->mNotifications[$idx]->mOrder != $currentOrder) { + $this->mNotifications[$idx]->mStatus = LEGACY_INSTALLINFO_STATUS_ORDER_UPDATED; + $this->mNotifications[$idx]->mOrder = $currentOrder; + } + + $currentOrder++; } } @@ -317,6 +333,17 @@ return $ret; } + function &getNotify($name) + { + $ret = null; + + if (isset($this->mNotifications[$name])) { + return $this->mNotifications[$name]; + } + + return $ret; + } + /** * Updates the list of blocks by comparing with $collection. * @todo need delete comments' data @@ -363,15 +390,21 @@ // // Notifications // - if (count($this->mNotifications) > 0 && count($collection->mNotifications) == 0) { - foreach (array_keys($this->mNotifications) as $idx) { + foreach (array_keys($this->mNotifications) as $idx) { + $t_preference =& $collection->getNotify($this->mNotifications[$idx]->mName); + if ($t_preference == null) { $this->mNotifications[$idx]->mStatus = LEGACY_INSTALLINFO_STATUS_DELETED; } + elseif (!$this->mNotifications[$idx]->isEqual($t_preference)) { + $this->mNotifications[$idx]->update($t_preference); + } } - elseif (count($this->mNotifications) == 0 && count($collection->mNotifications) > 0) { - $this->mNotifications =& $collection->mNotifications; - foreach (array_keys($this->mNotifications) as $idx) { - $this->mNotifications[$idx]->mStatus = LEGACY_INSTALLINFO_STATUS_NEW; + + foreach (array_keys($collection->mNotifications) as $idx) { + $name = $collection->mNotifications[$idx]->mName; + if (!isset($this->mNotifications[$name])) { + $this->add($collection->mNotifications[$name]); + $this->mNotifications[$name]->mStatus = LEGACY_INSTALLINFO_STATUS_NEW; } } } Index: xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php:1.1.2.13 xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php:1.1.2.14 --- xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php:1.1.2.13 Wed Nov 15 18:11:08 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php Thu Nov 16 19:10:25 2006 @@ -157,7 +157,7 @@ if (isset($module->modinfo['cube_style']) && $module->modinfo['cube_style'] == true) { require_once XOOPS_MODULE_PATH . "/legacy/admin/class/Legacy_SQLScanner.class.php"; - $scanner =& new Legacy_CubeStyleSQLScanner(); + $scanner =& new Legacy_SQLScanner(); $scanner->setDB_PREFIX(XOOPS_DB_PREFIX); $scanner->setDirname($module->get('dirname')); @@ -850,7 +850,7 @@ case LEGACY_INSTALLINFO_STATUS_LOADED: Legacy_ModuleInstallUtils::updateBlockTemplateByInfo($currentBlocks->mBlocks[$idx], $module, $log); break; - + case LEGACY_INSTALLINFO_STATUS_UPDATED: Legacy_ModuleInstallUtils::updateBlockByInfo($currentBlocks->mBlocks[$idx], $module, $log); break; @@ -883,14 +883,14 @@ // foreach (array_keys($currentPreferences->mPreferences) as $idx) { switch ($currentPreferences->mPreferences[$idx]->mStatus) { - case LEGACY_INSTALLINFO_STATUS_LOADED: - Legacy_ModuleInstallUtils::updatePreferenceOrderByInfo($currentPreferences->mPreferences[$idx], $module, $log); - break; - case LEGACY_INSTALLINFO_STATUS_UPDATED: Legacy_ModuleInstallUtils::updatePreferenceByInfo($currentPreferences->mPreferences[$idx], $module, $log); break; + case LEGACY_INSTALLINFO_STATUS_ORDER_UPDATED: + Legacy_ModuleInstallUtils::updatePreferenceOrderByInfo($currentPreferences->mPreferences[$idx], $module, $log); + break; + case LEGACY_INSTALLINFO_STATUS_NEW: Legacy_ModuleInstallUtils::installPreferenceByInfo($currentPreferences->mPreferences[$idx], $module, $log); break; @@ -906,8 +906,11 @@ // foreach (array_keys($currentPreferences->mComments) as $idx) { switch ($currentPreferences->mComments[$idx]->mStatus) { - case LEGACY_INSTALLINFO_STATUS_LOADED: case LEGACY_INSTALLINFO_STATUS_UPDATED: + Legacy_ModuleInstallUtils::updatePreferenceByInfo($currentPreferences->mComments[$idx], $module, $log); + break; + + case LEGACY_INSTALLINFO_STATUS_ORDER_UPDATED: Legacy_ModuleInstallUtils::updatePreferenceOrderByInfo($currentPreferences->mComments[$idx], $module, $log); break; @@ -926,10 +929,11 @@ // foreach (array_keys($currentPreferences->mNotifications) as $idx) { switch ($currentPreferences->mNotifications[$idx]->mStatus) { - case LEGACY_INSTALLINFO_STATUS_LOADED: - break; - case LEGACY_INSTALLINFO_STATUS_UPDATED: + Legacy_ModuleInstallUtils::updatePreferenceByInfo($currentPreferences->mNotifications[$idx], $module, $log); + break; + + case LEGACY_INSTALLINFO_STATUS_ORDER_UPDATED: Legacy_ModuleInstallUtils::updatePreferenceOrderByInfo($currentPreferences->mNotifications[$idx], $module, $log); break; @@ -1168,7 +1172,7 @@ $successFlag = true; - $scanner =& new Legacy_CubeStyleSQLScanner(); + $scanner =& new Legacy_SQLScanner(); $scanner->setDB_PREFIX(XOOPS_DB_PREFIX); $scanner->setDirname($module->get('dirname')); $scanner->setBuffer($query);