run check only if required

speeds up calling a single check
This commit is contained in:
Uwe Steinmann 2017-08-03 07:12:03 +02:00
parent d82f8c44d1
commit 94a4844616

View File

@ -66,18 +66,36 @@ if(isset($_GET['setchecksum']) && $_GET['setchecksum'] == 1) {
$folder = $dms->getFolder($settings->_rootFolderID);
$unlinkedversions = $dms->getUnlinkedDocumentContent();
$unlinkedfolders = $dms->checkFolders();
$unlinkeddocuments = $dms->checkDocuments();
$nofilesizeversions = $dms->getNoFileSizeDocumentContent();
$nochecksumversions = $dms->getNoChecksumDocumentContent();
$duplicateversions = $dms->getDuplicateDocumentContent();
foreach(array('review', 'approval') as $process) {
if(!isset($_GET['action']) || $_GET['action'] == 'listUnlinkedFolders')) {
$unlinkedfolders = $dms->checkFolders();
else
$unlinkedfolders = null;
if(!isset($_GET['action']) || $_GET['action'] == 'listUnlinkedDocuments')) {
$unlinkeddocuments = $dms->checkDocuments();
else
$unlinkeddocuments = null;
if(!isset($_GET['action']) || $_GET['action'] == 'listMissingFileSize')) {
$nofilesizeversions = $dms->getNoFileSizeDocumentContent();
else
$nofilesizeversions = null;
if(!isset($_GET['action']) || $_GET['action'] == 'listMissingChecksum')) {
$nochecksumversions = $dms->getNoChecksumDocumentContent();
else
$nochecksumversions = null;
if(!isset($_GET['action']) || $_GET['action'] == 'listDuplicateContent')) {
$duplicateversions = $dms->getDuplicateDocumentContent();
else
$duplicateversions = null;
foreach(array('review', 'approval', 'receipt', 'revision') as $process) {
foreach(array('user', 'group') as $ug) {
$processwithoutusergroup[$process][$ug] = $dms->getProcessWithoutUserGroup($process, $ug);
if(!isset($_GET['action']) || $_GET['action'] == 'list'.ucfirst($process).'Without'.ucfirst($ug)) {
$processwithoutusergroup[$process][$ug] = $dms->getProcessWithoutUserGroup($process, $ug);
}
}
}
$tmprevs = $dms->getDocumentsInRevision();
$docsinrevision = array();
if(!isset($_GET['action']) || $_GET['action'] == 'listDocsInRevisionNoAccess') {
$tmprevs = $dms->getDocumentsInRevision();
foreach($tmprevs as $rev) {
if($doc = $dms->getDocument($rev['documentID'])) {
$isdisabled = false;
@ -99,8 +117,11 @@ foreach($tmprevs as $rev) {
$docsinrevision[] = $doc;
}
}
$tmprevs = $dms->getDocumentsInReception();
}
$docsinreception = array();
if(!isset($_GET['action']) || $_GET['action'] == 'listDocsInReceptionNoAccess') {
$tmprevs = $dms->getDocumentsInReception();
foreach($tmprevs as $rev) {
if($doc = $dms->getDocument($rev['documentID'])) {
$isdisabled = false;
@ -122,6 +143,8 @@ foreach($tmprevs as $rev) {
$docsinreception[] = $doc;
}
}
}
$rootfolder = $dms->getFolder($settings->_rootFolderID);
function repair_tree($dms, $user, $folder, $path=':') { /* {{{ */
@ -173,7 +196,10 @@ function repair_tree($dms, $user, $folder, $path=':') { /* {{{ */
return $objects;
} /* }}} */
$repairobjects = repair_tree($dms, $user, $folder);
if(!isset($_GET['action']) || $_GET['action'] == 'listRepair')
$repairobjects = repair_tree($dms, $user, $folder);
else
$repairobjects = null;
if($view) {
$view->setParam('folder', $folder);