add method getWrongFiletypeDocumentContent()

This commit is contained in:
Uwe Steinmann 2020-02-13 12:19:16 +01:00
parent 901fcaef5e
commit efec0c36bf

View File

@ -3567,6 +3567,46 @@ class SeedDMS_Core_DMS {
} /* }}} */
/**
* Returns document content which has the incorrect file type
*
* This method is for finding document content with an incorrect
* or missing file type. It just checks documents contents
* with a certain mime type.
* @return bool|SeedDMS_Core_Document[]
*/
function getWrongFiletypeDocumentContent() { /* {{{ */
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `mimeType` in ('application/pdf', 'image/png', 'image/gif', 'image/jpg')";
$resArr = $this->db->getResultArray($queryStr);
if ($resArr === false)
return false;
/** @var SeedDMS_Core_Document[] $versions */
$versions = array();
foreach($resArr as $row) {
$expect = '';
switch($row['mimeType']) {
case "application/pdf":
case "image/png":
case "image/gif":
case "image/jpg":
$expect = substr($row['mimeType'], -3, 3);
break;
}
if($expect) {
if($row['fileType'] != '.'.$expect) {
/** @var SeedDMS_Core_Document $document */
$document = new $this->classnames['document']($row['document'], '', '', '', '', '', '', '', '', '', '', '');
$document->setDMS($this);
$version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']);
$versions[] = $version;
}
}
}
return $versions;
} /* }}} */
/**
* Returns document content which is duplicated
*