. * * @author D3 Data Development - Daniel Seifert * @link http://www.oxidmodule.com */ class d3usersonline_update extends d3install_updatebase { public $sModKey = 'd3usersonline'; public $sModName = 'Users Online'; public $sModVersion = '2.0.0.2'; public $sModRevision = '28'; public $sBaseConf = 'Z5yR2NUcFoyV3BHTVFTZDZ5bFByMmtkTDh5YjFMUW5JV0QrZ0dTeEliMVJTREFSTzRkRTAySEJzblEwU GFXMjNMM0RCQXA0NzNEaXA2anJ0Y2dlRWNNM3l3UlB2M0ZoQlFwMkhsM1QwVjh1K0hmdTMzU0wyT3lKe k84UTQ2d0phQzlRcWdxOUZQNzIyVFlERHdUZm5YeENPanFlVTUxclJnZWtaTENOKzhuYkpvQ1N3eDBYO EEvRnFqQ2FzUXVCQnQ2QkJVOXBYSVNLOExnK3RTb2c1OTdzaE55N0d6ZnM5VFd4TE1oR09oZ0ZoK0RhL 29tZ0pLWGhDWFpXK1ZncXpPOTZ2OTBSdEQzdnYyUTduZy96N1JYeGlrQ3JvNlplVEg1aHVEY2hJRTFha k09'; public $sRequirements = ''; public $sBaseValue = ''; protected $_aUpdateMethods = array( array('check' => 'checkUsersOnlineTableExist', 'do' => 'updateUsersOnlineTableExist'), array('check' => 'checkRenameFields', 'do' => 'fixRenameFields'), array('check' => 'checkDeleteFields', 'do' => 'fixDeleteFields'), array('check' => 'checkModCfgItemExist', 'do' => 'updateModCfgItemExist'), array('check' => 'checkFields', 'do' => 'fixFields'), array('check' => 'checkIndizes', 'do' => 'fixIndizes'), array('check' => 'checkModCfgSameRevision', 'do' => 'updateModCfgSameRevision'), ); public $aFields = array( 'OXID' => array( 'sTableName' => 'd3usersonline', 'sFieldName' => 'OXID', 'sType' => 'char(32)', 'blNull' => false, 'sDefault' => false, 'sComment' => '', 'sExtra' => '', 'blMultilang' => false, ), 'TIMEVISIT' => array( 'sTableName' => 'd3usersonline', 'sFieldName' => 'TIMEVISIT', 'sType' => 'INT(11)', 'blNull' => false, 'sDefault' => '0', 'sComment' => '', 'sExtra' => '', 'blMultilang' => false, ), 'OXCLASS' => array( 'sTableName' => 'd3usersonline', 'sFieldName' => 'OXCLASS', 'sType' => 'VARCHAR(32)', 'blNull' => false, 'sDefault' => false, 'sComment' => '', 'sExtra' => '', 'blMultilang' => false, ), ); public $aIndizes = array( 'OXID' => array( 'sTableName' => 'd3usersonline', 'sType' => 'PRIMARY', 'aFields' => array( 'OXID' => 'OXID', ), ), 'OXCLASS' => array( 'sTableName' => 'd3usersonline', 'sType' => '', 'sName' => 'OXCLASS', 'aFields' => array( 'OXCLASS' => 'OXCLASS', ), ), ); public $aRenameFields = array( 'OXID' => array( 'sTableName' => 'd3usersonline', 'mOldFieldNames' => array('id', 'ID'), // is case sensitive 'sFieldName' => 'OXID', 'blMultilang' => false, ), 'VISITOR' => array( 'sTableName' => 'd3usersonline', 'mOldFieldNames' => array('visitor'), // is case sensitive 'sFieldName' => 'VISITOR', 'blMultilang' => false, ), 'TIMEVISIT' => array( 'sTableName' => 'd3usersonline', 'mOldFieldNames' => array('timevisit'), // is case sensitive 'sFieldName' => 'TIMEVISIT', 'blMultilang' => false, ), 'OXCLASS' => array( 'sTableName' => 'd3usersonline', 'mOldFieldNames' => array('oxclass'), // is case sensitive 'sFieldName' => 'OXCLASS', 'blMultilang' => false, ), ); public $aDeleteFields = array( 'VISITOR' => array( 'sTableName' => 'd3usersonline', 'sFieldName' => 'VISITOR', 'blMultilang' => false, ), ); protected $_aRefreshMetaModuleIds = array('d3usersonline'); /** * @return bool true, if table is missing */ public function checkUsersOnlineTableExist() { return $this->_checkTableNotExist('d3usersonline'); } /** * @return bool */ public function updateUsersOnlineTableExist() { $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__); } return $blRet; } /** * @return bool */ public function checkModCfgItemExist() { $blRet = false; foreach ($this->_getShopList() as $oShop) { /** @var $oShop oxshop */ $aWhere = array( 'oxmodid' => $this->sModKey, 'oxnewrevision' => $this->sModRevision, 'oxshopid' => $oShop->getId(), ); $blRet = $this->_checkTableItemNotExist('d3_cfg_mod', $aWhere); if ($blRet) { return $blRet; } } return $blRet; } /** * @return bool */ public function updateModCfgItemExist() { $blRet = false; if ($this->checkModCfgItemExist()) { foreach ($this->_getShopList() as $oShop) { /** @var $oShop oxshop */ $aWhere = array( 'oxmodid' => $this->sModKey, 'oxshopid' => $oShop->getId(), 'oxnewrevision' => $this->sModRevision, ); if ($this->_checkTableItemNotExist('d3_cfg_mod', $aWhere)) { // update don't use this property unset($aWhere['oxnewrevision']); $aInsertFields = array( 'OXID' => array ( 'content' => "md5('" . $this->sModKey . " " . $oShop->getId() . " de')", 'force_update' => true, 'use_quote' => false, ), 'OXSHOPID' => array ( 'content' => $oShop->getId(), 'force_update' => true, 'use_quote' => true, ), 'OXMODID' => array ( 'content' => $this->sModKey, 'force_update' => true, 'use_quote' => true, ), 'OXNAME' => array ( 'content' => $this->sModName, 'force_update' => true, 'use_quote' => true, ), 'OXACTIVE' => array ( 'content' => "0", 'force_update' => false, 'use_quote' => false, ), 'OXBASECONFIG' => array ( 'content' => $this->sBaseConf, 'force_update' => true, 'use_quote' => true, ), 'OXSERIAL' => array ( 'content' => "", 'force_update' => false, 'use_quote' => true, ), 'OXINSTALLDATE' => array ( 'content' => "NOW()", 'force_update' => true, 'use_quote' => false, ), 'OXVERSION' => array ( 'content' => $this->sModVersion, 'force_update' => true, 'use_quote' => true, ), 'OXSHOPVERSION' => array ( 'content' => oxRegistry::getConfig()->getEdition(), 'force_update' => true, 'use_quote' => true, ), 'OXREQUIREMENTS' => array ( 'content' => $this->sRequirements, 'force_update' => true, 'use_quote' => true, ), 'OXVALUE' => array( 'content' => $this->sBaseValue, 'force_update' => false, 'use_quote' => true, ), 'OXNEWREVISION' => array( 'content' => $this->sModRevision, 'force_update' => true, 'use_quote' => true, ) ); $aRet = $this->_updateTableItem('d3_cfg_mod', $aInsertFields, $aWhere); $blRet = $aRet['blRet']; $this->_setActionLog('SQL', $aRet['sql'], __METHOD__); $this->_setUpdateBreak(false); } } } return $blRet; } }