From 397930ac4eb43e58b9665452de0fa0dccb44de90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Tue, 17 May 2022 08:56:07 +0800 Subject: [PATCH] * Code for task #54189. --- module/common/model.php | 2 +- module/upgrade/model.php | 77 ---------------------------------------- 2 files changed, 1 insertion(+), 78 deletions(-) diff --git a/module/common/model.php b/module/common/model.php index 616bc1d5b4..a923835821 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -2216,7 +2216,7 @@ EOD; { if($this->app->getModuleName() == 'upgrade' and $this->session->upgrading) return false; - $statusFile = $this->app->getAppRoot() . 'www' . DIRECTORY_SEPARATOR . 'ok.txt'; + $statusFile = $this->app->getAppRoot() . 'www' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'ok.txt'; return (!is_file($statusFile) or (time() - filemtime($statusFile)) > 3600) ? $statusFile : false; } diff --git a/module/upgrade/model.php b/module/upgrade/model.php index e1017434f4..8af145b95c 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -455,9 +455,6 @@ class upgradeModel extends model case '16_0_beta1': $this->loadModel('api')->createDemoData($this->lang->api->zentaoAPI, 'http://' . $_SERVER['HTTP_HOST'] . $this->app->config->webRoot . 'api.php/v1', '16.0'); break; - case '16_1': - $this->moveKanbanData(); - break; case '16_2': $this->updateSpaceTeam(); $this->updateDocField(); @@ -5575,80 +5572,6 @@ class upgradeModel extends model return true; } - /** - * Move kanban card data to kanbancell table. - * - * @access public - * @return void - */ - public function moveKanbanData() - { - /* Move common kanban data. */ - $cards = $this->dao->select('id,kanban,`column`,lane')->from(TABLE_KANBANCARD)->fetchAll('id'); - - $cellGroup = array(); - foreach($cards as $cardID => $card) - { - if(!$card->lane or !$card->column) continue; - - $key = $card->kanban . '-' . $card->lane . '-' . $card->column; - $cards = isset($cellGroup[$key]) ? $cellGroup[$key] . "$cardID," : ",$cardID,"; - $cellGroup[$key] = $cards; - } - - foreach($cellGroup as $key => $cards) - { - $key = explode('-', $key); - if(!is_array($key)) continue; - - $cell = new stdclass(); - $cell->kanban = $key[0]; - $cell->lane = $key[1]; - $cell->column = $key[2]; - $cell->type = 'common'; - $cell->cards = $cards; - - $this->dao->insert(TABLE_KANBANCELL)->data($cell)->exec(); - } - - /* Drop group kanban data. */ - $groupLanePairs = $this->dao->select('id')->from(TABLE_KANBANLANE)->where('`groupby`')->ne('')->fetchPairs(); - if(!empty($groupLanePairs)) - { - $this->dao->delete()->from(TABLE_KANBANLANE)->where('id')->in($groupLanePairs)->exec(); - $this->dao->delete()->from(TABLE_KANBANCOLUMN)->where('lane')->in($groupLanePairs)->exec(); - } - - /* Move execution kanban data. */ - $executionKanban = $this->dao->select('t1.id as `lane`, t1.execution, t1.type, t2.id as `column`, t2.cards')->from(TABLE_KANBANLANE)->alias('t1') - ->leftJoin(TABLE_KANBANCOLUMN)->alias('t2')->on('t1.id = t2.lane') - ->where('t1.execution')->gt(0) - ->fetchGroup('lane'); - - foreach($executionKanban as $laneID => $laneGroup) - { - foreach($laneGroup as $colData) - { - if(!$laneID or !$colData->column) continue; - - $cell = new stdclass(); - $cell->kanban = $colData->execution; - $cell->lane = $laneID; - $cell->column = $colData->column; - $cell->type = $colData->type; - $cell->cards = $colData->cards; - - $this->dao->insert(TABLE_KANBANCELL)->data($cell)->exec(); - } - } - - /* Drop unused field. */ - $this->dao->exec("ALTER TABLE " . TABLE_KANBANCARD . " DROP COLUMN `lane`;"); - $this->dao->exec("ALTER TABLE " . TABLE_KANBANCARD . " DROP COLUMN `column`;"); - $this->dao->exec("ALTER TABLE " . TABLE_KANBANCOLUMN . " DROP COLUMN `lane`;"); - $this->dao->exec("ALTER TABLE " . TABLE_KANBANCOLUMN . " DROP COLUMN `cards`;"); - } - /** * Update kanban space team. *