Commit e5b9eaaef06a7283f0e28bd920dc7286b05a7cb4
1 parent
709fde01
Remove out-of-date 'sync' directory.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3338 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
6 changed files
with
0 additions
and
267 deletions
sync/.htaccess deleted
sync/dbSync.php deleted
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | -* Removes all documents/folders that are in the database but are not on the file system | ||
| 5 | -* | ||
| 6 | -* @author Rob Cherry, Jam Warehouse South Africa (Pty) Ltd | ||
| 7 | -* @date 20 February 2003 | ||
| 8 | -* @package sync | ||
| 9 | -* | ||
| 10 | -*/ | ||
| 11 | - | ||
| 12 | -require_once("../config/dmsDefaults.php"); | ||
| 13 | -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | ||
| 14 | -require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | ||
| 15 | - | ||
| 16 | -$aMissingDocuments = array(); | ||
| 17 | -$aMissingFolders = array(); | ||
| 18 | - | ||
| 19 | -$aDocuments = Document::getList(); | ||
| 20 | -$aFolders = Folder::getList(); | ||
| 21 | - | ||
| 22 | -for ($i = 0; $i < count($aFolders); $i++) { | ||
| 23 | - $oFolder = $aFolders[$i]; | ||
| 24 | - checkFolder($oFolder, $fDelete); | ||
| 25 | -} | ||
| 26 | - | ||
| 27 | -for ($i = 0; $i < count($aDocuments); $i++) { | ||
| 28 | - $oDocument = $aDocuments[$i]; | ||
| 29 | - checkDoc($oDocument, $fDelete); | ||
| 30 | -} | ||
| 31 | - | ||
| 32 | -$sToRender = "<html><head></head><body>\n"; | ||
| 33 | -$sToRender .= "The following is a list of documents and folders that are in the database but not on the file system<br>\n"; | ||
| 34 | -$sToRender .= "These folders/documents will have to be recreated/recaptured.<br><br>\n"; | ||
| 35 | -if (isset($fDelete)) { | ||
| 36 | - $sToRender .= "<b>These folders/documents HAVE BEEN DELETED.</b><br><br>\n"; | ||
| 37 | -} else { | ||
| 38 | - $sToRender .= "<b>These folders/documents have NOT BEEN DELETED YET.</b><br><br>\n"; | ||
| 39 | - $sToRender .= "Click on the link entitled 'Deleted' below to delete these documents/folders<br><br>\n"; | ||
| 40 | -} | ||
| 41 | - | ||
| 42 | -$sToRender .= "The following <b>folders</b> must be recreated:<br>\n<ul>\n"; | ||
| 43 | -$sToRender .= "<table>"; | ||
| 44 | -for ($i = 0; $i < count($aMissingFolders); $i++) { | ||
| 45 | - $oFolder = $aMissingFolders[$i]; | ||
| 46 | - $sToRender .= "<tr><td nowrap>" . Folder::getFolderPath($oFolder->getID()) . "</td></tr>\n"; | ||
| 47 | -} | ||
| 48 | -$sToRender .= "</table>"; | ||
| 49 | - | ||
| 50 | -$sToRender .= "<br>The following <b>documents</b> must be recaptured:<br>\n"; | ||
| 51 | -$sToRender .= "<table>"; | ||
| 52 | -for ($i = 0; $i < count($aMissingDocuments); $i++) { | ||
| 53 | - $oDocument = $aMissingDocuments[$i]; | ||
| 54 | - $sToRender .= "<tr><td nowrap>(" . $oDocument->getID() . ", " . $oDocument->getLastModifiedDate() . ") " . Folder::getFolderPath($oDocument->getFolderID()) . $oDocument->getFileName() . "</td></tr>"; | ||
| 55 | -} | ||
| 56 | -$sToRender .= "</table>"; | ||
| 57 | - | ||
| 58 | -$sToRender .= "<br>\n"; | ||
| 59 | -if (!isset($fDelete)) { | ||
| 60 | - $sToRender .= "<a href=\"" . $_SERVER["PHP_SELF"] . "?fDelete=1\">Delete</a>\n"; | ||
| 61 | -} | ||
| 62 | -$sToRender .= "</body></html>"; | ||
| 63 | - | ||
| 64 | -echo $sToRender; | ||
| 65 | - | ||
| 66 | -function checkDoc($oDocument, $bForDelete) { | ||
| 67 | - global $aMissingDocuments; | ||
| 68 | - $sDocPath = Folder::getFolderPath($oDocument->getFolderID()) . $oDocument->getFileName(); | ||
| 69 | - if (file_exists($sDocPath) === false) { | ||
| 70 | - $aMissingDocuments[count($aMissingDocuments)] = $oDocument; | ||
| 71 | - if (isset($bForDelete)) { | ||
| 72 | - $oDocument->delete(); | ||
| 73 | - } | ||
| 74 | - } | ||
| 75 | -} | ||
| 76 | - | ||
| 77 | -function checkFolder($oFolder, $bForDelete) { | ||
| 78 | - global $aMissingFolders; | ||
| 79 | - $sFolderPath = Folder::getFolderPath($oFolder->getID()); | ||
| 80 | - if (file_exists($sFolderPath)) { | ||
| 81 | - return; | ||
| 82 | - } else { | ||
| 83 | - $aMissingFolders[count($aMissingFolders)] = $oFolder; | ||
| 84 | - if (isset($bForDelete)) { | ||
| 85 | - $oFolder->delete(); | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | -} | ||
| 89 | - | ||
| 90 | -?> |
sync/migrateLDAP.php deleted
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * LDAP Migration script. | ||
| 5 | - * For all users in the database, the username is queried in the new directory server | ||
| 6 | - * This DN is then used to create an UPDATE statement to correct the old directory server dns | ||
| 7 | - * in the database. | ||
| 8 | - */ | ||
| 9 | - | ||
| 10 | -require_once("../config/dmsDefaults.php"); | ||
| 11 | - | ||
| 12 | -// first select all users | ||
| 13 | -$aUsers = User::getList(); | ||
| 14 | - | ||
| 15 | -// then initialise the LDAP authenticator with the new directory server address | ||
| 16 | -$sNewLdapServer = "jam001.jamwarehouse.com"; | ||
| 17 | -$sNewLdapDn = "CN=Users,DC=jamwarehouse,DC=com"; | ||
| 18 | -$oLdap = new LDAPAuthenticator($sNewLdapServer, $sNewLdapDn);; | ||
| 19 | -echo "<pre>"; | ||
| 20 | -for ($i=0; $i<count($aUsers); $i++) { | ||
| 21 | - // for each user, lookup the dn based on the username | ||
| 22 | - $oUser = $aUsers[$i]; | ||
| 23 | - $aResults = $oLdap->searchUsers($oUser->getUserName(), array ("dn")); | ||
| 24 | - if (count($aResults) > 1) { | ||
| 25 | - echo "retrieved " . count($aResults) . " matches for username=" . $oUser->getUserName() . ": " . arrayToString($aResults) . "<br>"; | ||
| 26 | - } else if (count($aResults) == 1) { | ||
| 27 | - $sNewDN = $aResults[$oUser->getUserName()]["dn"]; | ||
| 28 | - // echo an update statement that sets the dn to the correct value | ||
| 29 | - echo "UPDATE users SET ldap_dn='" . $sNewDN . "' WHERE id=" . $oUser->getID() . "<br>"; | ||
| 30 | - } | ||
| 31 | -} | ||
| 32 | -echo "Change the configuration file to point to the new directory server-" . $sNewLdapServer; | ||
| 33 | -echo "</pre>"; | ||
| 34 | -?> | ||
| 35 | \ No newline at end of file | 0 | \ No newline at end of file |
sync/pathSync.php deleted
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | -* This page will be used to sync the old documents and folders table entries to the new ones | ||
| 5 | -* This involves: | ||
| 6 | -* o creating the parent_folder_ids and full_path entries for the existing documents that don't have them | ||
| 7 | -* o creating the parent_folder_ids and full_path entries for the existing folders that don't have them | ||
| 8 | -* | ||
| 9 | -* @author Rob Cherry, Jam Warehouse South Africa (Pty) Ltd | ||
| 10 | -* @date 21 February 2003 | ||
| 11 | -* @package sync | ||
| 12 | -*/ | ||
| 13 | - | ||
| 14 | -require_once("../config/dmsDefaults.php"); | ||
| 15 | -require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | ||
| 16 | -require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | ||
| 17 | - | ||
| 18 | - | ||
| 19 | -$aFolders = Folder::getList("parent_folder_ids IS NULL"); | ||
| 20 | -$aDocuments = Document::getList("parent_folder_ids IS NULL"); | ||
| 21 | - | ||
| 22 | -//update the folders | ||
| 23 | -for ($i = 0; $i < count($aFolders); $i++) { | ||
| 24 | - $oFolder = $aFolders[$i]; | ||
| 25 | - echo "Updating folder: " . $oFolder->getName() . "<br>"; | ||
| 26 | - updateFolder($oFolder); | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -echo "<br>"; | ||
| 30 | - | ||
| 31 | -//update the documents | ||
| 32 | -for ($i = 0; $i < count($aDocuments); $i++) { | ||
| 33 | - $oDocument = $aDocuments[$i]; | ||
| 34 | - echo "Updating document: " . $oDocument->getName() . "<br>"; | ||
| 35 | - if (!$oDocument->getCheckedOutUserID()) { | ||
| 36 | - $oDocument->setCheckedOutUserID(-1); | ||
| 37 | - } | ||
| 38 | - $oDocument->update(true); | ||
| 39 | -} | ||
| 40 | - | ||
| 41 | -function updateFolder($oFolder) { | ||
| 42 | - global $default, $lang_err_database, $lang_err_object_key; | ||
| 43 | - $sFullPath = $oFolder->generateFullFolderPath($oFolder->getParentID()); | ||
| 44 | - $sFullPath = substr($sFullPath,1,strlen($sFullPath)); | ||
| 45 | - $sParentIDs = $oFolder->generateParentFolderIDS($oFolder->getParentID()); | ||
| 46 | - $sParentIDs = substr($sParentIDs,1,strlen($sParentIDs)); | ||
| 47 | - | ||
| 48 | - $sql = $default->db; | ||
| 49 | - //root folders won't get anything added to them | ||
| 50 | - if (strlen($sFullPath) > 0) { | ||
| 51 | - $sql->query("UPDATE " . $default->folders_table . " SET " . | ||
| 52 | - "full_path = '" . addslashes($sFullPath) . "', " . | ||
| 53 | - "parent_folder_ids = '" . addslashes($sParentIDs) . "' " . | ||
| 54 | - "WHERE id = " . $oFolder->getID()); | ||
| 55 | - } | ||
| 56 | -} | ||
| 57 | - | ||
| 58 | -?> |
sync/sanitiseEscapedData.php deleted
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * Script to remove escape character from text fields | ||
| 4 | - */ | ||
| 5 | -require_once("../config/dmsDefaults.php"); | ||
| 6 | -$aFields = array( "news" => "synopsis,body", | ||
| 7 | - "dependant_document_instance" => "document_title", | ||
| 8 | - "dependant_document_template" => "document_title", | ||
| 9 | - "documents" => "name,filename,description,full_path", | ||
| 10 | - "discussion_comments" => "subject,body", | ||
| 11 | - "document_fields" => "name", | ||
| 12 | - "document_fields_link" => "value", | ||
| 13 | - "document_transactions" => "comment", | ||
| 14 | - "document_types_lookup" => "name", | ||
| 15 | - "metadata_lookup" => "name", | ||
| 16 | - "folders" => "name,description,full_path", | ||
| 17 | - "groups_lookup" => "name", | ||
| 18 | - "organisations_lookup" => "name", | ||
| 19 | - "roles" => "name", | ||
| 20 | - "units_lookup" => "name", | ||
| 21 | - "users" => "name", | ||
| 22 | - "web_sites" => "web_site_name"); | ||
| 23 | -echo "<pre>"; | ||
| 24 | -foreach ($aFields as $table => $fields) { | ||
| 25 | - $sql = $default->db; | ||
| 26 | - $aFields = explode(",", $fields); | ||
| 27 | - foreach ($aFields as $field) { | ||
| 28 | - // select all escaped fields and ids | ||
| 29 | - $query = "select id, $field from $table where $field like '%\\\\\\%'"; | ||
| 30 | - echo $query . "<br>"; | ||
| 31 | - $sql->query($query); | ||
| 32 | - while ($sql->next_record()) { | ||
| 33 | - // strip field | ||
| 34 | - //$cleanField = stripslashes($sql->f($field)); | ||
| 35 | - echo "found offending field=" . $sql->f($field). "<br>"; | ||
| 36 | - // update it | ||
| 37 | - updateField($table, $sql->f("id"), $field, $sql->f($field)); | ||
| 38 | - } | ||
| 39 | - } | ||
| 40 | -} | ||
| 41 | -echo "</pre>"; | ||
| 42 | - | ||
| 43 | -function updateField($table, $id, $fieldName, $value) { | ||
| 44 | - global $default; | ||
| 45 | - $sql = $default->db; | ||
| 46 | - $query = "update $table set $fieldName='$value' where id=$id"; | ||
| 47 | - if ($sql->query($query)) { | ||
| 48 | - echo "successful "; | ||
| 49 | - } else { | ||
| 50 | - echo "unsuccessful "; | ||
| 51 | - } | ||
| 52 | - echo "update query=$query<br>"; | ||
| 53 | -} | ||
| 54 | -?> | ||
| 55 | \ No newline at end of file | 0 | \ No newline at end of file |
sync/unDecodeComments.php deleted
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * Script to remove urldecode and stripslashes from all comments | ||
| 4 | - */ | ||
| 5 | -require_once("../config/dmsDefaults.php"); | ||
| 6 | -$sql = $default->db; | ||
| 7 | -$query = "select id, body from discussion_comments"; | ||
| 8 | -$sql->query($query); | ||
| 9 | -echo "<pre>"; | ||
| 10 | -while ($sql->next_record()) { | ||
| 11 | - echo "found offending field=" . $sql->f("body") . "<br>"; | ||
| 12 | - // update it | ||
| 13 | - updateField($sql->f("id"), $sql->f("body")); | ||
| 14 | -} | ||
| 15 | -echo "</pre>"; | ||
| 16 | - | ||
| 17 | -function updateField($id, $value) { | ||
| 18 | - global $default; | ||
| 19 | - $sql = $default->db; | ||
| 20 | - $value = urldecode($value); | ||
| 21 | - $query = "update discussion_comments set body='$value' where id=$id"; | ||
| 22 | - if ($sql->query($query)) { | ||
| 23 | - echo "successful "; | ||
| 24 | - } else { | ||
| 25 | - echo "unsuccessful "; | ||
| 26 | - } | ||
| 27 | - echo "update query=$query<br>"; | ||
| 28 | -} | ||
| 29 | -?> | ||
| 30 | \ No newline at end of file | 0 | \ No newline at end of file |