This commit is contained in:
tianshujie
2022-01-27 10:25:44 +08:00
parent c96da59391
commit 6ca88e549e
2 changed files with 27 additions and 1 deletions
+7 -1
View File
@@ -1668,7 +1668,13 @@ class treeModel extends model
{
$this->dao->update(TABLE_MODULE)->set('root')->eq($module->root)->where('id')->in($childs)->exec();
$this->dao->update(TABLE_MODULE)->set('branch')->eq($module->branch)->where('id')->in($childs)->exec();
if($self->type == 'doc') $this->dao->update(TABLE_DOC)->set('`lib`')->eq($module->root)->where('module')->eq($moduleID)->exec();
if($self->type == 'doc')
{
$this->dao->update(TABLE_DOC)->set('`lib`')->eq($module->root)
->where('module')->eq($moduleID)
->orWhere('module')->in($childs)
->exec();
}
}
$this->fixModulePath(isset($module->root) ? $module->root : $self->root, $self->type);
if(isset($module->root) and $module->root != $self->root) $this->changeRoot($moduleID, $self->root, $module->root, $self->type);
+20
View File
@@ -754,6 +754,7 @@ class upgradeModel extends model
$this->saveLogs('Execute 16_2');
$this->execSQL($this->getUpgradeFile('16.2'));
$this->updateSpaceTeam();
$this->updateDocField();
$this->appendExec('16_2');
}
@@ -5581,4 +5582,23 @@ class upgradeModel extends model
return true;
}
/**
* Document library for updating documents.
*
* @access public
* @return bool
*/
public function updateDocField()
{
$hasModuleDocs = $this->dao->select('*')->from(TABLE_DOC)->where('module')->ne(0)->fetchAll('id');
$docModules = $this->dao->select('*')->from(TABLE_MODULE)->where('type')->eq('doc')->fetchAll('id');
foreach($hasModuleDocs as $doc)
{
$libID = isset($docModules[$doc->module]->root) ? $docModules[$doc->module]->root : 0;
if(!$libID or $libID == $doc->lib) continue;
$this->dao->update(TABLE_DOC)->set('lib')->eq($libID)->where('id')->eq($doc->id)->exec();
}
return true;
}
}