check if the folder set by setRootFolderID() actually exists

This commit is contained in:
Uwe Steinmann 2021-09-17 18:24:32 +02:00
parent ffd5cd9a7b
commit 0cd4c9b727

View File

@ -527,13 +527,23 @@ class SeedDMS_Core_DMS {
/**
* Set id of root folder
*
* This function must be called right after creating an instance of
* {@link SeedDMS_Core_DMS}
*
* The new root folder id will only be set if the folder actually
* exists. In that case the old root folder id will be returned.
* If it does not exists, the method will return false;
* @param integer $id id of root folder
* @return boolean/int old root folder id if new root folder exists, otherwise false
*/
function setRootFolderID($id) { /* {{{ */
$this->rootFolderID = $id;
if($this->getFolder($id)) {
$oldid = $this->rootFolderID;
$this->rootFolderID = $id;
return $oldid;
}
return false;
} /* }}} */
/**