diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 250fd9cfdd..3412c03ce6 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -584,6 +584,9 @@ class upgradeModel extends model $this->execSQL($xuanxuanSql); } break; + case '18_0_beta2': + $this->updateMyBlocks(); + break; } $this->deletePatch(); @@ -8010,4 +8013,53 @@ class upgradeModel extends model } return true; } + + /** + * Update my module blocks. + * + * @access public + * @return bool + */ + public function updateMyBlocks() + { + /* Delete flowchart block. */ + $this->dao->delete()->from(TABLE_BLOCK)->where('module')->eq('my')->andWhere('block')->eq('flowchart')->exec(); + + /* Update block order and insert guide block. */ + $visionList = array('rnd', 'lite'); + + /* Set guide block data. */ + $guideBlock = new stdclass(); + $guideBlock->module = 'my'; + $guideBlock->title = common::checkNotCN() ? 'Guides' : '使用帮助'; + $guideBlock->block = 'guide'; + $guideBlock->order = 3; + $guideBlock->grid = 8; + foreach($visionList as $vision) + { + $guideBlock->vision = $vision; + $this->dao->update(TABLE_BLOCK) + ->set('`order` = `order` + 1') + ->where('vision')->eq($vision) + ->andWhere('module')->eq('my') + ->andWhere('`order`')->ge(3) + ->orderBy('`order` desc') + ->exec(); + + $accountList = $this->dao->select('account')->from(TABLE_BLOCK) + ->where('vision')->eq($vision) + ->andWhere('module')->eq('my') + ->fetchPairs('account'); + + foreach($accountList as $account) + { + if(empty($account)) continue; + + $guideBlock->account = $account; + $this->dao->insert(TABLE_BLOCK)->data($guideBlock)->exec(); + } + } + + return true; + } }