From b9841c14f060d79f42dacd03b5668ca2f2e52648 Mon Sep 17 00:00:00 2001 From: sunhao Date: Thu, 9 Jan 2025 15:23:09 +0800 Subject: [PATCH] * [story #69914] move book lib to default space. --- module/doc/model.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/module/doc/model.php b/module/doc/model.php index 4380688105..60990a5d73 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -900,6 +900,7 @@ class docModel extends model } $modules = array(); + $wikiLibs = array(); foreach($chapters as $chapterID => $chapter) { $module = new stdClass(); @@ -916,6 +917,7 @@ class docModel extends model $moduleID = $this->dao->lastInsertID(); $module->id = $moduleID; $modules[$moduleID] = $module; + $wikiLibs[] = $chapter->lib; $chapter->module = $moduleID; $chapter->parentChapter = isset($chapters[$chapter->parent]) ? $chapters[$chapter->parent] : null; @@ -949,6 +951,19 @@ class docModel extends model $this->dao->update(TABLE_MODULE)->set('path')->eq($module->path)->set('parent')->eq($module->parent)->where('id')->eq($module->id)->exec(); } + + /* Move wiki libs to the migrated wiki space. */ + foreach($wikiLibs as $libID) + { + $this->dao->update(TABLE_DOCLIB) + ->set('parent')->eq($wikiSpace->id) + ->set('type')->eq('custom') + ->where('id')->eq($libID) + ->exec(); + } + + if(dao::isError()) return false; + return true; } /**