From 369c976ccfce7b2afac98c40f336df9f089fee48 Mon Sep 17 00:00:00 2001 From: sunhao Date: Tue, 15 Oct 2024 18:01:51 +0800 Subject: [PATCH] * [misc] fix merge feature/doc to main at commit b058c8a456de76894f54000847fc708019d3c5b8. --- module/file/control.php | 22 ++++++++++++++++ module/upgrade/config/upgradeflow.php | 1 + module/upgrade/model.php | 36 +++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/module/file/control.php b/module/file/control.php index 9792720611..ec5fe52cf8 100755 --- a/module/file/control.php +++ b/module/file/control.php @@ -536,6 +536,28 @@ class file extends control } } + /** + * Query the file. + * + * @param int $fileID + * @param string $objectType + * @param int $objectID + * @param string $title + * @param string $extra + * @param int $stream + * @access public + * @return void + */ + public function ajaxQuery(int $fileID, string $objectType = '', int $objectID = 0, string $title = '', string $extra = '', int $stream = 0) + { + if($fileID) return $this->fetch('file', 'read', "fileID=$fileID&stream=$stream"); + + if(!empty($title)) $title = base64_decode($title); + $file = $this->file->query($objectType, $objectID, $title, $extra); + if(empty($file)) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->fileNotFound, 'load' => helper::createLink('my', 'index'), 'closeModal' => true)); + $fileID = $file->id; + return $this->fetch('file', 'read', "fileID=$fileID&stream=$stream"); + } /** * 关闭升级到企业版提示。 diff --git a/module/upgrade/config/upgradeflow.php b/module/upgrade/config/upgradeflow.php index bc83527b1b..cf593ea6c0 100644 --- a/module/upgrade/config/upgradeflow.php +++ b/module/upgrade/config/upgradeflow.php @@ -103,6 +103,7 @@ $config->upgrade->execFlow['20_3_0'] = array('functions' => 'importBuildinW $config->upgrade->execFlow['20_4'] = array('functions' => 'createDefaultDoclibSpace,updateStoryVerifiedDate,xuanNotifyJitsiConference', 'xxsqls' => "$appRoot/db/upgradexuanxuan7.3.sql,$appRoot/db/upgradexuanxuan9.0.sql"); $config->upgrade->execFlow['20_5'] = array('functions' => 'fixWorkflowFieldOptions'); $config->upgrade->execFlow['20_6'] = array('functions' => 'processDemandFiles,processSqlbuilderTables'); +$config->upgrade->execFlow['20_7'] = array('functions' => 'upgradeMyDocSpace'); if(!empty($config->isINT)) { diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 270ac82400..407aedd891 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -9994,4 +9994,40 @@ class upgradeModel extends model } return !dao::isError(); } + + /** + * Upgrade demand files. + * + * @access public + * @return bool + */ + public function upgradeMyDocSpace() + { + $this->loadModel('doc'); + $this->app->loadLang('doclib'); + + $spacesGroup = $this->dao->select('*')->from(TABLE_DOCLIB) + ->where('deleted')->eq(0) + ->andWhere('vision')->eq($this->config->vision) + ->andWhere('type')->eq('mine') + ->orderBy('`order` asc, id_asc') + ->fetchGroup('addedBy', 'id'); + + foreach($spacesGroup as $account => $spaces) + { + $space = new stdclass(); + $space->type = 'mine'; + $space->vision = 'rnd'; + $space->parent = 0; + $space->name = $this->lang->doclib->defaultSpace; + $space->main = '1'; + $space->acl = 'private'; + $space->addedBy = $account; + $space->addedDate = helper::now(); + $spaceID = $this->doc->doInsertLib($space); + + $this->dao->update(TABLE_DOCLIB)->set('parent')->eq($spaceID)->where('id')->in(array_keys($spaces))->exec(); + $this->dao->update(TABLE_DOCLIB)->set('main')->eq(0)->where('id')->in(array_keys($spaces))->exec(); + } + } }