From e269bf7fbe7ae0d8ff2516c4ed46ea6af31c60d0 Mon Sep 17 00:00:00 2001 From: DanielSeifert Date: Fri, 23 Jan 2015 09:51:54 +0000 Subject: [PATCH] fix update script --- .../admin/d3_usersonline_statistic.php | 3 +- .../modules/d3/d3usersonline/metadata.php | 10 ++++- .../setup/d3usersonline_update.php | 42 +++++++++++++------ setup+doku/d3precheck.php | 2 +- 4 files changed, 42 insertions(+), 15 deletions(-) diff --git a/copy_this/modules/d3/d3usersonline/controllers/admin/d3_usersonline_statistic.php b/copy_this/modules/d3/d3usersonline/controllers/admin/d3_usersonline_statistic.php index b8b56b6..234a961 100644 --- a/copy_this/modules/d3/d3usersonline/controllers/admin/d3_usersonline_statistic.php +++ b/copy_this/modules/d3/d3usersonline/controllers/admin/d3_usersonline_statistic.php @@ -14,7 +14,7 @@ class d3_usersonline_statistic extends d3_cfg_mod_main { protected $_blUseOwnOxid = false; - + protected $_iExpTime = 600; // (in seconds) protected $_sThisTemplate = 'd3_usersonline_statistic.tpl'; /** @@ -24,6 +24,7 @@ class d3_usersonline_statistic extends d3_cfg_mod_main { /** @var d3usersonline $oUsersOnline */ $oUsersOnline = oxNew('d3usersonline'); + $oUsersOnline->clearOldItems($this->_iExpTime); return $oUsersOnline->getUserCount(); } } diff --git a/copy_this/modules/d3/d3usersonline/metadata.php b/copy_this/modules/d3/d3usersonline/metadata.php index 1d6a02a..787438c 100644 --- a/copy_this/modules/d3/d3usersonline/metadata.php +++ b/copy_this/modules/d3/d3usersonline/metadata.php @@ -67,5 +67,13 @@ $aModule = array( 'block' => 'sidebar_categoriestree', 'file' => 'views/blocks/layout/d3usersonline_sidebar.tpl' ), - ) + ), + 'd3FileRegister' => array( + 'd3/d3usersonline/IntelliSenseHelper.php', + 'd3/d3usersonline/metadata.php', + 'd3/d3usersonline/translations/de/d3usersonline_lang.php', + 'd3/d3usersonline/translations/en/d3usersonline_lang.php', + 'd3/d3usersonline/views/admin/de/d3usersonline_lang.php', + 'd3/d3usersonline/views/admin/en/d3usersonline_lang.php', + ), ); \ No newline at end of file diff --git a/copy_this/modules/d3/d3usersonline/setup/d3usersonline_update.php b/copy_this/modules/d3/d3usersonline/setup/d3usersonline_update.php index 0d76c04..76946e8 100644 --- a/copy_this/modules/d3/d3usersonline/setup/d3usersonline_update.php +++ b/copy_this/modules/d3/d3usersonline/setup/d3usersonline_update.php @@ -46,10 +46,18 @@ k09'; 'do' => 'fixFields'), array('check' => 'checkIndizes', 'do' => 'fixIndizes'), + array('check' => 'hasOldModuleFiles', + 'do' => 'deleteOldModuleFiles'), + array('check' => 'hasUnregisteredFiles', + 'do' => 'showUnregisteredFiles'), array('check' => 'checkModCfgSameRevision', 'do' => 'updateModCfgSameRevision'), ); + public $aOldModuleFiles = array( + 'd3/d3usersonline/models/d3usersonline_update.php', + ); + public $aFields = array( 'OXID' => array( 'sTableName' => 'd3usersonline', @@ -153,11 +161,8 @@ k09'; { $blRet = true; - if ($this->checkUsersOnlineTableExist()) - { - $aRet = $this->_addTable('d3usersonline', $this->aFields, $this->aIndizes, 'users online', 'MyISAM'); - $blRet = $aRet['blRet']; - $this->_setActionLog('SQL', $aRet['sql'], __METHOD__); + if ($this->checkUsersOnlineTableExist()) { + $blRet = $this->_addTable2('d3usersonline', $this->aFields, $this->aIndizes, 'users online', 'MyISAM'); } return $blRet; @@ -169,7 +174,7 @@ k09'; public function checkModCfgItemExist() { $blRet = false; - foreach ($this->_getShopList() as $oShop) { + foreach ($this->getShopList() as $oShop) { /** @var $oShop oxshop */ $aWhere = array( 'oxmodid' => $this->sModKey, @@ -195,7 +200,7 @@ k09'; $blRet = false; if ($this->checkModCfgItemExist()) { - foreach ($this->_getShopList() as $oShop) { + foreach ($this->getShopList() as $oShop) { /** @var $oShop oxshop */ $aWhere = array( 'oxmodid' => $this->sModKey, @@ -274,14 +279,27 @@ k09'; 'use_quote' => true, ) ); - $aRet = $this->_updateTableItem('d3_cfg_mod', $aInsertFields, $aWhere); - $blRet = $aRet['blRet']; - - $this->_setActionLog('SQL', $aRet['sql'], __METHOD__); - $this->_setUpdateBreak(false); + $blRet = $this->_updateTableItem2('d3_cfg_mod', $aInsertFields, $aWhere); + $this->setUpdateBreak(false); } } } return $blRet; } + + /** + * @return bool + */ + public function hasUnregisteredFiles() + { + return $this->_hasUnregisteredFiles($this->sModKey, array('d3FileRegister', 'blocks')); + } + + /** + * @return bool + */ + public function showUnregisteredFiles() + { + return $this->_showUnregisteredFiles($this->sModKey, array('d3FileRegister', 'blocks')); + } } diff --git a/setup+doku/d3precheck.php b/setup+doku/d3precheck.php index a86252d..d6b86ec 100644 --- a/setup+doku/d3precheck.php +++ b/setup+doku/d3precheck.php @@ -152,7 +152,7 @@ class requcheck 'aParams' => array( 'd3modcfg_lib', 'Modul-Connector', - '3.9.0.5' + '4.3.1.0' ), ), ),