mirror of
				https://git.code.sf.net/p/seeddms/code
				synced 2025-10-31 13:18:06 +00:00 
			
		
		
		
	take out old function tree(), fix listing missing checksums
This commit is contained in:
		
							parent
							
								
									cf3dba89e0
								
							
						
					
					
						commit
						f4648a7023
					
				|  | @ -85,211 +85,6 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Bootstrap_Style { | |||
| 		} | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	function _tree($dms, $user, $folder, $path=':') { /* {{{ */ | ||||
| 
 | ||||
| 		$objects = array(); | ||||
| 
 | ||||
| 		/* Don't do folderlist check for root folder */ | ||||
| 		if($path != ':') { | ||||
| 			/* If the path contains a folder id twice, the a cyclic relation | ||||
| 			 * exists. | ||||
| 			 */ | ||||
| 			$tmparr = explode(':', $path); | ||||
| 			array_shift($tmparr); | ||||
| 			if(count($tmparr) != count(array_unique($tmparr))) { | ||||
| 				$objects[] = array('object'=>$folder, 'msg'=>'Folder path contains cyclic relation'); | ||||
| 			} | ||||
| 			$folderList = $folder->getFolderList(); | ||||
| 			/* Check the folder */ | ||||
| 			if($folderList != $path) { | ||||
| 				$objects[] = array('object'=>$folder, 'msg'=>"Folderlist is '".$folderList."', should be '".$path); | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		$subfolders = $folder->getSubFolders(); | ||||
| 		foreach($subfolders as $subfolder) { | ||||
| 			$objects = array_merge($objects, $this->_tree($dms, $user, $subfolder, $path.$folder->getId().':')); | ||||
| 		} | ||||
| 		$path .= $folder->getId().':'; | ||||
| 		$documents = $folder->getDocuments(); | ||||
| 		foreach($documents as $document) { | ||||
| 			/* Check the folder list of the document */ | ||||
| 			$folderList = $document->getFolderList(); | ||||
| 			if($folderList != $path) { | ||||
| 				$objects[] = array('object'=>$document, 'msg'=>"Folderlist is '".$folderList."', should be '".$path); | ||||
| 			} | ||||
| 
 | ||||
| 			/* Check if the content is available */ | ||||
| 			$versions = $document->getContent(); | ||||
| 			if($versions) { | ||||
| 				foreach($versions as $version) { | ||||
| 					$filepath = $dms->contentDir . $version->getPath(); | ||||
| 					if(!file_exists($filepath)) { | ||||
| 						$objects[] = array('object'=>$version, 'msg'=>'Document content is missing'); | ||||
| 					} | ||||
| 				} | ||||
| 			} else { | ||||
| 				$objects[] = array('object'=>$version, 'msg'=>'Document has no content at all'); | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		return $objects; | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	function tree($dms, $folder, $repair, $path=':', $indent='') { /* {{{ */ | ||||
| 		global $user; | ||||
| 
 | ||||
| 		/* Don't do folderlist check for root folder */ | ||||
| 		if($path != ':') { | ||||
| 			/* If the path contains a folder id twice, the a cyclic relation | ||||
| 			 * exists. | ||||
| 			 */ | ||||
| 			$tmparr = explode(':', $path); | ||||
| 			array_shift($tmparr); | ||||
| 			if(count($tmparr) != count(array_unique($tmparr))) { | ||||
| 				print "<tr>\n"; | ||||
| 				print "<td><a class=\"standardText\" href=\"../out/out.ViewFolder.php?folderid=".$folder->getID()."\"><img src=\"../out/images/folder_closed.gif\" width=18 height=18 border=0></a></td>"; | ||||
| 				print "<td><a class=\"standardText\" href=\"../out/out.ViewFolder.php?folderid=".$folder->getID()."\">"; | ||||
| 				print htmlspecialchars($path); | ||||
| 				print "</a></td>"; | ||||
| 				 | ||||
| 				$owner = $folder->getOwner(); | ||||
| 				print "<td>".htmlspecialchars($owner->getFullName())."</td>"; | ||||
| 				print "<td>Folder path contains cyclic relation</td>"; | ||||
| 				if($repair) { | ||||
| 					print "<td><span class=\"success\">".getMLText('repaired')."</span></td>\n"; | ||||
| 				} else { | ||||
| 					print "<td></td>\n"; | ||||
| 				} | ||||
| 				print "</tr>\n"; | ||||
| 			} | ||||
| 			$folderList = $folder->getFolderList(); | ||||
| 			/* Check the folder */ | ||||
| 			if($folderList != $path) { | ||||
| 				print "<tr>\n"; | ||||
| 				$this->needsrepair = true; | ||||
| 				print "<td><a class=\"standardText\" href=\"../out/out.ViewFolder.php?folderid=".$folder->getID()."\"><img src=\"../out/images/folder_closed.gif\" width=18 height=18 border=0></a></td>"; | ||||
| 				print "<td><a class=\"standardText\" href=\"../out/out.ViewFolder.php?folderid=".$folder->getID()."\">"; | ||||
| 				$tmppath = $folder->getPath(); | ||||
| 				for ($i = 1; $i  < count($tmppath); $i++) { | ||||
| 					print "/".htmlspecialchars($tmppath[$i]->getName()); | ||||
| 				} | ||||
| 				print "</a></td>"; | ||||
| 				 | ||||
| 				$owner = $folder->getOwner(); | ||||
| 				print "<td>".htmlspecialchars($owner->getFullName())."</td>"; | ||||
| 				print "<td>Folderlist is '".$folderList."', should be '".$path."'</td>"; | ||||
| 				if($repair) { | ||||
| 					$folder->repair(); | ||||
| 					print "<td><span class=\"success\">".getMLText('repaired')."</span></td>\n"; | ||||
| 				} else { | ||||
| 					print "<td></td>\n"; | ||||
| 				} | ||||
| 				print "</tr>\n"; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		$subfolders = $folder->getSubFolders(); | ||||
| 		foreach($subfolders as $subfolder) { | ||||
| 			$this->tree($dms, $subfolder, $repair, $path.$folder->getId().':', $indent.'  '); | ||||
| 		} | ||||
| 		$path .= $folder->getId().':'; | ||||
| 		$documents = $folder->getDocuments(); | ||||
| 		foreach($documents as $document) { | ||||
| 			/* Check the folder list of the document */ | ||||
| 			$folderList = $document->getFolderList(); | ||||
| 			if($folderList != $path) { | ||||
| 				print "<tr>\n"; | ||||
| 				$this->needsrepair = true; | ||||
| 				$lc = $document->getLatestContent(); | ||||
| 				print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\"><img class=\"mimeicon\" src=\"../out/images/icons/".$this->getMimeIcon($lc->getFileType())."\" title=\"".$lc->getMimeType()."\"></a></td>"; | ||||
| 				print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\">/"; | ||||
| 				$folder = $document->getFolder(); | ||||
| 				$tmppath = $folder->getPath(); | ||||
| 				for ($i = 1; $i  < count($tmppath); $i++) { | ||||
| 					print htmlspecialchars($tmppath[$i]->getName())."/"; | ||||
| 				} | ||||
| 				print htmlspecialchars($document->getName()); | ||||
| 				print "</a></td>"; | ||||
| 				$owner = $document->getOwner(); | ||||
| 				print "<td>".htmlspecialchars($owner->getFullName())."</td>"; | ||||
| 				print "<td>Folderlist is '".$folderList."', should be '".$path."'</td>"; | ||||
| 				if($repair) { | ||||
| 					$document->repair(); | ||||
| 					print "<td><span class=\"success\">".getMLText('repaired')."</span></td>\n"; | ||||
| 				} else { | ||||
| 					print "<td></td>\n"; | ||||
| 				} | ||||
| 				print "</tr>\n"; | ||||
| 			} | ||||
| 
 | ||||
| 			/* Check if the content is available */ | ||||
| 			$versions = $document->getContent(); | ||||
| 			if($versions) { | ||||
| 				foreach($versions as $version) { | ||||
| 					$filepath = $dms->contentDir . $version->getPath(); | ||||
| 					if(!file_exists($filepath)) { | ||||
| 					print "<tr>\n"; | ||||
| 					print "<tr id=\"table-row-document-".$document->getID()."\" class=\"table-row-document\" rel=\"document_".$document->getID()."\" formtoken=\"".createFormKey('movedocument')."\" draggable=\"true\">"; | ||||
| 					print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\"><img class=\"mimeicon\" src=\"".$this->getMimeIcon($version->getFileType())."\" title=\"".$version->getMimeType()."\"></a></td>"; | ||||
| 					print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\">/"; | ||||
| 					$folder = $document->getFolder(); | ||||
| 					$tmppath = $folder->getPath(); | ||||
| 					for ($i = 1; $i  < count($tmppath); $i++) { | ||||
| 						print htmlspecialchars($tmppath[$i]->getName())."/"; | ||||
| 					} | ||||
| 					print htmlspecialchars($document->getName()); | ||||
| 					print "</a></td>"; | ||||
| 					$owner = $document->getOwner(); | ||||
| 					print "<td>".htmlspecialchars($owner->getFullName())."</td>"; | ||||
| 					print "<td>Document content of version ".$version->getVersion()." is missing ('".$path."')</td>"; | ||||
| 					if($repair) { | ||||
| 						print "<td><span class=\"warning\">Cannot repaired</span></td>\n"; | ||||
| 					} else { | ||||
| 						print "<td></td>\n"; | ||||
| 					} | ||||
| 					echo "<td>"; | ||||
| 					echo "<div class=\"list-action\">"; | ||||
| 			if($document->getAccessMode($user) >= M_ALL) { | ||||
| 				echo $this->printDeleteDocumentButton($document, 'splash_rm_document', true); | ||||
| 			} else { | ||||
| 				echo '<span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span>'; | ||||
| 			} | ||||
| 			if($document->getAccessMode($user) >= M_READWRITE) { | ||||
| 				print '<a href="../out/out.EditDocument.php?documentid='.$document->getID().'" title="'.getMLText("edit_document_props").'"><i class="icon-edit"></i></a>'; | ||||
| 			} else { | ||||
| 				print '<span style="padding: 2px; color: #CCC;"><i class="icon-edit"></i></span>'; | ||||
| 			} | ||||
| 			if($document->getAccessMode($user) >= M_READWRITE) { | ||||
| 				print $this->printLockButton($document, 'splash_document_locked', 'splash_document_unlocked', true); | ||||
| 			} | ||||
| 			if($this->enableClipboard) { | ||||
| 				print '<a class="addtoclipboard" rel="D'.$document->getID().'" msg="'.getMLText('splash_added_to_clipboard').'" title="'.getMLText("add_to_clipboard").'"><i class="icon-copy"></i></a>'; | ||||
| 			} | ||||
| 					echo "</div>"; | ||||
| 					echo "</td>"; | ||||
| 					print "</tr>\n"; | ||||
| 					} | ||||
| 				} | ||||
| 			} else { | ||||
| 				print "<tr>\n"; | ||||
| 				print "<td></td>\n"; | ||||
| 				print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\">/"; | ||||
| 				$folder = $document->getFolder(); | ||||
| 				$tmppath = $folder->getPath(); | ||||
| 				for ($i = 1; $i  < count($tmppath); $i++) { | ||||
| 					print htmlspecialchars($tmppath[$i]->getName())."/"; | ||||
| 				} | ||||
| 				print htmlspecialchars($document->getName()); | ||||
| 				print "</a></td>"; | ||||
| 				$owner = $document->getOwner(); | ||||
| 				print "<td>".htmlspecialchars($owner->getFullName())."</td>"; | ||||
| 				print "<td>Document has no content! Delete the document manually.</td>"; | ||||
| 				print "</tr>\n"; | ||||
| 			} | ||||
| 		} | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	function listRepair() { /* {{{ */ | ||||
| 		$dms = $this->params['dms']; | ||||
| 		$user = $this->params['user']; | ||||
|  | @ -614,7 +409,7 @@ $(document).ready( function() { | |||
| 		echo '<li class=""><a data-href="#unlinked_documents" data-action="listUnlinkedDocuments"><span class="badge '.($unlinkeddocuments ? 'badge-info ' : '').'badge-right">'.count($unlinkeddocuments).'</span>'.getMLText("unlinked_documents").'</a></li>'; | ||||
| 		echo '<li class=""><a data-href="#unlinked_content" data-action="listUnlinkedContent"><span class="badge '.($unlinkedcontent ? 'badge-info ' : '').'badge-right">'.count($unlinkedcontent).'</span>'.getMLText("unlinked_content").'</a></li>'; | ||||
| 		echo '<li class=""><a data-href="#missing_filesize" data-action="listMissingFileSize"><span class="badge '.($nofilesizeversions ? 'badge-info ' : '').'badge-right">'.count($nofilesizeversions).'</span>'.getMLText("missing_filesize").'</a></li>'; | ||||
| 		echo '<li class=""><a data-href="#missing_checksum" data-action="listMissingFileSize"><span class="badge '.($nochecksumversions ? 'badge-info ' : '').'badge-right">'.count($nochecksumversions).'</span>'.getMLText("missing_checksum").'</a></li>'; | ||||
| 		echo '<li class=""><a data-href="#missing_checksum" data-action="listMissingChecksum"><span class="badge '.($nochecksumversions ? 'badge-info ' : '').'badge-right">'.count($nochecksumversions).'</span>'.getMLText("missing_checksum").'</a></li>'; | ||||
| 		echo '</ul>'; | ||||
| 		$this->contentHeading(getMLText("object_check_warning")); | ||||
| 		echo '<ul class="nav nav-list bs-docs-sidenav _affix">'; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann