fileSystemRoot/lib/documentmanagement/Document.inc"); require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); $aMissingDocuments = array(); $aMissingFolders = array(); $aDocuments = Document::getList(); $aFolders = Folder::getList(); for ($i = 0; $i < count($aFolders); $i++) { $oFolder = $aFolders[$i]; checkFolder($oFolder, $fDelete); } for ($i = 0; $i < count($aDocuments); $i++) { $oDocument = $aDocuments[$i]; checkDoc($oDocument, $fDelete); } $sToRender = "\n"; $sToRender .= "The following is a list of documents and folders that are in the database but not on the file system
\n"; $sToRender .= "These folders/documents will have to be recreated/recaptured.

\n"; if (isset($fDelete)) { $sToRender .= "These folders/documents HAVE BEEN DELETED.

\n"; } else { $sToRender .= "These folders/documents have NOT BEEN DELETED YET.

\n"; $sToRender .= "Click on the link entitled 'Deleted' below to delete these documents/folders

\n"; } $sToRender .= "The following folders must be recreated:
\n
The following documents must be recaptured:
\n
\n"; if (!isset($fDelete)) { $sToRender .= "Delete\n"; } $sToRender .= ""; echo $sToRender; function checkDoc($oDocument, $bForDelete) { global $aMissingDocuments; $sDocPath = Folder::getFolderPath($oDocument->getFolderID()) . $oDocument->getFileName(); if (file_exists($sDocPath) === false) { $aMissingDocuments[count($aMissingDocuments)] = $oDocument; if (isset($bForDelete)) { $oDocument->delete(); } } } function checkFolder($oFolder, $bForDelete) { global $aMissingFolders; $sFolderPath = Folder::getFolderPath($oFolder->getID()); if (file_exists($sFolderPath)) { return; } else { $aMissingFolders[count($aMissingFolders)] = $oFolder; if (isset($bForDelete)) { $oFolder->delete(); } } } ?>