Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2021-01-08 12:00:36 +01:00
commit 5a30032375
8 changed files with 102 additions and 15 deletions

View File

@ -1,3 +1,7 @@
--------------------------------------------------------------------------------
Changes in version 6.0.15
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Changes in version 6.0.14
--------------------------------------------------------------------------------
@ -181,6 +185,12 @@
- add document list which can be exported as an archive
- search results can be exported
--------------------------------------------------------------------------------
Changes in version 5.1.22
--------------------------------------------------------------------------------
- remove document/folder from index before adding a new one after editing the
meta data
--------------------------------------------------------------------------------
Changes in version 5.1.21
--------------------------------------------------------------------------------

View File

@ -128,10 +128,10 @@ class SeedDMS_Core_DatabaseAccess {
function TableList() { /* {{{ */
switch($this->_driver) {
case 'mysql':
$sql = "select TABLE_NAME as name from information_schema.tables where TABLE_SCHEMA='".$this->_database."' and TABLE_TYPE='BASE TABLE'";
$sql = "SELECT `TABLE_NAME` AS `name` FROM `information_schema`.`tables` WHERE `TABLE_SCHEMA`='".$this->_database."' AND `TABLE_TYPE`='BASE TABLE'";
break;
case 'sqlite':
$sql = "select tbl_name as name from sqlite_master where type='table'";
$sql = "SELECT tbl_name AS name FROM sqlite_master WHERE type='table'";
break;
case 'pgsql':
$sql = "select tablename as name from pg_catalog.pg_tables where schemaname='public'";
@ -146,6 +146,33 @@ class SeedDMS_Core_DatabaseAccess {
return $res;
} /* }}} */
/**
* Check if database has a table
*
* This function will check if the database has a table with the given table name
*
* @return bool true if table exists, otherwise false
*/
function hasTable($name) { /* {{{ */
switch($this->_driver) {
case 'mysql':
$sql = "SELECT `TABLE_NAME` AS `name` FROM `information_schema`.`tables` WHERE `TABLE_SCHEMA`='".$this->_database."' AND `TABLE_TYPE`='BASE TABLE' AND `TABLE_NAME`=".$this->qstr($name);
break;
case 'sqlite':
$sql = "SELECT tbl_name AS name FROM sqlite_master WHERE type='table' AND `tbl_name`=".$this->qstr($name);
break;
case 'pgsql':
$sql = "SELECT tablename AS name FROM pg_catalog.pg_tables WHERE schemaname='public' AND tablename=".$this->qstr($name);
break;
default:
return false;
}
$arr = $this->getResultArray($sql);
if($arr)
return true;
return false;
} /* }}} */
/**
* Return list of all database views
*

View File

@ -12,11 +12,11 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2020-09-29</date>
<date>2021-01-08</date>
<time>13:44:55</time>
<version>
<release>6.0.14</release>
<api>6.0.14</api>
<release>6.0.15</release>
<api>6.0.15</api>
</version>
<stability>
<release>stable</release>
@ -24,7 +24,7 @@
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
better error checking in SeedDMS_Core_Document::cancelCheckOut()
???
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">
@ -1862,6 +1862,22 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
- check if attribute definition exists when setting attributes of folders and documents
</notes>
</release>
<release>
<date>2021-01-08</date>
<time>13:44:55</time>
<version>
<release>5.1.22</release>
<api>5.1.22</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
- add SeedDMS_Core_DatabaseAccess::hasTable()
</notes>
</release>
<release>
<date>2017-02-28</date>
<time>06:34:50</time>
@ -2127,5 +2143,21 @@ SeedDMS_Core_DMS::filterAccess() properly checks for documents
- SeedDMS_Folder_DMS::getAccessList() and getDefaultAccess() do not return fals anymore if the parent does not exists. They just stop inheritance.
</notes>
</release>
<release>
<date>2021-01-04</date>
<time>13:44:55</time>
<version>
<release>6.0.14</release>
<api>6.0.14</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
better error checking in SeedDMS_Core_Document::cancelCheckOut()
</release>
</notes>
</changelog>
</package>

View File

@ -165,6 +165,10 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
if($fulltextservice && ($index = $fulltextservice->Indexer()) && $document) {
$idoc = $fulltextservice->IndexedDocument($document);
if(false !== $this->callHook('preIndexDocument', $document, $idoc)) {
$lucenesearch = $fulltextservice->Search();
if($hit = $lucenesearch->getDocument((int) $document->getId())) {
$index->delete($hit->id);
}
$index->addDocument($idoc);
$index->commit();
}

View File

@ -93,6 +93,10 @@ class SeedDMS_Controller_EditFolder extends SeedDMS_Controller_Common {
if($fulltextservice && ($index = $fulltextservice->Indexer()) && $folder) {
$idoc = $fulltextservice->IndexedDocument($folder);
if(false !== $this->callHook('preIndexFolder', $folder, $idoc)) {
$lucenesearch = $fulltextservice->Search();
if($hit = $lucenesearch->getFolder((int) $folder->getId())) {
$index->delete($hit->id);
}
$index->addDocument($idoc);
$index->commit();
}

View File

@ -94,12 +94,12 @@ class SeedDMS_Controller_UpdateDocument extends SeedDMS_Controller_Common {
}
if($fulltextservice && ($index = $fulltextservice->Indexer()) && $content) {
$idoc = $fulltextservice->IndexedDocument($document);
if(false !== $this->callHook('preIndexDocument', $document, $idoc)) {
$lucenesearch = $fulltextservice->Search();
if($hit = $lucenesearch->getDocument((int) $document->getId())) {
$index->delete($hit->id);
}
$idoc = $fulltextservice->IndexedDocument($document);
if(false !== $this->callHook('preIndexDocument', $document, $idoc)) {
$index->addDocument($idoc);
$index->commit();
}

View File

@ -65,12 +65,22 @@ class SeedDMS_FulltextService {
$this->cmdtimeout = $timeout;
}
public function IndexedDocument($document, $forceupdate=false) {
if($document->isType('document'))
$nocontent = ($document->getLatestContent()->getFileSize() > $this->maxsize) && !$forceupdate;
/**
* Return an indexable document from the given document or folder
*
* @param SeedDMS_Core_Document|SeedDMS_Core_Folder $object document or folder
* to be indexed
* @param boolean $forceupdate set to true if the document shall be updated no
* matter how large the content is. Setting this to false will only update the
* document if its content is below the configured size.
* @return object indexed Document ready for passing to the indexer
*/
public function IndexedDocument($object, $forceupdate=false) {
if($object->isType('document'))
$nocontent = ($object->getLatestContent()->getFileSize() > $this->maxsize) && !$forceupdate;
else
$nocontent = true;
return new $this->services[0]['IndexedDocument']($document->getDMS(), $document, $this->converters, $nocontent, $this->cmdtimeout);
return new $this->services[0]['IndexedDocument']($object->getDMS(), $object, $this->converters, $nocontent, $this->cmdtimeout);
}
/**

View File

@ -20,7 +20,7 @@
class SeedDMS_Version { /* {{{ */
const _number = "6.0.14";
const _number = "6.0.15";
const _string = "SeedDMS";
function __construct() {