Commit ef588f5259dcc81756764dd21887caf7ad854c60

Authored by bshuttle
1 parent 1ffdbf69

- massive document-legact reorg by nbm.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4622 c91229c3-7414-0410-bfa2-8a42b809f60b
.htaccess
@@ -48,11 +48,11 @@ Options none @@ -48,11 +48,11 @@ Options none
48 # malicious users to use up resources. 48 # malicious users to use up resources.
49 # 49 #
50 <IfModule mod_php4.c> 50 <IfModule mod_php4.c>
51 -php_value upload_max_filesize 16M  
52 -php_value post_max_size 16M  
53 -php_value memory_limit 16M 51 +php_value upload_max_filesize 32M
  52 +php_value post_max_size 32M
  53 +php_value memory_limit 32M
54 php_value max_input_time -1 54 php_value max_input_time -1
55 -php_value max_execution_time 60 55 +php_value max_execution_time 90
56 </IfModule> 56 </IfModule>
57 57
58 #<IfModule mod_negotiation.c> 58 #<IfModule mod_negotiation.c>
config/dmsDefaults.php
@@ -412,6 +412,9 @@ require_once(KT_LIB_DIR . &#39;/session/Session.inc&#39;); @@ -412,6 +412,9 @@ require_once(KT_LIB_DIR . &#39;/session/Session.inc&#39;);
412 require_once(KT_LIB_DIR . '/session/control.inc'); 412 require_once(KT_LIB_DIR . '/session/control.inc');
413 413
414 require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php'); 414 require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php');
415 -KTPluginUtil::loadPlugins(); 415 +
  416 +if ($checkup !== true) {
  417 + KTPluginUtil::loadPlugins();
  418 +}
416 419
417 ?> 420 ?>
config/tableMappings.inc
@@ -144,4 +144,6 @@ $default-&gt;authentication_sources_table = &quot;authentication_sources&quot;; @@ -144,4 +144,6 @@ $default-&gt;authentication_sources_table = &quot;authentication_sources&quot;;
144 $default->dashlet_disable_table = "dashlet_disables"; 144 $default->dashlet_disable_table = "dashlet_disables";
145 $default->role_allocations_table = "role_allocations"; 145 $default->role_allocations_table = "role_allocations";
146 $default->plugins_table = "plugins"; 146 $default->plugins_table = "plugins";
  147 +$default->document_metadata_version_table = "document_metadata_version";
  148 +$default->document_content_version_table = "document_content_version";
147 ?> 149 ?>
docs/VERSION.txt
1 -2.99.6-20050113-1 1 +2.99.6-20050120-8
edit.php
@@ -133,7 +133,7 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher { @@ -133,7 +133,7 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher {
133 $document_data["document"] =& $this->oDocument; 133 $document_data["document"] =& $this->oDocument;
134 134
135 // we want to grab all the md for this doc, since its faster that way. 135 // we want to grab all the md for this doc, since its faster that way.
136 - $mdlist =& DocumentFieldLink::getList(array('document_id = ?', array($document_id))); 136 + $mdlist =& DocumentFieldLink::getByDocument($document_id);
137 137
138 $field_values = array(); 138 $field_values = array();
139 foreach ($mdlist as $oFieldLink) { 139 foreach ($mdlist as $oFieldLink) {
@@ -199,7 +199,7 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher { @@ -199,7 +199,7 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher {
199 // erk. we need all the items that the document _does_ need, _and_ what they have, 199 // erk. we need all the items that the document _does_ need, _and_ what they have,
200 // _and_ what they don't ... 200 // _and_ what they don't ...
201 // we want to grab all the md for this doc, since its faster that way. 201 // we want to grab all the md for this doc, since its faster that way.
202 - $current_md =& DocumentFieldLink::getList(array('document_id = ?', array($document_id))); 202 + $current_md =& DocumentFieldLink::getByDocument($document_id);
203 203
204 // to get all fields, we merge repeatedly from KTFieldset::get 204 // to get all fields, we merge repeatedly from KTFieldset::get
205 205
@@ -257,7 +257,7 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher { @@ -257,7 +257,7 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher {
257 //return '<pre>' . print_r($field_values, true) . '</pre>'; 257 //return '<pre>' . print_r($field_values, true) . '</pre>';
258 $this->startTransaction(); 258 $this->startTransaction();
259 259
260 - $res = KTDocumentUtil::createMetadataVersion($oDocument); 260 + $oDocument->startNewMetadataVersion();
261 if (PEAR::isError($res)) { 261 if (PEAR::isError($res)) {
262 $this->errorRedirectToMain('Unable to create a metadata version of the document.'); 262 $this->errorRedirectToMain('Unable to create a metadata version of the document.');
263 } 263 }
@@ -265,7 +265,6 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher { @@ -265,7 +265,6 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher {
265 $oDocument->setName($title); 265 $oDocument->setName($title);
266 $oDocument->setLastModifiedDate(getCurrentDateTime()); 266 $oDocument->setLastModifiedDate(getCurrentDateTime());
267 $oDocument->setModifiedUserId($this->oUser->getId()); 267 $oDocument->setModifiedUserId($this->oUser->getId());
268 - $oDocument->setMetadataVersion($oDocument->getMetadataVersion() + 1);  
269 $oDocumentTransaction = & new DocumentTransaction($oDocument, 'update metadata.', 'ktcore.transactions.update'); 268 $oDocumentTransaction = & new DocumentTransaction($oDocument, 'update metadata.', 'ktcore.transactions.update');
270 269
271 $res = $oDocumentTransaction->create(); 270 $res = $oDocumentTransaction->create();
@@ -280,6 +279,8 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher { @@ -280,6 +279,8 @@ class KTEditDocumentDispatcher extends KTStandardDispatcher {
280 $res = KTDocumentUtil::saveMetadata($oDocument, $field_values); 279 $res = KTDocumentUtil::saveMetadata($oDocument, $field_values);
281 280
282 if (PEAR::isError($res)) { 281 if (PEAR::isError($res)) {
  282 + var_dump($res);
  283 + exit(0);
283 $this->rollbackTransaction(); 284 $this->rollbackTransaction();
284 285
285 // right. we're rolled out. now we want to regenerate the page, + errors. 286 // right. we're rolled out. now we want to regenerate the page, + errors.
lib/browse/DocumentCollection.inc.php
@@ -57,7 +57,7 @@ class DocumentCollection { @@ -57,7 +57,7 @@ class DocumentCollection {
57 // FIXME affect the column based on this. 57 // FIXME affect the column based on this.
58 58
59 // defaults 59 // defaults
60 - $this->_sDocumentSortField = "D.name"; 60 + $this->_sDocumentSortField = "DM.name";
61 $this->_sFolderSortField = "F.name"; 61 $this->_sFolderSortField = "F.name";
62 62
63 // then we start. 63 // then we start.
@@ -145,9 +145,7 @@ class DocumentCollection { @@ -145,9 +145,7 @@ class DocumentCollection {
145 $this->activeset = array( 145 $this->activeset = array(
146 "folders" => $folderSet, 146 "folders" => $folderSet,
147 "documents" => $documentSet, 147 "documents" => $documentSet,
148 - );  
149 -  
150 - 148 + );
151 } 149 }
152 150
153 // stub: fetch all relevant information about a document (that will reasonably be fetched). 151 // stub: fetch all relevant information about a document (that will reasonably be fetched).
lib/browse/PartialQuery.inc.php
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 11
12 require_once(KT_LIB_DIR . "/util/ktutil.inc"); 12 require_once(KT_LIB_DIR . "/util/ktutil.inc");
13 require_once(KT_LIB_DIR . "/database/dbutil.inc"); 13 require_once(KT_LIB_DIR . "/database/dbutil.inc");
  14 +require_once(KT_LIB_DIR . "/search/searchutil.inc.php");
14 15
15 // Abstract base class. 16 // Abstract base class.
16 class PartialQuery { 17 class PartialQuery {
@@ -80,7 +81,14 @@ class BrowseQuery extends PartialQuery{ @@ -80,7 +81,14 @@ class BrowseQuery extends PartialQuery{
80 81
81 $sSelect = KTUtil::arrayGet($aOptions, 'select', 'D.id'); 82 $sSelect = KTUtil::arrayGet($aOptions, 'select', 'D.id');
82 83
83 - $sQuery = "SELECT $sSelect FROM " . KTUtil::getTableName("documents") . " AS D $sPermissionJoin $sWhere "; 84 + $sQuery = sprintf("SELECT %s FROM %s AS D
  85 + LEFT JOIN %s AS DM ON D.metadata_version_id = DM.id
  86 + LEFT JOIN %s AS DC ON DM.content_version_id = DC.id
  87 + %s %s",
  88 + $sSelect, KTUtil::getTableName("documents"),
  89 + KTUtil::getTableName("document_metadata_version"),
  90 + KTUtil::getTableName("document_content_version"),
  91 + $sPermissionJoin, $sWhere);
84 $aParams = array(); 92 $aParams = array();
85 $aParams = array_merge($aParams, $aPermissionParams); 93 $aParams = array_merge($aParams, $aPermissionParams);
86 $aParams[] = $this->folder_id; 94 $aParams[] = $this->folder_id;
lib/database/dbutil.inc
@@ -50,7 +50,9 @@ class DBUtil { @@ -50,7 +50,9 @@ class DBUtil {
50 $sQuery = $query; 50 $sQuery = $query;
51 } 51 }
52 $res = $db->query($sQuery, $aParams); 52 $res = $db->query($sQuery, $aParams);
53 - $default->queryLog->debug('Query: ' . DBUtil::lastQuery($db)); 53 + if ($default->queryLog) {
  54 + $default->queryLog->debug('Query: ' . DBUtil::lastQuery($db));
  55 + }
54 return $res; 56 return $res;
55 } 57 }
56 58
lib/documentmanagement/Document.inc
@@ -19,190 +19,98 @@ DEFINE(&quot;STATUS_VERSION&quot;, 6); @@ -19,190 +19,98 @@ DEFINE(&quot;STATUS_VERSION&quot;, 6);
19 19
20 require_once(KT_LIB_DIR . "/foldermanagement/Folder.inc"); 20 require_once(KT_LIB_DIR . "/foldermanagement/Folder.inc");
21 21
22 -class Document extends KTEntity {  
23 - var $_bUsePearError = true;  
24 -  
25 - // {{{ attributes  
26 - /** primary key */ 22 +require_once(KT_LIB_DIR . '/documentmanagement/documentcontentversion.inc.php');
  23 +require_once(KT_LIB_DIR . '/documentmanagement/documentcore.inc.php');
  24 +require_once(KT_LIB_DIR . '/documentmanagement/documentmetadataversion.inc.php');
  25 +
  26 +class Document {
27 var $iId; 27 var $iId;
28 28
29 - /** document type primary key */  
30 - var $iDocumentTypeID;  
31 -  
32 - /** document name */  
33 - var $sName;  
34 -  
35 - /** document file name (path to document on file system) */  
36 - var $sFileName;  
37 -  
38 - /** document file size */  
39 - var $iSize;  
40 -  
41 - /** primary key of user who created document */  
42 - var $iCreatorID;  
43 -  
44 - /** date the document was last modified */  
45 - var $dModified;  
46 -  
47 - /** file description */  
48 - var $sDescription;  
49 -  
50 - /** primary key of file mime type */  
51 - var $iMimeTypeID; 29 + var $_oDocumentCore = null;
  30 + var $_oDocumentContentVersion = null;
  31 + var $_oDocumentMetadataVersion = null;
  32 +
52 33
53 - /** primary key of folder under which document is stored */  
54 - var $iFolderID; 34 + // {{{ getters/setters
55 35
56 - /** major revision number */  
57 - var $iMajorVersion; 36 + // locally stored info.
58 37
59 - /** minor revision number */  
60 - var $iMinorVersion;  
61 -  
62 - /** document checked out status */  
63 - var $bIsCheckedOut;  
64 - //?? make checked out a status?  
65 -  
66 - /** document status **/  
67 - var $iStatusID;  
68 -  
69 - /** the user that currently has the document checked out */  
70 - var $iCheckedOutUserID;  
71 -  
72 - /** comma delimited string of folder hierarch this document falls under */  
73 - var $sParentFolderIDs;  
74 -  
75 - /** forward slash deliminated path from repository root */  
76 - var $sFullPath;  
77 -  
78 - /** date the document was created */  
79 - var $dCreated;  
80 -  
81 - /** object which controls (read/write) permissions on this document */  
82 - var $iPermissionObjectID;  
83 -  
84 - /** object which has quick lookups (read-only) on permissions on this document */  
85 - var $iPermissionLookupID; 38 + function getId() { return $this->iId; }
  39 +
  40 + // Document Core
  41 +
  42 + function getFolderID() { return $this->_oDocumentCore->getFolderId(); }
  43 + function setFolderID($iNewValue) { $this->_oDocumentCore->setFolderId($iNewValue); }
  44 +
  45 + function getCreatorID() { return $this->_oDocumentCore->getCreatorId(); }
  46 + function setCreatorID($iNewValue) { $this->_oDocumentCore->setCreatorId($iNewValue); }
  47 +
  48 + function getLastModifiedDate() { return $this->_oDocumentCore->getLastModifiedDate(); }
  49 + function setLastModifiedDate($dNewValue) { $this->_oDocumentCore->setLastModifiedDate($dNewValue); }
  50 +
  51 + function getCreatedDateTime() { return $this->_oDocumentCore->getCreatedDateTime(); }
  52 +
  53 + function getIsCheckedOut() { return $this->_oDocumentCore->getIsCheckedOut(); }
  54 + function setIsCheckedOut($bNewValue) { $this->_oDocumentCore->setIsCheckedOut(KTUtil::anyToBool($bNewValue)); }
  55 +
  56 + function getCheckedOutUserID() { return $this->_oDocumentCore->getCheckedOutUserId(); }
  57 + function setCheckedOutUserID($iNewValue) { $this->_oDocumentCore->setCheckedOutUserId($iNewValue); }
  58 +
  59 + function getPermissionObjectID() { return $this->_oDocumentCore->getPermissionObjectId(); }
  60 + function setPermissionObjectID($iNewValue) { $this->_oDocumentCore->setPermissionObjectId($iNewValue); }
  61 +
  62 + function getPermissionLookupID() { return $this->_oDocumentCore->getPermissionLookupId(); }
  63 + function setPermissionLookupID($iNewValue) { $this->_oDocumentCore->setPermissionLookupId($iNewValue); }
  64 +
  65 + function getModifiedUserId() { return $this->_oDocumentCore->getModifiedUserId(); }
  66 + function setModifiedUserId($iNewValue) { $this->_oDocumentCore->setModifiedUserId($iNewValue); }
  67 +
  68 + // Document Metadata Items
  69 +
  70 + function getDocumentTypeID() { return $this->_oDocumentMetadataVersion->getDocumentTypeId(); }
  71 + function setDocumentTypeID($sNewValue) { $this->_oDocumentMetadataVersion->setDocumentTypeId($sNewValue); }
  72 +
  73 + function getName() { return $this->_oDocumentMetadataVersion->getName(); }
  74 + function setName($sNewValue) { $this->_oDocumentMetadataVersion->setName($sNewValue); }
86 75
87 - /** if this is a historic version, a pointer to the live document */  
88 - var $iLiveDocumentID = null; 76 + function getDescription() { return $this->_oDocumentMetadataVersion->getDescription(); }
  77 + function setDescription($sNewValue) { $this->_oDocumentMetadataVersion->setDescription($sNewValue); }
  78 +
  79 + function getStatusID() { return $this->_oDocumentCore->getStatusId(); }
  80 + function setStatusID($iNewValue) { $this->_oDocumentMetadataVersion->setStatusId($iNewValue); $this->_oDocumentCore->setStatusId($iNewValue); }
  81 +
  82 + function getMetadataVersion() { return $this->_oDocumentMetadataVersion->getMetadataVersion(); }
  83 + function setMetadataVersion($iNewValue) { $this->_oDocumentMetadataVersion->getMetadataVersion($iNewValue); }
89 84
90 - /** metadata revision number */  
91 - var $iMetadataVersion; 85 + function getMetadataVersionId() { return $this->_oDocumentCore->getMetadataVersionId(); }
  86 + function setMetadataVersionId($iNewValue) { $this->_oDocumentCore->setMetadataVersionId($iNewValue); }
92 87
93 - /** storage path to the file from the repository root */  
94 - var $sStoragePath;  
95 -  
96 - // }}} 88 + function getContentVersionId() { return $this->_oDocumentMetadataVersion->getContentVersionId(); }
  89 + function setContentVersionId($iNewValue) { $this->_oDocumentMetadataVersion->setContentVersionId($iNewValue); }
97 90
98 - // {{{ KTEntity stuff  
99 - var $_aFieldToSelect = array(  
100 - "iId" => "id",  
101 - "iDocumentTypeID" => 'document_type_id',  
102 - "sName" => 'name',  
103 - "sFileName" => 'filename',  
104 - "iSize" => 'size',  
105 - "iCreatorID" => 'creator_id',  
106 - "dModified" => 'modified',  
107 - "sDescription" => 'description',  
108 - "iMimeTypeID" => 'mime_id',  
109 - "iFolderID" => 'folder_id',  
110 - "iMajorVersion" => 'major_version',  
111 - "iMinorVersion" => 'minor_version',  
112 - "bIsCheckedOut" => 'is_checked_out',  
113 - "iCheckedOutUserID" => 'checked_out_user_id',  
114 - "sParentFolderIDs" => 'parent_folder_ids',  
115 - "sFullPath" => 'full_path',  
116 - "iStatusID" => 'status_id',  
117 - "dCreated" => 'created',  
118 - "iPermissionObjectID" => 'permission_object_id',  
119 - "iPermissionLookupID" => 'permission_lookup_id',  
120 - "iLiveDocumentID" => 'live_document_id',  
121 - "iMetadataVersion" => 'metadata_version',  
122 - "sStoragePath" => 'storage_path',  
123 - "iModifiedUserId" => 'modified_user_id',  
124 - );  
125 - // }}}  
126 -  
127 - // {{{ constructor  
128 - /**  
129 - * Document class constructor  
130 - *  
131 - * @param $sName File Name  
132 - * @param $iSize File size in bytes  
133 - * @param $iCreatorID Primary key of user who created document  
134 - * @param $sDescription Description  
135 - * @param $iMimeID Primary key of file mime type  
136 - * @param $iFolderID Primary key of folder to which document belongs  
137 - *  
138 - */  
139 - function Document($sNewName = null, $sNewFileName = null, $iNewSize = null, $iNewCreatorID = null, $iNewMimeID = null, $iNewFolderID = null, $sNewDescription = "None") {  
140 - $this->iId = -1; //primary key not set as document is not stored yet  
141 - $this->sName = $sNewName;  
142 - $this->iSize = $iNewSize;  
143 - $this->iCreatorID = $iNewCreatorID;  
144 - $this->sFileName = $sNewFileName;  
145 - $this->sDescription = $sNewDescription;  
146 - $this->iMimeTypeID = $iNewMimeID;  
147 - $this->iFolderID = $iNewFolderID;  
148 - if (!empty($this->iFolderID)) {  
149 - $this->iDocumentTypeID = Folder::getDefaultFolderDocumentType($this->iFolderID);  
150 - }  
151 - $this->iMajorVersion = 0;  
152 - $this->iMetadataVersion = 0;  
153 - $this->iMinorVersion = 1;  
154 - $this->bIsCheckedOut = false;  
155 - $this->iCheckedOutUserID = -1;  
156 - // FIXME: statuses  
157 - $this->iStatusID = LIVE;  
158 - }  
159 - // }}} 91 + // Document Content Version
  92 +
  93 + function getFileName() { return $this->_oDocumentContentVersion->getFileName(); }
  94 + function setFileName($sNewValue) { $this->_oDocumentContentVersion->setFileName($sNewValue); }
  95 +
  96 + function getFileSize() { return $this->_oDocumentContentVersion->getSize(); }
  97 + function setFileSize($iNewValue) { $this->_oDocumentContentVersion->setSize($iNewValue); }
  98 +
  99 + function getSize() { return $this->_oDocumentContentVersion->getSize(); }
  100 + function setSize($iNewValue) { $this->_oDocumentContentVersion->setSize($iNewValue); }
  101 +
  102 + function getMimeTypeID() { return $this->_oDocumentContentVersion->getMimeTypeId(); }
  103 + function setMimeTypeID($iNewValue) { $this->_oDocumentContentVersion->setMimeTypeId($iNewValue); }
  104 +
  105 + function getMajorVersionNumber() { return $this->_oDocumentContentVersion->getMajorVersionNumber(); }
  106 + function setMajorVersionNumber($iNewValue) { $this->_oDocumentContentVersion->setMajorVersionNumber($iNewValue); }
  107 +
  108 + function getMinorVersionNumber() { return $this->_oDocumentContentVersion->getMinorVersionNumber(); }
  109 + function setMinorVersionNumber($iNewValue) { $this->_oDocumentContentVersion->setMinorVersionNumber($iNewValue); }
160 110
161 - // {{{ getters/setters  
162 - function getID() { return $this->iId; }  
163 - function getDocumentTypeID() { return $this->iDocumentTypeID; }  
164 - function setDocumentTypeID($sNewValue) { $this->iDocumentTypeID = $sNewValue; }  
165 - function getName() { return $this->sName; }  
166 - function setName($sNewValue) { $this->sName = $sNewValue; }  
167 - function getFileName() { return $this->sFileName; }  
168 - function setFileName($sNewValue) { $this->sFileName = $sNewValue; }  
169 - function getFolderID() { return $this->iFolderID; }  
170 - function setFolderID($iNewValue) { $this->iFolderID = $iNewValue; }  
171 - function getFileSize() { return $this->iSize; }  
172 - function setFileSize($iNewValue) { $this->iSize = $iNewValue; }  
173 - function getSize() { return $this->iSize; }  
174 - function setSize($iNewValue) { $this->iSize = $iNewValue; }  
175 - function getCreatorID() { return $this->iCreatorID; }  
176 - function setCreatorID($iNewValue) { $this->iCreatorID = $iNewValue; }  
177 - function getLastModifiedDate() { return $this->dModified; }  
178 - function setLastModifiedDate($dNewValue) { $this->dModified = $dNewValue; }  
179 - function getCreatedDateTime() { return $this->dCreated; }  
180 - function getDescription() { return $this->sDescription; }  
181 - function setDescription($sNewValue) { $this->sDescription = $sNewValue; }  
182 - function getMimeTypeID() { return $this->iMimeTypeID; }  
183 - function setMimeTypeID($iNewValue) { $this->iMimeTypeID = $iNewValue; }  
184 - function getMajorVersionNumber() { return $this->iMajorVersion; }  
185 - function setMajorVersionNumber($iNewValue) { $this->iMajorVersion = $iNewValue; }  
186 - function getMinorVersionNumber() { return $this->iMinorVersion; }  
187 - function setMinorVersionNumber($iNewValue) { $this->iMinorVersion = $iNewValue; }  
188 - function getIsCheckedOut() { return $this->bIsCheckedOut; }  
189 - function setIsCheckedOut($bNewValue) { $this->bIsCheckedOut = KTUtil::anyToBool($bNewValue); }  
190 - function getCheckedOutUserID() { return $this->iCheckedOutUserID; }  
191 - function setCheckedOutUserID($iNewValue) { $this->iCheckedOutUserID = $iNewValue; }  
192 - function getStatusID() { return $this->iStatusID; }  
193 - function setStatusID($iNewValue) { $this->iStatusID = $iNewValue; }  
194 - function getPermissionObjectID() { return $this->iPermissionObjectID; }  
195 - function setPermissionObjectID($iNewValue) { $this->iPermissionObjectID = $iNewValue; }  
196 - function getPermissionLookupID() { return $this->iPermissionLookupID; }  
197 - function setPermissionLookupID($iNewValue) { $this->iPermissionLookupID = $iNewValue; }  
198 - function getLiveDocumentID() { return $this->iLiveDocumentID; }  
199 - function setLiveDocumentID($iNewValue) { $this->iLiveDocumentID = $iNewValue; }  
200 - function getMetadataVersion() { return $this->iMetadataVersion; }  
201 - function setMetadataVersion($iNewValue) { $this->iMetadataVersion = $iNewValue; }  
202 - function getStoragePath() { return $this->sStoragePath; }  
203 - function setStoragePath($sNewValue) { $this->sStoragePath = $sNewValue; }  
204 - function getModifiedUserId() { return $this->iModifiedUserId; }  
205 - function setModifiedUserId($iNewValue) { $this->iModifiedUserId = $iNewValue; } 111 + function getStoragePath() { return $this->_oDocumentContentVersion->getStoragePath(); }
  112 + function setStoragePath($sNewValue) { $this->_oDocumentContentVersion->setStoragePath($sNewValue); }
  113 +
206 // }}} 114 // }}}
207 115
208 // {{{ getParentID 116 // {{{ getParentID
@@ -218,7 +126,7 @@ class Document extends KTEntity { @@ -218,7 +126,7 @@ class Document extends KTEntity {
218 // {{{ getVersion 126 // {{{ getVersion
219 /** returns the complete version number as a string */ 127 /** returns the complete version number as a string */
220 function getVersion() { 128 function getVersion() {
221 - return $this->iMajorVersion . "." . $this->iMinorVersion; 129 + return $this->getMajorVersion() . "." . $this->getMinorVersion();
222 } 130 }
223 // }}} 131 // }}}
224 132
@@ -236,164 +144,69 @@ class Document extends KTEntity { @@ -236,164 +144,69 @@ class Document extends KTEntity {
236 } 144 }
237 // }}} 145 // }}}
238 146
239 - // {{{ ktentity requirements  
240 - function _fieldValues () {  
241 - $this->sFullPath = Document::_generateFolderPath($this->iFolderID);  
242 - $this->sParentFolderIDs = Document::_generateFolderIDs($this->iFolderID);  
243 - return array(  
244 - 'document_type_id' => $this->iDocumentTypeID,  
245 - 'name' => $this->sName,  
246 - 'filename' => $this->sFileName,  
247 - 'size' => $this->iSize,  
248 - 'creator_id' => $this->iCreatorID,  
249 - 'modified' => $this->dModified,  
250 - 'description' => $this->sDescription,  
251 - 'mime_id' => $this->iMimeTypeID,  
252 - 'folder_id' => $this->iFolderID,  
253 - 'major_version' => $this->iMajorVersion,  
254 - 'minor_version' => $this->iMinorVersion,  
255 - 'is_checked_out' => KTUtil::anyToBool($this->bIsCheckedOut),  
256 - 'checked_out_user_id' => $this->iCheckedOutUserID,  
257 - 'parent_folder_ids' => $this->sParentFolderIDs,  
258 - 'full_path' => $this->sFullPath,  
259 - 'status_id' => $this->iStatusID,  
260 - 'created' => $this->dCreated,  
261 - 'permission_object_id' => $this->iPermissionObjectID,  
262 - 'permission_lookup_id' => $this->iPermissionLookupID,  
263 - 'live_document_id' => $this->iLiveDocumentID,  
264 - 'metadata_version' => $this->iMetadataVersion,  
265 - 'storage_path' => $this->sStoragePath,  
266 - 'modified_user_id' => $this->iModifiedUserId,  
267 - );  
268 - }  
269 -  
270 - function _table () {  
271 - global $default;  
272 - return $default->documents_table;  
273 - }  
274 -  
275 - /**  
276 - * Recursive function to generate a comma delimited string containing  
277 - * the parent folder ids  
278 - *  
279 - * @return String comma delimited string containing the parent folder ids  
280 - */  
281 - function _generateParentFolderIDS($iFolderID) {  
282 - global $default;  
283 - //if the folder is not the root folder  
284 - if ($iFolderID != 0) {  
285 - $sql = $default->db;  
286 - $sql->query(array("SELECT parent_id FROM $default->folders_table WHERE ID = ?", $iFolderID));/*ok*/  
287 - $sql->next_record();  
288 - return Document::_generateParentFolderIDS($sql->f("parent_id")) . ",$iFolderID";  
289 - }  
290 - return;  
291 - }  
292 147
293 - /**  
294 - * Returns a comma delimited string containing the parent folder ids, strips leading /  
295 - *  
296 - * @return String comma delimited string containing the parent folder ids  
297 - */  
298 - function _generateFolderIDs($iFolderID) {  
299 - $sFolderIDs = Document::_generateParentFolderIDS($iFolderID);  
300 - return substr($sFolderIDs, 1, strlen($sFolderIDs));  
301 - }  
302 -  
303 - /**  
304 - * Recursively generates forward slash deliminated string giving full path of document  
305 - * from file system root url  
306 - */  
307 - function _generateFullFolderPath($iFolderID) {  
308 - global $default;  
309 - //if the folder is not the root folder  
310 - if ($iFolderID != 0) {  
311 - $sql = $default->db;  
312 - $sql->query(array("SELECT name, parent_id FROM $default->folders_table WHERE ID = ?", $iFolderID));/*ok*/  
313 - $sql->next_record();  
314 - return Document::_generateFullFolderPath($sql->f("parent_id")) . "/" . $sql->f("name");  
315 - }  
316 - return;  
317 - }  
318 -  
319 - /**  
320 - * Returns a forward slash deliminated string giving full path of document, strips leading /  
321 - */  
322 - function _generateFolderPath($iFolderID) {  
323 - global $default;  
324 - $sPath = Document::_generateFullFolderPath($iFolderID);  
325 - $sPath = substr($sPath, 1, strlen($sPath));  
326 - $sPath = addslashes($sPath);  
327 - return $sPath;  
328 - }  
329 - // }}}  
330 -  
331 - // {{{ create  
332 - /**  
333 - * Insert the current document into the database  
334 - *  
335 - * @return boolean true on successful insert, false otherwise  
336 - */  
337 - function create() {  
338 - if (empty($this->dCreated)) {  
339 - $this->dCreated = getCurrentDateTime();  
340 - }  
341 - if (empty($this->dModified)) {  
342 - $this->dModified = getCurrentDateTime();  
343 - }  
344 - if (empty($this->iModifiedUserId)) {  
345 - $this->iModifiedUserId = $this->iCreatorID;  
346 - }  
347 - $oFolder = Folder::get($this->getFolderID());  
348 - $this->iPermissionObjectID = $oFolder->getPermissionObjectID();  
349 - $res = parent::create();  
350 -  
351 - if ($res === true) {  
352 - KTPermissionUtil::updatePermissionLookup($this);  
353 - } 148 + // {{{ update
  149 + function update($bPathMove = false) {
  150 + $res = $this->_oDocumentCore->update();
  151 + if (PEAR::isError($res)) { var_dump($res); return $res; }
  152 +
  153 + $res = $this->_oDocumentContentVersion->update();
  154 + if (PEAR::isError($res)) { var_dump($res); return $res; }
  155 +
  156 + $res = $this->_oDocumentMetadataVersion->update();
  157 + if (PEAR::isError($res)) { var_dump($res); return $res; }
354 158
355 return $res; 159 return $res;
356 } 160 }
357 // }}} 161 // }}}
358 162
359 - // {{{ update  
360 - function update($bPathMove = false) {  
361 - $res = parent::update();  
362 - if (($res === true) && ($bPathMove === true)) {  
363 - KTPermissionUtil::updatePermissionLookup($this); 163 + // {{{ get
  164 + function &get($iId, $iMetadataVersion=null) {
  165 + $oDocument = new Document();
  166 + if (!is_numeric($iId)) { print "<pre>Document.inc: 162: "; var_dump($iId); print "</pre>"; }
  167 + $res = $oDocument->load($iId, $iMetadataVersion);
  168 + if (PEAR::isError($res)) {
  169 + return $res;
364 } 170 }
365 - return $res; 171 + return $oDocument;
366 } 172 }
367 // }}} 173 // }}}
368 174
369 - // {{{ get  
370 - function &get($iId) {  
371 - return KTEntityUtil::get('Document', $iId); 175 + function load($iId, $iMetadataVersionId = null) {
  176 + $this->iId = $iId;
  177 + $this->_oDocumentCore = KTDocumentCore::get($iId);
  178 + if (PEAR::isError($this->_oDocumentCore)) { return $this->_oDocumentCore; }
  179 +
  180 + // FIXME add error $res if MDV > $_oDC->getMDV
  181 + if (is_null($iMetadataVersionId)) {
  182 + $this->_oDocumentMetadataVersion = KTDocumentMetadataVersion::get($this->_oDocumentCore->getMetadataVersionId());
  183 + } else {
  184 + $this->_oDocumentMetadataVersion = KTDocumentMetadataVersion::get($iMetadataVersionId);
  185 + }
  186 + if (PEAR::isError($this->_oDocumentMetadataVersion)) { var_dump($this->_oDocumentMetadataVersion); return $this->_oDocumentMetadataVersion; }
  187 +
  188 + $this->_oDocumentContentVersion = KTDocumentContentVersion::get($this->_oDocumentMetadataVersion->getContentVersionId());
  189 + if (PEAR::isError($this->_oDocumentContentVersion)) { return $this->_oDocumentContentVersion; }
372 } 190 }
373 - // }}}  
374 191
375 // {{{ getList 192 // {{{ getList
376 /** 193 /**
377 * Static function 194 * Static function
378 - * Get a list of Documents 195 + * Get a list of Documents - CAN ONLY USE KTDOCUMENTCORE QUERIES
379 * 196 *
380 * @param String Where clause (not required) 197 * @param String Where clause (not required)
381 * 198 *
382 * @return Array array of Documents objects, false otherwise. 199 * @return Array array of Documents objects, false otherwise.
383 */ 200 */
384 function getList($sWhereClause = null) { 201 function getList($sWhereClause = null) {
385 - return KTEntityUtil::getList(Document::_table(), 'Document', $sWhereClause);  
386 - }  
387 - // }}} 202 + $aOptions = array('ids' => true);
  203 + $aIds = KTDocumentCore::getList($sWhereClause, $aOptions);
  204 + $aList = array();
  205 + foreach($aIds as $iId) {
  206 + $aList[] = Document::get($iId);
  207 + };
  208 + return $aList;
388 209
389 - // {{{ getPath  
390 - /**  
391 - * Get the full path for a document  
392 - *  
393 - * @return string full path of document  
394 - */  
395 - function getPath() {  
396 - return Folder::getFolderPath($this->iFolderID) . $this->sFileName;  
397 } 210 }
398 // }}} 211 // }}}
399 212
@@ -404,10 +217,10 @@ class Document extends KTEntity { @@ -404,10 +217,10 @@ class Document extends KTEntity {
404 * @return string full path to document 217 * @return string full path to document
405 */ 218 */
406 function getDisplayPath($bDisplayIcon = false) { 219 function getDisplayPath($bDisplayIcon = false) {
407 - $sFolderPath = Folder::getFolderDisplayPath($this->iFolderID); 220 + $sFolderPath = Folder::getFolderDisplayPath($this->getFolderID());
408 // #3425 for consistency 221 // #3425 for consistency
409 return ($bDisplayIcon ? $this->getIcon() : "") . 222 return ($bDisplayIcon ? $this->getIcon() : "") .
410 - ($sFolderPath == "" ? "Deleted Folder" : $sFolderPath) . " &raquo; " . $this->sFileName; 223 + ($sFolderPath == "" ? "Deleted Folder" : $sFolderPath) . " &raquo; " . $this->getName();
411 } 224 }
412 // }}} 225 // }}}
413 226
@@ -422,6 +235,9 @@ class Document extends KTEntity { @@ -422,6 +235,9 @@ class Document extends KTEntity {
422 * @return boolean true if document exists, false otherwise. 235 * @return boolean true if document exists, false otherwise.
423 */ 236 */
424 function documentExists($sFileName, $iFolderID) { 237 function documentExists($sFileName, $iFolderID) {
  238 + return false;
  239 +
  240 +
425 global $default; 241 global $default;
426 $sql = $default->db; 242 $sql = $default->db;
427 $sQuery = "SELECT * FROM $default->documents_table " ./*ok*/ 243 $sQuery = "SELECT * FROM $default->documents_table " ./*ok*/
@@ -446,7 +262,6 @@ class Document extends KTEntity { @@ -446,7 +262,6 @@ class Document extends KTEntity {
446 * @return string full path to document 262 * @return string full path to document
447 */ 263 */
448 function getDocumentDisplayPath($iDocumentID) { 264 function getDocumentDisplayPath($iDocumentID) {
449 - global $default;  
450 $oDocument = & Document::get($iDocumentID); 265 $oDocument = & Document::get($iDocumentID);
451 return $oDocument->getDisplayPath(); 266 return $oDocument->getDisplayPath();
452 } 267 }
@@ -466,21 +281,18 @@ class Document extends KTEntity { @@ -466,21 +281,18 @@ class Document extends KTEntity {
466 } 281 }
467 // }}} 282 // }}}
468 283
469 - // {{{ getByLiveDocument  
470 - function &getByLiveDocument($oDocument) {  
471 - return KTEntityUtil::getByDict('Document', array(  
472 - 'live_document_id' => $oDocument->getID(),  
473 - ), array('multi' => true, 'orderby' => 'modified DESC'));  
474 - }  
475 - // }}}  
476 -  
477 // {{{ getByFolderIDAndLookupID 284 // {{{ getByFolderIDAndLookupID
478 function &getByFolderIDAndLookupID($iParentID, $iLookupID, $aOptions = null) { 285 function &getByFolderIDAndLookupID($iParentID, $iLookupID, $aOptions = null) {
479 - return KTEntityUtil::getByDict('Document', array( 286 + $aIds = KTEntityUtil::getByDict('KTDocumentCore', array(
480 'folder_id' => $iParentID, 287 'folder_id' => $iParentID,
481 'permission_lookup_id' => $iLookupID, 288 'permission_lookup_id' => $iLookupID,
482 'status_id' => LIVE, 289 'status_id' => LIVE,
483 - ), array('multi' => true)); 290 + ), array('multi' => true, 'ids' => true));
  291 +
  292 + $aList = array();
  293 + foreach ($aIds as $iId) {
  294 + $aList[] = Document::get($iId);
  295 + }
484 } 296 }
485 // }}} 297 // }}}
486 298
@@ -492,8 +304,112 @@ class Document extends KTEntity { @@ -492,8 +304,112 @@ class Document extends KTEntity {
492 if (KTUtil::arrayGet($aOptions, "mimetypeid") === null) { 304 if (KTUtil::arrayGet($aOptions, "mimetypeid") === null) {
493 $aOptions['mimetypeid'] = 0; 305 $aOptions['mimetypeid'] = 0;
494 } 306 }
495 - return KTEntityUtil::createFromArray('Document', $aOptions); 307 + $oDocument = new Document();
  308 + $aOptions = array_change_key_case($aOptions);
  309 +
  310 + $aCoreKeys = array(
  311 + "CreatorId",
  312 + "Created",
  313 + "ModifiedUserId",
  314 + "Modified",
  315 + "FolderId",
  316 + "StatusId",
  317 + );
  318 +
  319 + $aCore = array();
  320 + foreach ($aCoreKeys as $sKey) {
  321 + $sKey = strtolower($sKey);
  322 + $sValue = KTUtil::arrayGet($aOptions, $sKey);
  323 + if (!is_null($sValue)) {
  324 + $aCore[$sKey] = $sValue;
  325 + }
  326 + }
  327 +
  328 + $aMetadataVersionKeys = array(
  329 + "MetadataVersion",
  330 + "ContentVersionId",
  331 + "DocumentTypeId",
  332 + "Name",
  333 + "Description",
  334 + "StatusId",
  335 + "VersionCreated",
  336 + "VersionCreatorId",
  337 + );
  338 +
  339 + $aMetadataVersion = array();
  340 + foreach ($aMetadataVersionKeys as $sKey) {
  341 + $sKey = strtolower($sKey);
  342 + $sValue = KTUtil::arrayGet($aOptions, $sKey);
  343 + if (!is_null($sValue)) {
  344 + $aMetadataVersion[$sKey] = $sValue;
  345 + }
  346 + }
  347 + $aMetadataVersion['VersionCreatorId'] = $aCore['creatorid'];
  348 +
  349 + $aContentKeys = array(
  350 + "Filename",
  351 + "Size",
  352 + "MimeId",
  353 + "MajorVersion",
  354 + "MinorVersion",
  355 + "StoragePath",
  356 + );
  357 +
  358 + $aContentVersion = array();
  359 + foreach ($aContentKeys as $sKey) {
  360 + $sKey = strtolower($sKey);
  361 + $sValue = KTUtil::arrayGet($aOptions, $sKey);
  362 + if (!is_null($sValue)) {
  363 + $aContentVersion[$sKey] = $sValue;
  364 + }
  365 + }
  366 +
  367 + $oDocument->_oDocumentCore = KTDocumentCore::createFromArray($aCore);
  368 + if (PEAR::isError($oDocument->_oDocumentCore)) {
  369 + return $oDocument->_oDocumentCore;
  370 + }
  371 + $iId = $oDocument->_oDocumentCore->getId();
  372 + $aContentVersion["documentid"] = $iId;
  373 + $oDocument->_oDocumentContentVersion = KTDocumentContentVersion::createFromArray($aContentVersion);
  374 + if (PEAR::isError($oDocument->_oDocumentContentVersion)) { return $oDocument->_oDocumentContentVersion; }
  375 + $aMetadataVersion["documentid"] = $iId;
  376 + $aMetadataVersion["contentversionid"] = $oDocument->_oDocumentContentVersion->getId();
  377 + $oDocument->_oDocumentMetadataVersion = KTDocumentMetadataVersion::createFromArray($aMetadataVersion);
  378 + if (PEAR::isError($oDocument->_oDocumentMetadataVersion)) { return $oDocument->_oDocumentMetadataVersion; }
  379 + $oDocument->_oDocumentCore->setMetadataVersionId($oDocument->_oDocumentMetadataVersion->getId());
  380 + $res = $oDocument->_oDocumentCore->update();
  381 + if (PEAR::isError($res)) {
  382 + return $res;
  383 + }
  384 + $oDocument->iId = $iId;
  385 + return $oDocument;
  386 + }
  387 +
  388 + function startNewMetadataVersion() {
  389 + $this->_oDocumentMetadataVersion->iId = -1;
  390 + $this->_oDocumentMetadataVersion->iMetadataVersion++;
  391 + $this->_oDocumentMetadataVersion->create();
  392 + $this->_oDocumentCore->iMetadataVersion = $this->_oDocumentMetadataVersion->iMetadataVersion;
  393 + $this->_oDocumentCore->iMetadataVersionId = $this->_oDocumentMetadataVersion->iId;
496 } 394 }
497 395
  396 + function startNewContentVersion() {
  397 + $this->_oDocumentContentVersion->iId = -1;
  398 + $res = $this->_oDocumentContentVersion->create();
  399 + if (PEAR::isError($res)) {
  400 + var_dump($res);
  401 + return $res;
  402 + }
  403 + $this->_oDocumentMetadataVersion->iId = -1;
  404 + $this->_oDocumentMetadataVersion->iMetadataVersion++;
  405 + $this->_oDocumentMetadataVersion->iContentVersionId = $this->_oDocumentContentVersion->getId();
  406 + $res = $this->_oDocumentMetadataVersion->create();
  407 + if (PEAR::isError($res)) {
  408 + var_dump($res);
  409 + return $res;
  410 + }
  411 + $this->_oDocumentCore->iMetadataVersion = $this->_oDocumentMetadataVersion->iMetadataVersion;
  412 + $this->_oDocumentCore->iMetadataVersionId = $this->_oDocumentMetadataVersion->iId;
  413 + }
498 } 414 }
499 ?> 415 ?>
lib/documentmanagement/DocumentFieldLink.inc
@@ -29,7 +29,7 @@ class DocumentFieldLink extends KTEntity { @@ -29,7 +29,7 @@ class DocumentFieldLink extends KTEntity {
29 /** document field link primary key */ 29 /** document field link primary key */
30 var $iId; 30 var $iId;
31 /** primary key of document to which field is linked */ 31 /** primary key of document to which field is linked */
32 - var $iDocumentId; 32 + var $iMetadataVersionId;
33 /** primary key of field to which document is linked */ 33 /** primary key of field to which document is linked */
34 var $iDocumentFieldId; 34 var $iDocumentFieldId;
35 /** field value */ 35 /** field value */
@@ -37,7 +37,7 @@ class DocumentFieldLink extends KTEntity { @@ -37,7 +37,7 @@ class DocumentFieldLink extends KTEntity {
37 37
38 var $_aFieldToSelect = array( 38 var $_aFieldToSelect = array(
39 'iId' => 'id', 39 'iId' => 'id',
40 - 'iDocumentId' => 'document_id', 40 + 'iMetadataVersionId' => 'metadata_version_id',
41 'iDocumentFieldId' => 'document_field_id', 41 'iDocumentFieldId' => 'document_field_id',
42 'sValue' => 'value', 42 'sValue' => 'value',
43 ); 43 );
@@ -74,8 +74,8 @@ class DocumentFieldLink extends KTEntity { @@ -74,8 +74,8 @@ class DocumentFieldLink extends KTEntity {
74 * @return int document primary key to which the field is linked 74 * @return int document primary key to which the field is linked
75 * 75 *
76 */ 76 */
77 - function getDocumentId() {  
78 - return $this->iDocumentId; 77 + function getMetadataVersionId() {
  78 + return $this->iMetadataVersionId;
79 } 79 }
80 80
81 /** 81 /**
@@ -84,8 +84,8 @@ class DocumentFieldLink extends KTEntity { @@ -84,8 +84,8 @@ class DocumentFieldLink extends KTEntity {
84 * @param Document primary key to which field is linked 84 * @param Document primary key to which field is linked
85 * 85 *
86 */ 86 */
87 - function setDocumentId($iNewValue) {  
88 - $this->iDocumentId = $iNewValue; 87 + function setMetadataVersionId($iNewValue) {
  88 + $this->iMetadataVersionId = $iNewValue;
89 } 89 }
90 90
91 /** 91 /**
@@ -141,17 +141,8 @@ class DocumentFieldLink extends KTEntity { @@ -141,17 +141,8 @@ class DocumentFieldLink extends KTEntity {
141 * 141 *
142 * @return DocumentFieldLink populated DocumentFieldLink object on success, false otherwise and set $_SESSION["errorMessage"] 142 * @return DocumentFieldLink populated DocumentFieldLink object on success, false otherwise and set $_SESSION["errorMessage"]
143 */ 143 */
144 - function & get($iDocumentFieldLinkId) {  
145 - global $default, $lang_err_doc_not_exist;  
146 - $sql = $default->db;  
147 - $sql->query(array("SELECT * FROM " . $default->document_fields_link_table . " WHERE id = ?", $iDocumentFieldLinkId));/*ok*/  
148 - if ($sql->next_record()) {  
149 - $oDocumentFieldLink = & new DocumentFieldLink($sql->f("document_id"), $sql->f("document_field_id"), $sql->f("value"));  
150 - $oDocumentFieldLink->iId = $iDocumentFieldLinkId;  
151 - return $oDocumentFieldLink;  
152 - }  
153 - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentId . " table = $default->document_fields_link_table";  
154 - return false; 144 + function &get($iId) {
  145 + return KTEntityUtil::get('DocumentFieldLink', $iId);
155 } 146 }
156 147
157 function &getList($sWhereClause = null) { 148 function &getList($sWhereClause = null) {
@@ -160,15 +151,18 @@ class DocumentFieldLink extends KTEntity { @@ -160,15 +151,18 @@ class DocumentFieldLink extends KTEntity {
160 151
161 152
162 function &getByDocument($oDocument) { 153 function &getByDocument($oDocument) {
163 - $iDocumentId = KTUtil::getId($oDocument); 154 + $oDocument =& KTUtil::getObject('Document', $oDocument);
  155 + $iMetadataVersionId = $oDocument->getMetadataVersionId();
164 return KTEntityUtil::getByDict('DocumentFieldLink', array( 156 return KTEntityUtil::getByDict('DocumentFieldLink', array(
165 - 'document_id' => $iDocumentId, 157 + 'metadata_version_id' => $iMetadataVersionId,
166 ), array('multi' => true)); 158 ), array('multi' => true));
167 } 159 }
168 160
169 function &getByDocumentAndField($oDocument, $oField) { 161 function &getByDocumentAndField($oDocument, $oField) {
  162 + $oDocument =& KTUtil::getObject('Document', $oDocument);
  163 + $iMetadataVersionId = $oDocument->getMetadataVersionId();
170 return KTEntityUtil::getByDict('DocumentFieldLink', array( 164 return KTEntityUtil::getByDict('DocumentFieldLink', array(
171 - 'document_id' => KTUtil::getId($oDocument), 165 + 'metadata_version_id' => $iMetadataVersionId,
172 'document_field_id' => KTUtil::getId($oDocument), 166 'document_field_id' => KTUtil::getId($oDocument),
173 )); 167 ));
174 } 168 }
lib/documentmanagement/DocumentTransaction.inc
@@ -61,7 +61,7 @@ class DocumentTransaction { @@ -61,7 +61,7 @@ class DocumentTransaction {
61 $this->sComment = $sNewComment; 61 $this->sComment = $sNewComment;
62 $this->sTransactionNS = $sTransactionNS; 62 $this->sTransactionNS = $sTransactionNS;
63 $this->sVersion = $oDocument->getMajorVersionNumber() . "." . $oDocument->getMinorVersionNumber(); 63 $this->sVersion = $oDocument->getMajorVersionNumber() . "." . $oDocument->getMinorVersionNumber();
64 - $oFolder = Folder::get($oDocument->iFolderID); 64 + $oFolder = Folder::get($oDocument->getFolderId());
65 $this->sFileName = addslashes($oFolder->sFullPath . "/" . $oFolder->getName() . "/" . $oDocument->getName()); 65 $this->sFileName = addslashes($oFolder->sFullPath . "/" . $oFolder->getName() . "/" . $oDocument->getName());
66 66
67 $this->iUserID = $_SESSION["userID"]; 67 $this->iUserID = $_SESSION["userID"];
lib/documentmanagement/documentcontentversion.inc.php
@@ -9,13 +9,13 @@ class KTDocumentContentVersion extends KTEntity { @@ -9,13 +9,13 @@ class KTDocumentContentVersion extends KTEntity {
9 var $iDocumentId; 9 var $iDocumentId;
10 10
11 /** What was the filename of the stored content */ 11 /** What was the filename of the stored content */
12 - var $sFilename; 12 + var $sFileName;
13 13
14 /** How big was the stored content */ 14 /** How big was the stored content */
15 var $iSize; 15 var $iSize;
16 16
17 /** Which MIME type was this content */ 17 /** Which MIME type was this content */
18 - var $iMimeId; 18 + var $iMimeTypeId;
19 19
20 /** User-specified major version for this content */ 20 /** User-specified major version for this content */
21 var $iMajorVersion; 21 var $iMajorVersion;
@@ -31,9 +31,9 @@ class KTDocumentContentVersion extends KTEntity { @@ -31,9 +31,9 @@ class KTDocumentContentVersion extends KTEntity {
31 31
32 // transaction-related 32 // transaction-related
33 "iDocumentId" => 'document_id', 33 "iDocumentId" => 'document_id',
34 - "sFilename" => 'filename', 34 + "sFileName" => 'filename',
35 "iSize" => 'size', 35 "iSize" => 'size',
36 - "iMimeId" => 'mime_id', 36 + "iMimeTypeId" => 'mime_id',
37 "iMajorVersion" => 'major_version', 37 "iMajorVersion" => 'major_version',
38 "iMinorVersion" => 'minor_version', 38 "iMinorVersion" => 'minor_version',
39 "sStoragePath" => 'storage_path', 39 "sStoragePath" => 'storage_path',
@@ -42,7 +42,48 @@ class KTDocumentContentVersion extends KTEntity { @@ -42,7 +42,48 @@ class KTDocumentContentVersion extends KTEntity {
42 function KTDocumentContentVersion() { 42 function KTDocumentContentVersion() {
43 } 43 }
44 44
45 - 45 + function getFileName() { return $this->sFileName; }
  46 + function setFileName($sNewValue) { $this->sFileName = $sNewValue; }
  47 + function getFileSize() { return $this->iSize; }
  48 + function setFileSize($iNewValue) { $this->iSize = $iNewValue; }
  49 + function getSize() { return $this->iSize; }
  50 + function setSize($iNewValue) { $this->iSize = $iNewValue; }
  51 + function getMimeTypeId() { return $this->iMimeTypeId; }
  52 + function setMimeTypeId($iNewValue) { $this->iMimeTypeId = $iNewValue; }
  53 + function getMajorVersionNumber() { return $this->iMajorVersion; }
  54 + function setMajorVersionNumber($iNewValue) { $this->iMajorVersion = $iNewValue; }
  55 + function getMinorVersionNumber() { return $this->iMinorVersion; }
  56 + function setMinorVersionNumber($iNewValue) { $this->iMinorVersion = $iNewValue; }
  57 + function getStoragePath() { return $this->sStoragePath; }
  58 + function setStoragePath($sNewValue) { $this->sStoragePath = $sNewValue; }
  59 +
  60 + function _table() {
  61 + return KTUtil::getTableName('document_content_version');
  62 + }
  63 +
  64 + function &createFromArray($aOptions) {
  65 + return KTEntityUtil::createFromArray('KTDocumentContentVersion', $aOptions);
  66 + }
  67 +
  68 + function create() {
  69 + if (empty($this->iSize)) {
  70 + $this->iSize = 0;
  71 + }
  72 + if (empty($this->iMimeTypeId)) {
  73 + $this->iMimeTypeId = 0;
  74 + }
  75 + if (empty($this->iMajorVersion)) {
  76 + $this->iMajorVersion = 0;
  77 + }
  78 + if (empty($this->iMinorVersion)) {
  79 + $this->iMinorVersion = 1;
  80 + }
  81 + return parent::create();
  82 + }
  83 +
  84 + function &get($iId) {
  85 + return KTEntityUtil::get('KTDocumentContentVersion', $iId);
  86 + }
46 } 87 }
47 88
48 ?> 89 ?>
lib/documentmanagement/documentcore.inc.php
@@ -37,6 +37,11 @@ class KTDocumentCore extends KTEntity { @@ -37,6 +37,11 @@ class KTDocumentCore extends KTEntity {
37 /** The most recent metadata version for the object */ 37 /** The most recent metadata version for the object */
38 var $iMetadataVersionId; 38 var $iMetadataVersionId;
39 39
  40 + var $iMetadataVersion;
  41 +
  42 + var $bIsCheckedOut;
  43 + var $iCheckedOutUserId;
  44 +
40 var $_aFieldToSelect = array( 45 var $_aFieldToSelect = array(
41 "iId" => "id", 46 "iId" => "id",
42 47
@@ -45,7 +50,8 @@ class KTDocumentCore extends KTEntity { @@ -45,7 +50,8 @@ class KTDocumentCore extends KTEntity {
45 "dCreated" => 'created', 50 "dCreated" => 'created',
46 "iModifiedUserId" => 'modified_user_id', 51 "iModifiedUserId" => 'modified_user_id',
47 "dModified" => 'modified', 52 "dModified" => 'modified',
48 - 53 + "iMetadataVersionId" => 'metadata_version_id',
  54 + "iMetadataVersion" => 'metadata_version',
49 55
50 // location-related 56 // location-related
51 "iFolderId" => 'folder_id', 57 "iFolderId" => 'folder_id',
@@ -54,6 +60,8 @@ class KTDocumentCore extends KTEntity { @@ -54,6 +60,8 @@ class KTDocumentCore extends KTEntity {
54 60
55 // status 61 // status
56 "iStatusId" => 'status_id', 62 "iStatusId" => 'status_id',
  63 + "bIsCheckedOut" => 'is_checked_out',
  64 + "iCheckedOutUserId" => 'checked_out_user_id',
57 65
58 // permission-related 66 // permission-related
59 "iPermissionObjectId" => 'permission_object_id', 67 "iPermissionObjectId" => 'permission_object_id',
@@ -77,11 +85,22 @@ class KTDocumentCore extends KTEntity { @@ -77,11 +85,22 @@ class KTDocumentCore extends KTEntity {
77 85
78 function getStatusId() { return $this->iStatusId; } 86 function getStatusId() { return $this->iStatusId; }
79 function setStatusId($iNewValue) { $this->iStatusId = $iNewValue; } 87 function setStatusId($iNewValue) { $this->iStatusId = $iNewValue; }
  88 + function getIsCheckedOut() { return $this->bIsCheckedOut; }
  89 + function setIsCheckedOut($bNewValue) { $this->bIsCheckedOut = KTUtil::anyToBool($bNewValue); }
  90 + function getCheckedOutUserId() { return $this->iCheckedOutUserId; }
  91 + function setCheckedOutUserId($iNewValue) { $this->iCheckedOutUserId = $iNewValue; }
80 92
81 function getPermissionObjectId() { return $this->iPermissionObjectId; } 93 function getPermissionObjectId() { return $this->iPermissionObjectId; }
82 function setPermissionObjectId($iNewValue) { $this->iPermissionObjectId = $iNewValue; } 94 function setPermissionObjectId($iNewValue) { $this->iPermissionObjectId = $iNewValue; }
83 function getPermissionLookupId() { return $this->iPermissionLookupId; } 95 function getPermissionLookupId() { return $this->iPermissionLookupId; }
84 function setPermissionLookupId($iNewValue) { $this->iPermissionLookupId = $iNewValue; } 96 function setPermissionLookupId($iNewValue) { $this->iPermissionLookupId = $iNewValue; }
  97 +
  98 + function getMetadataVersionId() { return $this->iMetadataVersionId; }
  99 + function setMetadataVersionId($iNewValue) { $this->iMetadataVersionId = $iNewValue; }
  100 +
  101 + function getMetadataVersion() { return $this->iMetadataVersion; }
  102 + function setMetadataVersion($iNewValue) { $this->iMetadataVersion = $iNewValue; }
  103 +
85 // }}} 104 // }}}
86 105
87 // {{{ getParentId 106 // {{{ getParentId
@@ -96,8 +115,8 @@ class KTDocumentCore extends KTEntity { @@ -96,8 +115,8 @@ class KTDocumentCore extends KTEntity {
96 115
97 // {{{ ktentity requirements 116 // {{{ ktentity requirements
98 function _fieldValues () { 117 function _fieldValues () {
99 - $this->sFullPath = KTDocument::_generateFolderPath($this->iFolderId);  
100 - $this->sParentFolderIds = KTDocument::_generateFolderIds($this->iFolderId); 118 + $this->sFullPath = KTDocumentCore::_generateFolderPath($this->iFolderId);
  119 + $this->sParentFolderIds = KTDocumentCore::_generateFolderIds($this->iFolderId);
101 return parent::_fieldValues(); 120 return parent::_fieldValues();
102 } 121 }
103 122
@@ -116,7 +135,7 @@ class KTDocumentCore extends KTEntity { @@ -116,7 +135,7 @@ class KTDocumentCore extends KTEntity {
116 $sQuery = sprintf('SELECT parent_id FROM %s WHERE id = ?', $sTable); 135 $sQuery = sprintf('SELECT parent_id FROM %s WHERE id = ?', $sTable);
117 $aParams = array($iFolderId); 136 $aParams = array($iFolderId);
118 $iParentId = DBUtil::getOneResultKey(array($sQuery, $aParams), 'parent_id'); 137 $iParentId = DBUtil::getOneResultKey(array($sQuery, $aParams), 'parent_id');
119 - return Document::_generateParentFolderIds($iParentId) . ",$iFolderId"; 138 + return KTDocumentCore::_generateParentFolderIds($iParentId) . ",$iFolderId";
120 } 139 }
121 140
122 /** 141 /**
@@ -125,7 +144,7 @@ class KTDocumentCore extends KTEntity { @@ -125,7 +144,7 @@ class KTDocumentCore extends KTEntity {
125 * @return String comma delimited string containing the parent folder ids 144 * @return String comma delimited string containing the parent folder ids
126 */ 145 */
127 function _generateFolderIds($iFolderId) { 146 function _generateFolderIds($iFolderId) {
128 - $sFolderIds = Document::_generateParentFolderIds($iFolderId); 147 + $sFolderIds = KTDocumentCore::_generateParentFolderIds($iFolderId);
129 return substr($sFolderIds, 1, strlen($sFolderIds)); 148 return substr($sFolderIds, 1, strlen($sFolderIds));
130 } 149 }
131 150
@@ -134,23 +153,22 @@ class KTDocumentCore extends KTEntity { @@ -134,23 +153,22 @@ class KTDocumentCore extends KTEntity {
134 * from file system root url 153 * from file system root url
135 */ 154 */
136 function _generateFullFolderPath($iFolderId) { 155 function _generateFullFolderPath($iFolderId) {
137 - global $default;  
138 //if the folder is not the root folder 156 //if the folder is not the root folder
139 if (empty($iFolderId)) { 157 if (empty($iFolderId)) {
140 return; 158 return;
141 } 159 }
  160 + $sTable = KTUtil::getTableName('folders');
142 $sQuery = sprintf("SELECT name, parent_id FROM %s WHERE Id = ?", $sTable); 161 $sQuery = sprintf("SELECT name, parent_id FROM %s WHERE Id = ?", $sTable);
143 $aParams = array($iFolderId); 162 $aParams = array($iFolderId);
144 $aRow = DBUtil::getOneResult(array($sQuery, $aParams)); 163 $aRow = DBUtil::getOneResult(array($sQuery, $aParams));
145 - return Document::_generateFullFolderPath($aRow["parent_id"]) . "/" . $aRow["name"]; 164 + return KTDocumentCore::_generateFullFolderPath($aRow["parent_id"]) . "/" . $aRow["name"];
146 } 165 }
147 166
148 /** 167 /**
149 * Returns a forward slash deliminated string giving full path of document, strips leading / 168 * Returns a forward slash deliminated string giving full path of document, strips leading /
150 */ 169 */
151 function _generateFolderPath($iFolderId) { 170 function _generateFolderPath($iFolderId) {
152 - global $default;  
153 - $sPath = Document::_generateFullFolderPath($iFolderId); 171 + $sPath = KTDocumentCore::_generateFullFolderPath($iFolderId);
154 $sPath = substr($sPath, 1, strlen($sPath)); 172 $sPath = substr($sPath, 1, strlen($sPath));
155 return $sPath; 173 return $sPath;
156 } 174 }
@@ -167,6 +185,12 @@ class KTDocumentCore extends KTEntity { @@ -167,6 +185,12 @@ class KTDocumentCore extends KTEntity {
167 if (empty($this->iModifiedUserId)) { 185 if (empty($this->iModifiedUserId)) {
168 $this->iModifiedUserId = $this->iCreatorId; 186 $this->iModifiedUserId = $this->iCreatorId;
169 } 187 }
  188 + if (empty($this->iMetadataVersion)) {
  189 + $this->iMetadataVersion = 0;
  190 + }
  191 + if (empty($this->bIsCheckedOut)) {
  192 + $this->bIsCheckedOut = false;
  193 + }
170 $oFolder = Folder::get($this->getFolderId()); 194 $oFolder = Folder::get($this->getFolderId());
171 $this->iPermissionObjectId = $oFolder->getPermissionObjectId(); 195 $this->iPermissionObjectId = $oFolder->getPermissionObjectId();
172 $res = parent::create(); 196 $res = parent::create();
@@ -191,11 +215,36 @@ class KTDocumentCore extends KTEntity { @@ -191,11 +215,36 @@ class KTDocumentCore extends KTEntity {
191 215
192 // {{{ get 216 // {{{ get
193 function &get($iId) { 217 function &get($iId) {
194 - return KTEntityUtil::get('KTDocument', $iId); 218 + return KTEntityUtil::get('KTDocumentCore', $iId);
195 } 219 }
196 // }}} 220 // }}}
197 221
  222 + // {{{ getList
  223 + function &getList($sWhere = null, $aOptions) {
  224 + return KTEntityUtil::getList2('KTDocumentCore', $sWhere, $aOptions);
  225 + }
  226 + // }}}
198 227
  228 + // {{{ _table
  229 + function _table() {
  230 + return KTUtil::getTableName('documents');
  231 + }
  232 + // }}}
  233 +
  234 + // {{{ getPath
  235 + /**
  236 + * Get the full path for a document
  237 + *
  238 + * @return string full path of document
  239 + */
  240 + function getPath() {
  241 + return Folder::getFolderPath($this->iFolderId) . $this->sFileName;
  242 + }
  243 + // }}}
  244 +
  245 + function &createFromArray($aOptions) {
  246 + return KTEntityUtil::createFromArray('KTDocumentCore', $aOptions);
  247 + }
199 } 248 }
200 249
201 ?> 250 ?>
lib/documentmanagement/documentmetadataversion.inc.php
@@ -58,19 +58,43 @@ class KTDocumentMetadataVersion extends KTEntity { @@ -58,19 +58,43 @@ class KTDocumentMetadataVersion extends KTEntity {
58 function setDocumentId($iNewValue) { $this->iDocumentId = $iNewValue; } 58 function setDocumentId($iNewValue) { $this->iDocumentId = $iNewValue; }
59 function getMetadataVersion() { return $this->iMetadataVersion; } 59 function getMetadataVersion() { return $this->iMetadataVersion; }
60 function setMetadataVersion($iNewValue) { $this->iMetadataVersion = $iNewValue; } 60 function setMetadataVersion($iNewValue) { $this->iMetadataVersion = $iNewValue; }
  61 + function getContentVersionId() { return $this->iContentVersionId; }
  62 + function setContentVersion($iNewValue) { $this->iContentVersion = $iNewValue; }
61 function getDocumentTypeId() { return $this->iDocumentTypeId; } 63 function getDocumentTypeId() { return $this->iDocumentTypeId; }
62 function setDocumentTypeId($iNewValue) { $this->iDocumentTypeId = $iNewValue; } 64 function setDocumentTypeId($iNewValue) { $this->iDocumentTypeId = $iNewValue; }
63 function getName() { return $this->sName; } 65 function getName() { return $this->sName; }
64 function setName($sNewValue) { $this->sName = $sNewValue; } 66 function setName($sNewValue) { $this->sName = $sNewValue; }
65 function getDescription() { return $this->sDescription; } 67 function getDescription() { return $this->sDescription; }
66 function setDescription($sNewValue) { $this->sDescription = $sNewValue; } 68 function setDescription($sNewValue) { $this->sDescription = $sNewValue; }
67 - function getStatusId() { return $this->sStatusId; }  
68 - function setStatusId($iNewValue) { $this->sStatusId = $iNewValue; } 69 + function getStatusId() { return $this->iStatusId; }
  70 + function setStatusId($iNewValue) { $this->iStatusId = $iNewValue; }
69 function getVersionCreated() { return $this->dVersionCreated; } 71 function getVersionCreated() { return $this->dVersionCreated; }
70 function setVersionCreated($dNewValue) { $this->dVersionCreated = $dNewValue; } 72 function setVersionCreated($dNewValue) { $this->dVersionCreated = $dNewValue; }
71 function getVersionCreatorId() { return $this->iVersionCreatorId; } 73 function getVersionCreatorId() { return $this->iVersionCreatorId; }
72 function setVersionCreatorId($iNewValue) { $this->iVersionCreatorId = $iNewValue; } 74 function setVersionCreatorId($iNewValue) { $this->iVersionCreatorId = $iNewValue; }
73 // }}} 75 // }}}
  76 +
  77 + function &createFromArray($aOptions) {
  78 + return KTEntityUtil::createFromArray('KTDocumentMetadataVersion', $aOptions);
  79 + }
  80 +
  81 + function _table() {
  82 + return KTUtil::getTableName('document_metadata_version');
  83 + }
  84 +
  85 + function create() {
  86 + if (is_null($this->iMetadataVersion)) {
  87 + $this->iMetadataVersion = 0;
  88 + }
  89 + if (is_null($this->dVersionCreated)) {
  90 + $this->dVersionCreated = getCurrentDateTime();
  91 + }
  92 + return parent::create();
  93 + }
  94 +
  95 + function &get($iId) {
  96 + return KTEntityUtil::get('KTDocumentMetadataVersion', $iId);
  97 + }
74 } 98 }
75 99
76 ?> 100 ?>
lib/documentmanagement/documentutil.inc.php
@@ -99,19 +99,15 @@ class KTDocumentUtil { @@ -99,19 +99,15 @@ class KTDocumentUtil {
99 } 99 }
100 100
101 function checkin($oDocument, $sFilename, $sCheckInComment, $oUser) { 101 function checkin($oDocument, $sFilename, $sCheckInComment, $oUser) {
102 - $sBackupPath = $oDocument->getPath() . "-" . $oDocument->getMajorVersionNumber() . "." . $oDocument->getMinorVersionNumber();  
103 - $bSuccess = @copy($oDocument->getPath(), $sBackupPath);  
104 - if ($bSuccess === false) {  
105 - return PEAR::raiseError(_("Unable to backup document prior to upload"));  
106 - }  
107 - $oVersionedDocument = KTDocumentUtil::createMetadataVersion($oDocument);  
108 - if (PEAR::isError($oVersionedDocument)) {  
109 - return $oVersionedDocument;  
110 - }  
111 -  
112 $oStorage =& KTStorageManagerUtil::getSingleton(); 102 $oStorage =& KTStorageManagerUtil::getSingleton();
113 $iFileSize = filesize($sFilename); 103 $iFileSize = filesize($sFilename);
114 104
  105 + $iPreviousMetadataVersion = $oDocument->getMetadataVersionId();
  106 +
  107 + $oDocument->startNewContentVersion();
  108 +
  109 + KTDocumentUtil::copyMetadata($oDocument, $iPreviousMetadataVersion);
  110 +
115 if (!$oStorage->upload($oDocument, $sFilename)) { 111 if (!$oStorage->upload($oDocument, $sFilename)) {
116 // reinstate the backup 112 // reinstate the backup
117 copy($sBackupPath, $oDocument->getPath()); 113 copy($sBackupPath, $oDocument->getPath());
@@ -120,8 +116,6 @@ class KTDocumentUtil { @@ -120,8 +116,6 @@ class KTDocumentUtil {
120 return PEAR::raiseError(_("An error occurred while storing the new file")); 116 return PEAR::raiseError(_("An error occurred while storing the new file"));
121 } 117 }
122 118
123 - $oDocument->setMetadataVersion($oDocument->getMetadataVersion()+1);  
124 -  
125 $oDocument->setLastModifiedDate(getCurrentDateTime()); 119 $oDocument->setLastModifiedDate(getCurrentDateTime());
126 $oDocument->setModifiedUserId($oUser->getId()); 120 $oDocument->setModifiedUserId($oUser->getId());
127 $oDocument->setIsCheckedOut(false); 121 $oDocument->setIsCheckedOut(false);
@@ -201,6 +195,7 @@ class KTDocumentUtil { @@ -201,6 +195,7 @@ class KTDocumentUtil {
201 195
202 if (is_null($oContents)) { 196 if (is_null($oContents)) {
203 $res = KTDocumentUtil::setIncomplete($oDocument, "contents"); 197 $res = KTDocumentUtil::setIncomplete($oDocument, "contents");
  198 + var_dump($res);
204 if (PEAR::isError($res)) { 199 if (PEAR::isError($res)) {
205 $oDocument->delete(); 200 $oDocument->delete();
206 return $res; 201 return $res;
@@ -287,7 +282,8 @@ class KTDocumentUtil { @@ -287,7 +282,8 @@ class KTDocumentUtil {
287 } 282 }
288 $aMetadata = $res; 283 $aMetadata = $res;
289 284
290 - $res = DBUtil::runQuery(array("DELETE FROM $table WHERE document_id = ?", array($oDocument->getID()))); 285 + $iMetadataVersionId = $oDocument->getMetadataVersionId();
  286 + $res = DBUtil::runQuery(array("DELETE FROM $table WHERE metadata_version_id = ?", array($iMetadataVersionId)));
291 if (PEAR::isError($res)) { 287 if (PEAR::isError($res)) {
292 return $res; 288 return $res;
293 } 289 }
@@ -298,7 +294,7 @@ class KTDocumentUtil { @@ -298,7 +294,7 @@ class KTDocumentUtil {
298 continue; 294 continue;
299 } 295 }
300 $res = DBUtil::autoInsert($table, array( 296 $res = DBUtil::autoInsert($table, array(
301 - "document_id" => $oDocument->getID(), 297 + "metadata_version_id" => $iMetadataVersionId,
302 "document_field_id" => $oMetadata->getID(), 298 "document_field_id" => $oMetadata->getID(),
303 "value" => $sValue, 299 "value" => $sValue,
304 )); 300 ));
@@ -312,11 +308,22 @@ class KTDocumentUtil { @@ -312,11 +308,22 @@ class KTDocumentUtil {
312 } 308 }
313 // }}} 309 // }}}
314 310
  311 + function copyMetadata($oDocument, $iPreviousMetadataVersionId) {
  312 + $iNewMetadataVersion = $oDocument->getMetadataVersionId();
  313 + $sTable = KTUtil::getTableName('document_fields_link');
  314 + $aFields = DBUtil::getResultArray(array("SELECT * FROM $sTable WHERE metadata_version_id = ?", array($iPreviousMetadataVersionId)));
  315 + foreach ($aFields as $aRow) {
  316 + unset($aRow['id']);
  317 + $aRow['metadata_version_id'] = $iNewMetadataVersion;
  318 + DBUtil::autoInsert($sTable, $aRow);
  319 + }
  320 + }
  321 +
315 // {{{ setIncomplete 322 // {{{ setIncomplete
316 function setIncomplete(&$oDocument, $reason) { 323 function setIncomplete(&$oDocument, $reason) {
317 $oDocument->setStatusID(STATUS_INCOMPLETE); 324 $oDocument->setStatusID(STATUS_INCOMPLETE);
318 $table = "document_incomplete"; 325 $table = "document_incomplete";
319 - $iId = $oDocument->getID(); 326 + $iId = $oDocument->getId();
320 $aIncomplete = DBUtil::getOneResult(array("SELECT * FROM $table WHERE id = ?", array($iId))); 327 $aIncomplete = DBUtil::getOneResult(array("SELECT * FROM $table WHERE id = ?", array($iId)));
321 if (PEAR::isError($aIncomplete)) { 328 if (PEAR::isError($aIncomplete)) {
322 return $aIncomplete; 329 return $aIncomplete;
lib/metadata/metadatautil.inc.php
@@ -591,15 +591,15 @@ class KTMetadataUtil { @@ -591,15 +591,15 @@ class KTMetadataUtil {
591 function fieldsetsForDocument($oDocument) { 591 function fieldsetsForDocument($oDocument) {
592 global $default; 592 global $default;
593 $oDocument = KTUtil::getObject('Document', $oDocument); 593 $oDocument = KTUtil::getObject('Document', $oDocument);
594 - $iDocumentId = $oDocument->getId(); 594 + $iMetadataVersionId = $oDocument->getMetadataVersionId();
595 $iDocumentTypeId = $oDocument->getDocumentTypeId(); 595 $iDocumentTypeId = $oDocument->getDocumentTypeId();
596 596
597 $sQuery = "SELECT DISTINCT F.id AS fieldset_id " . 597 $sQuery = "SELECT DISTINCT F.id AS fieldset_id " .
598 - "FROM $default->documents_table AS D INNER JOIN document_fields_link AS DFL ON D.id = DFL.document_id " . 598 + "FROM $default->document_metadata_version_table AS DM INNER JOIN document_fields_link AS DFL ON DM.id = DFL.metadata_version_id " .
599 "INNER JOIN $default->document_fields_table AS DF ON DF.ID = DFL.document_field_id " . 599 "INNER JOIN $default->document_fields_table AS DF ON DF.ID = DFL.document_field_id " .
600 "INNER JOIN $default->fieldsets_table AS F ON F.id = DF.parent_fieldset " . 600 "INNER JOIN $default->fieldsets_table AS F ON F.id = DF.parent_fieldset " .
601 - "WHERE D.id = ?";  
602 - $aParam = array($iDocumentId); 601 + "WHERE DM.id = ?";
  602 + $aParam = array($iMetadataVersionId);
603 $aDocumentFieldsetIds = DBUtil::getResultArrayKey(array($sQuery, $aParam), 'fieldset_id'); 603 $aDocumentFieldsetIds = DBUtil::getResultArrayKey(array($sQuery, $aParam), 'fieldset_id');
604 604
605 $aGenericFieldsetIds = KTFieldset::getGenericFieldsets(array('ids' => true)); 605 $aGenericFieldsetIds = KTFieldset::getGenericFieldsets(array('ids' => true));
lib/permissions/permissionutil.inc.php
@@ -177,7 +177,32 @@ class KTPermissionUtil { @@ -177,7 +177,32 @@ class KTPermissionUtil {
177 * non-recursively. 177 * non-recursively.
178 */ 178 */
179 function updatePermissionLookup(&$oFolderOrDocument) { 179 function updatePermissionLookup(&$oFolderOrDocument) {
180 - $oPO = KTPermissionObject::get($oFolderOrDocument->getPermissionObjectID()); 180 + if (!is_a($oFolderOrDocument, 'Folder')) {
  181 + if (!is_a($oFolderOrDocument, 'Document')) {
  182 + if (!is_a($oFolderOrDocument, 'KTDocumentCore')) {
  183 + echo "<pre>";
  184 + var_dump($oFolderOrDocument);
  185 + echo "</pre>";
  186 + }
  187 + }
  188 + }
  189 + $oChannel =& KTPermissionChannel::getSingleton();
  190 + if (is_a($oFolderOrDocument, 'Folder')) {
  191 + $msg = sprintf("Updating folder %s", join("/", $oFolderOrDocument->getPathArray()));
  192 + } else {
  193 + if (is_a($oFolderOrDocument, 'Document')) {
  194 + $msg = sprintf("Updating document %s", $oFolderOrDocument->getName());
  195 + } else {
  196 + $msg = sprintf("Updating document %d", $oFolderOrDocument->getId());
  197 + }
  198 + }
  199 + $oChannel->sendMessage(new KTPermissionGenericMessage($msg));
  200 +
  201 + $iPermissionObjectId = $oFolderOrDocument->getPermissionObjectID();
  202 + if (empty($iPermissionObjectId)) {
  203 + return;
  204 + }
  205 + $oPO = KTPermissionObject::get($iPermissionObjectId);
181 $aPAs = KTPermissionAssignment::getByObjectMulti($oPO); 206 $aPAs = KTPermissionAssignment::getByObjectMulti($oPO);
182 $aMapPermAllowed = array(); 207 $aMapPermAllowed = array();
183 foreach ($aPAs as $oPA) { 208 foreach ($aPAs as $oPA) {
@@ -476,4 +501,37 @@ class KTPermissionUtil { @@ -476,4 +501,37 @@ class KTPermissionUtil {
476 // }}} 501 // }}}
477 } 502 }
478 503
  504 +class KTPermissionChannel {
  505 + var $observers = array();
  506 +
  507 + function &getSingleton() {
  508 + if (!KTUtil::arrayGet($GLOBALS, 'KT_PermissionChannel')) {
  509 + $GLOBALS['KT_PermissionChannel'] = new KTPermissionChannel;
  510 + }
  511 + return $GLOBALS['KT_PermissionChannel'];
  512 + }
  513 +
  514 + function sendMessage(&$msg) {
  515 + foreach ($this->observers as $oObserver) {
  516 + $oObserver->receiveMessage($msg);
  517 + }
  518 + }
  519 +
  520 + function addObserver(&$obs) {
  521 + array_push($this->observers, $obs);
  522 + }
  523 +}
  524 +
  525 +class KTPermissionGenericMessage {
  526 + function KTPermissionGenericMessage($sMessage) {
  527 + $this->sMessage = $sMessage;
  528 + }
  529 +
  530 + function getString() {
  531 + return $this->sMessage;
  532 + }
  533 +}
  534 +
  535 +
  536 +
479 ?> 537 ?>
lib/search/searchutil.inc.php
@@ -252,16 +252,20 @@ class KTSearchUtil { @@ -252,16 +252,20 @@ class KTSearchUtil {
252 } 252 }
253 253
254 //$sQuery = DBUtil::compactQuery(" 254 //$sQuery = DBUtil::compactQuery("
255 - $sQuery = (" 255 + $sQuery = sprintf("
256 SELECT 256 SELECT
257 $sSelect 257 $sSelect
258 FROM 258 FROM
259 - $default->documents_table AS D 259 + %s AS D
  260 + LEFT JOIN %s AS DM ON D.metadata_version_id = DM.id
  261 + LEFT JOIN %s AS DC ON DM.content_version_id = DC.id
260 INNER JOIN $default->status_table AS SL on D.status_id=SL.id 262 INNER JOIN $default->status_table AS SL on D.status_id=SL.id
261 $sInitialJoin 263 $sInitialJoin
262 $sCritJoinSQL 264 $sCritJoinSQL
263 $sPermissionJoin 265 $sPermissionJoin
264 - $sWhere"); 266 + $sWhere", KTUtil::getTableName('documents'),
  267 + KTUtil::getTableName('document_metadata_version'),
  268 + KTUtil::getTableName('document_content_version'));
265 // GROUP BY D.id 269 // GROUP BY D.id
266 270
267 $aParams = array(); 271 $aParams = array();
lib/storage/ondiskpathstoragemanager.inc.php
@@ -71,7 +71,7 @@ class KTOnDiskPathStorageManager extends KTStorageManager { @@ -71,7 +71,7 @@ class KTOnDiskPathStorageManager extends KTStorageManager {
71 } 71 }
72 72
73 function generateStoragePath(&$oDocument) { 73 function generateStoragePath(&$oDocument) {
74 - $sStoragePath = sprintf("%s/%s", Document::_generateFolderPath($oDocument->getFolderID()), $oDocument->getFileName()); 74 + $sStoragePath = sprintf("%s/%s-%s", KTDocumentCore::_generateFolderPath($oDocument->getFolderID()), $oDocument->getContentVersionId(), $oDocument->getFileName());
75 return $sStoragePath; 75 return $sStoragePath;
76 } 76 }
77 77
@@ -155,8 +155,8 @@ class KTOnDiskPathStorageManager extends KTStorageManager { @@ -155,8 +155,8 @@ class KTOnDiskPathStorageManager extends KTStorageManager {
155 global $default; 155 global $default;
156 156
157 $oConfig =& KTConfig::getSingleton(); 157 $oConfig =& KTConfig::getSingleton();
158 - $sCurrentPath = sprintf("%s/%s/%s", $oConfig->get('urls/documentRoot'), Document::_generateFolderPath($oSourceFolder->getID()), $oDocument->getFileName());  
159 - $sDestinationPath = sprintf("%s/%s/%s", $oConfig->get('urls/documentRoot'), Document::_generateFolderPath($oDestinationFolder->getID()), $oDocument->getFileName()); 158 + $sCurrentPath = sprintf("%s/%s/%s", $oConfig->get('urls/documentRoot'), KTDocumentCore::_generateFolderPath($oSourceFolder->getID()), $oDocument->getFileName());
  159 + $sDestinationPath = sprintf("%s/%s/%s", $oConfig->get('urls/documentRoot'), KTDocumentCore::_generateFolderPath($oDestinationFolder->getID()), $oDocument->getFileName());
160 160
161 // find all the previous versions of this document and move them 161 // find all the previous versions of this document and move them
162 // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions 162 // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions
@@ -191,7 +191,7 @@ class KTOnDiskPathStorageManager extends KTStorageManager { @@ -191,7 +191,7 @@ class KTOnDiskPathStorageManager extends KTStorageManager {
191 $default->log->error("KTOnDiskPathStorageManager->moveDocument couldn't move $sCurrentPath to $sDestinationPath, documentID=" . $oDocument->getID()); 191 $default->log->error("KTOnDiskPathStorageManager->moveDocument couldn't move $sCurrentPath to $sDestinationPath, documentID=" . $oDocument->getID());
192 return $res; 192 return $res;
193 } 193 }
194 - $sStoragePath = sprintf("%s/%s", Document::_generateFolderPath($oDestinationFolder->getID()), $oDocument->getFileName()); 194 + $sStoragePath = sprintf("%s/%s", KTDocumentCore::_generateFolderPath($oDestinationFolder->getID()), $oDocument->getFileName());
195 $this->setPath($oDocument, $sStoragePath); 195 $this->setPath($oDocument, $sStoragePath);
196 return true; 196 return true;
197 } 197 }
lib/upgrades/UpgradeFunctions.inc.php
@@ -6,6 +6,7 @@ class UpgradeFunctions { @@ -6,6 +6,7 @@ class UpgradeFunctions {
6 "2.0.6" => array("addTemplateMimeTypes"), 6 "2.0.6" => array("addTemplateMimeTypes"),
7 "2.0.8" => array("setPermissionObject"), 7 "2.0.8" => array("setPermissionObject"),
8 "2.99.1" => array("createFieldSets"), 8 "2.99.1" => array("createFieldSets"),
  9 + "2.99.7" => array("normaliseDocuments"), #, "createLdapAuthenticationProvider"),
9 ); 10 );
10 11
11 var $descriptions = array( 12 var $descriptions = array(
@@ -14,10 +15,12 @@ class UpgradeFunctions { @@ -14,10 +15,12 @@ class UpgradeFunctions {
14 "addTemplateMimeTypes" => "Add MIME types for Excel and Word templates", 15 "addTemplateMimeTypes" => "Add MIME types for Excel and Word templates",
15 "setPermissionObject" => "Set the permission object in charge of a document or folder", 16 "setPermissionObject" => "Set the permission object in charge of a document or folder",
16 "createFieldSets" => "Create a fieldset for each field without one", 17 "createFieldSets" => "Create a fieldset for each field without one",
  18 + "normaliseDocuments" => "Normalise the documents table",
17 ); 19 );
18 var $phases = array( 20 var $phases = array(
19 "setPermissionObject" => 1, 21 "setPermissionObject" => 1,
20 "createFieldSets" => 1, 22 "createFieldSets" => 1,
  23 + "normaliseDocuments" => 1,
21 ); 24 );
22 25
23 // {{{ _setPermissionFolder 26 // {{{ _setPermissionFolder
@@ -265,6 +268,60 @@ class UpgradeFunctions { @@ -265,6 +268,60 @@ class UpgradeFunctions {
265 } 268 }
266 } 269 }
267 // }}} 270 // }}}
  271 +
  272 + // {{{ normaliseDocuments
  273 + function normaliseDocuments() {
  274 + $sTable = KTUtil::getTableName('documents');
  275 + DBUtil::runQuery("SET FOREIGN_KEY_CHECKS=0");
  276 + $aDocuments = DBUtil::getResultArray("SELECT * FROM $sTable WHERE metadata_version_id IS NULL");
  277 + foreach ($aDocuments as $aRow) {
  278 + print "Document ID: " . $aRow['id'];
  279 + $aContentInfo = array(
  280 + 'document_id' => $aRow['id'],
  281 + 'filename' => $aRow['filename'],
  282 + 'size' => $aRow['size'],
  283 + 'mime_id' => $aRow['mime_id'],
  284 + 'major_version' => $aRow['major_version'],
  285 + 'minor_version' => $aRow['minor_version'],
  286 + 'storage_path' => $aRow['storage_path'],
  287 + );
  288 + $iContentId = DBUtil::autoInsert(KTUtil::getTableName('document_content_version'), $aContentInfo);
  289 + print "Content ID: " . $iContentId;
  290 + $aMetadataInfo = array(
  291 + 'document_id' => $aRow['id'],
  292 + 'content_version_id' => $iContentId,
  293 + 'document_type_id' => $aRow['document_type_id'],
  294 + 'name' => $aRow['name'],
  295 + 'description' => $aRow['description'],
  296 + 'status_id' => $aRow['status_id'],
  297 + 'metadata_version' => $aRow['metadata_version'],
  298 + 'version_created' => $aRow['created'],
  299 + 'version_creator_id' => $aRow['creator_id'],
  300 + );
  301 + $iMetadataId = DBUtil::autoInsert(KTUtil::getTableName('document_metadata_version'), $aMetadataInfo);
  302 + print "Metadata ID: " . $iMetadataId;
  303 + if (PEAR::isError($iMetadataId)) {
  304 + var_dump($iMetadataId);
  305 + }
  306 + DBUtil::runQuery(array("UPDATE $sTable SET metadata_version_id = ? WHERE id = ?", array($iMetadataId, $aRow['id'])));
  307 + print "\n";
  308 + }
  309 + DBUtil::runQuery("SET FOREIGN_KEY_CHECKS=1");
  310 +
  311 + $aDocumentMap = array();
  312 + $sTable = KTUtil::getTableName('document_fields_link');
  313 + $sDocumentsTable = KTUtil::getTableName('documents');
  314 + $aInfo = DBUtil::getResultArray("SELECT id, document_id, document_field_id, value FROM $sTable WHERE metadata_version_id IS NULL");
  315 + foreach ($aInfo as $aRow) {
  316 + $iMetadataVersionId = KTUtil::arrayGet($aDocumentMap, $aRow['document_id']);
  317 + if (empty($iMetadataVersionId)) {
  318 + $iMetadataVersionId = DBUtil::getOneResultKey(array("SELECT metadata_version_id FROM $sDocumentsTable WHERE id = ?", array($aRow['document_id'])), 'metadata_version_id');
  319 + $aDocumentMap[$aRow['document_id']] = $iMetadataVersionId;
  320 + }
  321 + DBUtil::runQuery(array("UPDATE $sTable SET metadata_version_id = ? WHERE id = ?", array($iMetadataVersionId, $aRow['id'])));
  322 + }
  323 + }
  324 + // }}}
268 } 325 }
269 326
270 ?> 327 ?>
lib/upgrades/UpgradeItems.inc.php
@@ -256,7 +256,7 @@ class SQLUpgradeItem extends UpgradeItem { @@ -256,7 +256,7 @@ class SQLUpgradeItem extends UpgradeItem {
256 $phase = 0; 256 $phase = 0;
257 return array($fromVersion, $toVersion, $description, $phase); 257 return array($fromVersion, $toVersion, $description, $phase);
258 } 258 }
259 - $matched = preg_match('#^([\d.]*)/(?:(\d)-)?(.*)\.sql$#', $path, $matches); 259 + $matched = preg_match('#^([\d.]*)/(?:(\d*)-)?(.*)\.sql$#', $path, $matches);
260 if ($matched != 0) { 260 if ($matched != 0) {
261 $fromVersion = $matches[1]; 261 $fromVersion = $matches[1];
262 $toVersion = $matches[1]; 262 $toVersion = $matches[1];
plugins/ktcore/KTFolderActions.php
@@ -116,6 +116,7 @@ class KTFolderPermissionsAction extends KTFolderAction { @@ -116,6 +116,7 @@ class KTFolderPermissionsAction extends KTFolderAction {
116 } 116 }
117 117
118 function do_update() { 118 function do_update() {
  119 + require_once(KT_LIB_DIR . "/documentmanagement/observers.inc.php");
119 $oPO = KTPermissionObject::get($this->oFolder->getPermissionObjectId()); 120 $oPO = KTPermissionObject::get($this->oFolder->getPermissionObjectId());
120 $aFoo = $_REQUEST['foo']; 121 $aFoo = $_REQUEST['foo'];
121 $aPermissions = KTPermission::getList(); 122 $aPermissions = KTPermission::getList();
@@ -124,9 +125,17 @@ class KTFolderPermissionsAction extends KTFolderAction { @@ -124,9 +125,17 @@ class KTFolderPermissionsAction extends KTFolderAction {
124 $aAllowed = KTUtil::arrayGet($aFoo, $iPermId, array()); 125 $aAllowed = KTUtil::arrayGet($aFoo, $iPermId, array());
125 KTPermissionUtil::setPermissionForId($oPermission, $oPO, $aAllowed); 126 KTPermissionUtil::setPermissionForId($oPermission, $oPO, $aAllowed);
126 } 127 }
  128 +
  129 + $po =& new JavascriptObserver($this);
  130 + $po->start();
  131 + $oChannel =& KTPermissionChannel::getSingleton();
  132 + $oChannel->addObserver($po);
  133 +
127 KTPermissionUtil::updatePermissionLookupForPO($oPO); 134 KTPermissionUtil::updatePermissionLookupForPO($oPO);
128 - return $this->successRedirectToMain(_('Permissions updated'),  
129 - array('fFolderId' => $this->oFolder->getId())); 135 +
  136 + $this->commitTransaction();
  137 +
  138 + $po->redirect(KTUtil::addQueryString($_SERVER['PHP_SELF'], "fFolderId=" . $this->oFolder->getId()));
130 } 139 }
131 140
132 function do_copyPermissions() { 141 function do_copyPermissions() {
setup/postcheckup.php
@@ -64,8 +64,8 @@ if ($handle !== false) { @@ -64,8 +64,8 @@ if ($handle !== false) {
64 64
65 <?php 65 <?php
66 if (PEAR::isError($loggingSupport)) { 66 if (PEAR::isError($loggingSupport)) {
67 - print "<p>Logging support is not currently working. Error is: " .  
68 - htmlentities($loggingSupport->toString()) . "</p>"; 67 + print '<p><font color="red">Logging support is not currently working. Error is: ' .
  68 + htmlentities($loggingSupport->toString()) . '</font></p>';
69 } else { 69 } else {
70 ?> 70 ?>
71 <p>Logging support is operational.</p> 71 <p>Logging support is operational.</p>
setup/upgrade.php
1 <?php 1 <?php
2 2
  3 +$GLOBALS["checkup"] = true;
  4 +
3 require_once('../config/dmsDefaults.php'); 5 require_once('../config/dmsDefaults.php');
4 require_once(KT_LIB_DIR . '/upgrades/upgrade.inc.php'); 6 require_once(KT_LIB_DIR . '/upgrades/upgrade.inc.php');
5 7
@@ -48,21 +50,20 @@ function performAllUpgrades () { @@ -48,21 +50,20 @@ function performAllUpgrades () {
48 50
49 $upgrades = describeUpgrade($lastVersion, $currentVersion); 51 $upgrades = describeUpgrade($lastVersion, $currentVersion);
50 52
51 - $ret = "<table width=\"100%\">\n";  
52 - $ret .= "<tr><th>Description</th><th>Result</th></tr>\n"; 53 + print "<table width=\"100%\">\n";
  54 + print "<tr><th>Description</th><th>Result</th></tr>\n";
53 foreach ($upgrades as $upgrade) { 55 foreach ($upgrades as $upgrade) {
54 $res = $upgrade->performUpgrade(); 56 $res = $upgrade->performUpgrade();
55 - $ret .= sprintf('<tr><td>%s</td><td>%s</td></tr>', 57 + printf("<tr><td>%s</td><td>%s</td></tr>\n",
56 htmlspecialchars($upgrade->getDescription()), 58 htmlspecialchars($upgrade->getDescription()),
57 htmlspecialchars(showResult($res))); 59 htmlspecialchars(showResult($res)));
58 } 60 }
59 - $ret .= '</table>'; 61 + print '</table>';
60 return $ret; 62 return $ret;
61 } 63 }
62 64
63 if ($_REQUEST["go"] === "Upgrade") { 65 if ($_REQUEST["go"] === "Upgrade") {
64 $performingUpgrade = true; 66 $performingUpgrade = true;
65 - $upgradeTable = performAllUpgrades();  
66 } else { 67 } else {
67 $upgradeTable = generateUpgradeTable(); 68 $upgradeTable = generateUpgradeTable();
68 } 69 }
@@ -81,7 +82,6 @@ td { vertical-align: top; } @@ -81,7 +82,6 @@ td { vertical-align: top; }
81 82
82 <?php 83 <?php
83 84
84 -if ($upgradeTable) {  
85 if (!$performingUpgrade) { 85 if (!$performingUpgrade) {
86 print " 86 print "
87 <p>The table below describes the upgrades that need to occur to 87 <p>The table below describes the upgrades that need to occur to
@@ -93,6 +93,8 @@ if ($upgradeTable) { @@ -93,6 +93,8 @@ if ($upgradeTable) {
93 <p>The table below describes the upgrades that have occurred to 93 <p>The table below describes the upgrades that have occurred to
94 upgrade your KnowledgeTree installation to <strong>$default->systemVersion</strong>. 94 upgrade your KnowledgeTree installation to <strong>$default->systemVersion</strong>.
95 "; 95 ";
  96 +
  97 + $upgradeTable = performAllUpgrades();
96 } 98 }
97 99
98 print $upgradeTable; 100 print $upgradeTable;
@@ -102,9 +104,6 @@ if ($upgradeTable) { @@ -102,9 +104,6 @@ if ($upgradeTable) {
102 } else { 104 } else {
103 print '<form><input type="submit" name="go" value="ShowUpgrades" /></form>'; 105 print '<form><input type="submit" name="go" value="ShowUpgrades" /></form>';
104 } 106 }
105 -} else {  
106 -  
107 -}  
108 ?> 107 ?>
109 </body> 108 </body>
110 </html> 109 </html>
sql/mysql/install/data.sql
1 -- phpMyAdmin SQL Dump 1 -- phpMyAdmin SQL Dump
2 --- version 2.6.4-pl4-Debian-1 2 +-- version 2.7.0-pl2-Debian-1
3 -- http://www.phpmyadmin.net 3 -- http://www.phpmyadmin.net
4 -- 4 --
5 -- Host: localhost 5 -- Host: localhost
6 --- Generation Time: Dec 15, 2005 at 06:22 PM 6 +-- Generation Time: Jan 20, 2006 at 05:07 PM
7 -- Server version: 4.1.15 7 -- Server version: 4.1.15
8 -- PHP Version: 4.4.0-3 8 -- PHP Version: 4.4.0-3
9 9
@@ -40,16 +40,6 @@ INSERT INTO `archiving_type_lookup` VALUES (2, &#39;Utilisation&#39;); @@ -40,16 +40,6 @@ INSERT INTO `archiving_type_lookup` VALUES (2, &#39;Utilisation&#39;);
40 40
41 41
42 -- 42 --
43 --- Dumping data for table `browse_criteria`  
44 ---  
45 -  
46 -INSERT INTO `browse_criteria` VALUES (1, -1, 0);  
47 -INSERT INTO `browse_criteria` VALUES (2, -2, 1);  
48 -INSERT INTO `browse_criteria` VALUES (3, -3, 2);  
49 -INSERT INTO `browse_criteria` VALUES (4, -4, 3);  
50 -INSERT INTO `browse_criteria` VALUES (5, -5, 4);  
51 -  
52 ---  
53 -- Dumping data for table `dashlet_disables` 43 -- Dumping data for table `dashlet_disables`
54 -- 44 --
55 45
@@ -65,27 +55,22 @@ INSERT INTO `data_types` VALUES (4, &#39;INT&#39;); @@ -65,27 +55,22 @@ INSERT INTO `data_types` VALUES (4, &#39;INT&#39;);
65 INSERT INTO `data_types` VALUES (5, 'FLOAT'); 55 INSERT INTO `data_types` VALUES (5, 'FLOAT');
66 56
67 -- 57 --
68 --- Dumping data for table `dependant_document_instance`  
69 ---  
70 -  
71 -  
72 ---  
73 --- Dumping data for table `dependant_document_template` 58 +-- Dumping data for table `discussion_comments`
74 -- 59 --
75 60
76 61
77 -- 62 --
78 --- Dumping data for table `discussion_comments` 63 +-- Dumping data for table `discussion_threads`
79 -- 64 --
80 65
81 66
82 -- 67 --
83 --- Dumping data for table `discussion_threads` 68 +-- Dumping data for table `document_archiving_link`
84 -- 69 --
85 70
86 71
87 -- 72 --
88 --- Dumping data for table `document_archiving_link` 73 +-- Dumping data for table `document_content_version`
89 -- 74 --
90 75
91 76
@@ -118,6 +103,11 @@ INSERT INTO `document_link_types` VALUES (-1, &#39;depended on&#39;, &#39;was depended on by @@ -118,6 +103,11 @@ INSERT INTO `document_link_types` VALUES (-1, &#39;depended on&#39;, &#39;was depended on by
118 INSERT INTO `document_link_types` VALUES (0, 'Default', 'Default (reverse)', 'Default link type'); 103 INSERT INTO `document_link_types` VALUES (0, 'Default', 'Default (reverse)', 'Default link type');
119 104
120 -- 105 --
  106 +-- Dumping data for table `document_metadata_version`
  107 +--
  108 +
  109 +
  110 +--
121 -- Dumping data for table `document_searchable_text` 111 -- Dumping data for table `document_searchable_text`
122 -- 112 --
123 113
@@ -235,16 +225,6 @@ INSERT INTO `folders` VALUES (2, &#39;Default Unit&#39;, &#39;Default Unit Root Folder&#39;, 1, @@ -235,16 +225,6 @@ INSERT INTO `folders` VALUES (2, &#39;Default Unit&#39;, &#39;Default Unit Root Folder&#39;, 1,
235 225
236 226
237 -- 227 --
238 --- Dumping data for table `groups_folders_approval_link`  
239 ---  
240 -  
241 -  
242 ---  
243 --- Dumping data for table `groups_folders_link`  
244 ---  
245 -  
246 -  
247 ---  
248 -- Dumping data for table `groups_groups_link` 228 -- Dumping data for table `groups_groups_link`
249 -- 229 --
250 230
@@ -622,6 +602,11 @@ INSERT INTO `permissions` VALUES (2, &#39;ktcore.permissions.write&#39;, &#39;Core: Write&#39;, @@ -622,6 +602,11 @@ INSERT INTO `permissions` VALUES (2, &#39;ktcore.permissions.write&#39;, &#39;Core: Write&#39;,
622 INSERT INTO `permissions` VALUES (3, 'ktcore.permissions.addFolder', 'Core: Add Folder', 1); 602 INSERT INTO `permissions` VALUES (3, 'ktcore.permissions.addFolder', 'Core: Add Folder', 1);
623 603
624 -- 604 --
  605 +-- Dumping data for table `plugins`
  606 +--
  607 +
  608 +
  609 +--
625 -- Dumping data for table `role_allocations` 610 -- Dumping data for table `role_allocations`
626 -- 611 --
627 612
@@ -655,7 +640,7 @@ INSERT INTO `status_lookup` VALUES (4, &#39;Archived&#39;); @@ -655,7 +640,7 @@ INSERT INTO `status_lookup` VALUES (4, &#39;Archived&#39;);
655 -- 640 --
656 641
657 INSERT INTO `system_settings` VALUES (1, 'lastIndexUpdate', '0'); 642 INSERT INTO `system_settings` VALUES (1, 'lastIndexUpdate', '0');
658 -INSERT INTO `system_settings` VALUES (2, 'knowledgeTreeVersion', '2.99.5'); 643 +INSERT INTO `system_settings` VALUES (2, 'knowledgeTreeVersion', '2.99.7');
659 INSERT INTO `system_settings` VALUES (3, 'databaseVersion', '2.99.5'); 644 INSERT INTO `system_settings` VALUES (3, 'databaseVersion', '2.99.5');
660 645
661 -- 646 --
@@ -709,6 +694,33 @@ INSERT INTO `upgrades` VALUES (20, &#39;upgrade*2.99.1*0*upgrade2.99.1&#39;, &#39;Upgrade fr @@ -709,6 +694,33 @@ INSERT INTO `upgrades` VALUES (20, &#39;upgrade*2.99.1*0*upgrade2.99.1&#39;, &#39;Upgrade fr
709 INSERT INTO `upgrades` VALUES (21, 'sql*2.99.1*0*2.99.1/workflow.sql', 'Database upgrade to version 2.99.1: Workflow', '2005-10-07 14:26:15', 1, 'upgrade*2.99.1*0*upgrade2.99.1'); 694 INSERT INTO `upgrades` VALUES (21, 'sql*2.99.1*0*2.99.1/workflow.sql', 'Database upgrade to version 2.99.1: Workflow', '2005-10-07 14:26:15', 1, 'upgrade*2.99.1*0*upgrade2.99.1');
710 INSERT INTO `upgrades` VALUES (22, 'sql*2.99.1*0*2.99.1/fieldsets.sql', 'Database upgrade to version 2.99.1: Fieldsets', '2005-10-07 14:26:16', 1, 'upgrade*2.99.1*0*upgrade2.99.1'); 695 INSERT INTO `upgrades` VALUES (22, 'sql*2.99.1*0*2.99.1/fieldsets.sql', 'Database upgrade to version 2.99.1: Fieldsets', '2005-10-07 14:26:16', 1, 'upgrade*2.99.1*0*upgrade2.99.1');
711 INSERT INTO `upgrades` VALUES (23, 'func*2.99.1*1*createFieldSets', 'Create a fieldset for each field without one', '2005-10-07 14:26:16', 1, 'upgrade*2.99.1*0*upgrade2.99.1'); 696 INSERT INTO `upgrades` VALUES (23, 'func*2.99.1*1*createFieldSets', 'Create a fieldset for each field without one', '2005-10-07 14:26:16', 1, 'upgrade*2.99.1*0*upgrade2.99.1');
  697 +INSERT INTO `upgrades` VALUES (24, 'sql*2.99.2*0*2.99.2/saved_searches.sql', '', '0000-00-00 00:00:00', 1, NULL);
  698 +INSERT INTO `upgrades` VALUES (25, 'sql*2.99.2*0*2.99.2/transactions.sql', '', '0000-00-00 00:00:00', 1, NULL);
  699 +INSERT INTO `upgrades` VALUES (26, 'sql*2.99.2*0*2.99.2/field_mandatory.sql', '', '0000-00-00 00:00:00', 1, NULL);
  700 +INSERT INTO `upgrades` VALUES (27, 'sql*2.99.2*0*2.99.2/fieldsets_system.sql', '', '0000-00-00 00:00:00', 1, NULL);
  701 +INSERT INTO `upgrades` VALUES (28, 'sql*2.99.2*0*2.99.2/permission_by_user_and_roles.sql', '', '0000-00-00 00:00:00', 1, NULL);
  702 +INSERT INTO `upgrades` VALUES (29, 'sql*2.99.2*0*2.99.2/disabled_metadata.sql', '', '0000-00-00 00:00:00', 1, NULL);
  703 +INSERT INTO `upgrades` VALUES (30, 'sql*2.99.2*0*2.99.2/searchable_text.sql', '', '0000-00-00 00:00:00', 1, NULL);
  704 +INSERT INTO `upgrades` VALUES (31, 'sql*2.99.2*0*2.99.2/workflow.sql', '', '0000-00-00 00:00:00', 1, NULL);
  705 +INSERT INTO `upgrades` VALUES (32, 'sql*2.99.2*1*2.99.2/1-constraints.sql', '', '0000-00-00 00:00:00', 1, NULL);
  706 +INSERT INTO `upgrades` VALUES (33, 'sql*2.99.3*0*2.99.3/notifications.sql', '', '0000-00-00 00:00:00', 1, NULL);
  707 +INSERT INTO `upgrades` VALUES (34, 'sql*2.99.3*0*2.99.3/last_modified_user.sql', '', '0000-00-00 00:00:00', 1, NULL);
  708 +INSERT INTO `upgrades` VALUES (35, 'sql*2.99.3*0*2.99.3/authentication_sources.sql', '', '0000-00-00 00:00:00', 1, NULL);
  709 +INSERT INTO `upgrades` VALUES (36, 'sql*2.99.3*0*2.99.3/document_fields_constraints.sql', '', '0000-00-00 00:00:00', 1, NULL);
  710 +INSERT INTO `upgrades` VALUES (37, 'sql*2.99.5*0*2.99.5/dashlet_disabling.sql', '', '0000-00-00 00:00:00', 1, NULL);
  711 +INSERT INTO `upgrades` VALUES (38, 'sql*2.99.5*0*2.99.5/role_allocations.sql', '', '0000-00-00 00:00:00', 1, NULL);
  712 +INSERT INTO `upgrades` VALUES (39, 'sql*2.99.5*0*2.99.5/transaction_namespaces.sql', '', '0000-00-00 00:00:00', 1, NULL);
  713 +INSERT INTO `upgrades` VALUES (40, 'sql*2.99.5*0*2.99.5/fieldset_field_descriptions.sql', '', '0000-00-00 00:00:00', 1, NULL);
  714 +INSERT INTO `upgrades` VALUES (41, 'sql*2.99.5*0*2.99.5/role_changes.sql', '', '0000-00-00 00:00:00', 1, NULL);
  715 +INSERT INTO `upgrades` VALUES (42, 'sql*2.99.6*0*2.99.6/table_cleanup.sql', 'Database upgrade to version 2.99.6: Table cleanup', '2006-01-20 17:04:05', 1, 'upgrade*2.99.7*99*upgrade2.99.7');
  716 +INSERT INTO `upgrades` VALUES (43, 'sql*2.99.6*0*2.99.6/plugin-registration.sql', 'Database upgrade to version 2.99.6: Plugin-registration', '2006-01-20 17:04:05', 1, 'upgrade*2.99.7*99*upgrade2.99.7');
  717 +INSERT INTO `upgrades` VALUES (44, 'sql*2.99.7*0*2.99.7/documents_normalisation.sql', 'Database upgrade to version 2.99.7: Documents normalisation', '2006-01-20 17:04:05', 1, 'upgrade*2.99.7*99*upgrade2.99.7');
  718 +INSERT INTO `upgrades` VALUES (45, 'sql*2.99.7*0*2.99.7/help_replacement.sql', 'Database upgrade to version 2.99.7: Help replacement', '2006-01-20 17:04:05', 1, 'upgrade*2.99.7*99*upgrade2.99.7');
  719 +INSERT INTO `upgrades` VALUES (46, 'sql*2.99.7*0*2.99.7/table_cleanup.sql', 'Database upgrade to version 2.99.7: Table cleanup', '2006-01-20 17:04:07', 1, 'upgrade*2.99.7*99*upgrade2.99.7');
  720 +INSERT INTO `upgrades` VALUES (47, 'func*2.99.7*1*normaliseDocuments', 'Normalise the documents table', '2006-01-20 17:04:07', 1, 'upgrade*2.99.7*99*upgrade2.99.7');
  721 +INSERT INTO `upgrades` VALUES (48, 'sql*2.99.7*10*2.99.7/10-documents_normalisation.sql', 'Database upgrade to version 2.99.7: Documents normalisation', '2006-01-20 17:04:07', 1, 'upgrade*2.99.7*99*upgrade2.99.7');
  722 +INSERT INTO `upgrades` VALUES (49, 'sql*2.99.7*20*2.99.7/20-fields.sql', 'Database upgrade to version 2.99.7: Fields', '2006-01-20 17:04:07', 1, 'upgrade*2.99.7*99*upgrade2.99.7');
  723 +INSERT INTO `upgrades` VALUES (50, 'upgrade*2.99.7*99*upgrade2.99.7', 'Upgrade from version 2.99.5 to 2.99.7', '2006-01-20 17:04:07', 1, 'upgrade*2.99.7*99*upgrade2.99.7');
712 724
713 -- 725 --
714 -- Dumping data for table `users` 726 -- Dumping data for table `users`
@@ -727,24 +739,6 @@ INSERT INTO `users_groups_link` VALUES (2, 2, 2); @@ -727,24 +739,6 @@ INSERT INTO `users_groups_link` VALUES (2, 2, 2);
727 INSERT INTO `users_groups_link` VALUES (3, 3, 3); 739 INSERT INTO `users_groups_link` VALUES (3, 3, 3);
728 740
729 -- 741 --
730 --- Dumping data for table `web_documents`  
731 ---  
732 -  
733 -  
734 ---  
735 --- Dumping data for table `web_documents_status_lookup`  
736 ---  
737 -  
738 -INSERT INTO `web_documents_status_lookup` VALUES (1, 'Pending');  
739 -INSERT INTO `web_documents_status_lookup` VALUES (2, 'Published');  
740 -INSERT INTO `web_documents_status_lookup` VALUES (3, 'Not Published');  
741 -  
742 ---  
743 --- Dumping data for table `web_sites`  
744 ---  
745 -  
746 -  
747 ---  
748 -- Dumping data for table `workflow_actions` 742 -- Dumping data for table `workflow_actions`
749 -- 743 --
750 744
@@ -807,6 +801,7 @@ INSERT INTO `zseq_archiving_type_lookup` VALUES (2); @@ -807,6 +801,7 @@ INSERT INTO `zseq_archiving_type_lookup` VALUES (2);
807 -- Dumping data for table `zseq_authentication_sources` 801 -- Dumping data for table `zseq_authentication_sources`
808 -- 802 --
809 803
  804 +INSERT INTO `zseq_authentication_sources` VALUES (1);
810 805
811 -- 806 --
812 -- Dumping data for table `zseq_browse_criteria` 807 -- Dumping data for table `zseq_browse_criteria`
@@ -818,6 +813,7 @@ INSERT INTO `zseq_browse_criteria` VALUES (5); @@ -818,6 +813,7 @@ INSERT INTO `zseq_browse_criteria` VALUES (5);
818 -- Dumping data for table `zseq_dashlet_disables` 813 -- Dumping data for table `zseq_dashlet_disables`
819 -- 814 --
820 815
  816 +INSERT INTO `zseq_dashlet_disables` VALUES (1);
821 817
822 -- 818 --
823 -- Dumping data for table `zseq_data_types` 819 -- Dumping data for table `zseq_data_types`
@@ -856,6 +852,12 @@ INSERT INTO `zseq_discussion_threads` VALUES (1); @@ -856,6 +852,12 @@ INSERT INTO `zseq_discussion_threads` VALUES (1);
856 INSERT INTO `zseq_document_archiving_link` VALUES (1); 852 INSERT INTO `zseq_document_archiving_link` VALUES (1);
857 853
858 -- 854 --
  855 +-- Dumping data for table `zseq_document_content_version`
  856 +--
  857 +
  858 +INSERT INTO `zseq_document_content_version` VALUES (1);
  859 +
  860 +--
859 -- Dumping data for table `zseq_document_fields` 861 -- Dumping data for table `zseq_document_fields`
860 -- 862 --
861 863
@@ -880,6 +882,12 @@ INSERT INTO `zseq_document_link` VALUES (1); @@ -880,6 +882,12 @@ INSERT INTO `zseq_document_link` VALUES (1);
880 INSERT INTO `zseq_document_link_types` VALUES (2); 882 INSERT INTO `zseq_document_link_types` VALUES (2);
881 883
882 -- 884 --
  885 +-- Dumping data for table `zseq_document_metadata_version`
  886 +--
  887 +
  888 +INSERT INTO `zseq_document_metadata_version` VALUES (1);
  889 +
  890 +--
883 -- Dumping data for table `zseq_document_subscriptions` 891 -- Dumping data for table `zseq_document_subscriptions`
884 -- 892 --
885 893
@@ -907,6 +915,7 @@ INSERT INTO `zseq_document_type_fields_link` VALUES (1); @@ -907,6 +915,7 @@ INSERT INTO `zseq_document_type_fields_link` VALUES (1);
907 -- Dumping data for table `zseq_document_type_fieldsets_link` 915 -- Dumping data for table `zseq_document_type_fieldsets_link`
908 -- 916 --
909 917
  918 +INSERT INTO `zseq_document_type_fieldsets_link` VALUES (1);
910 919
911 -- 920 --
912 -- Dumping data for table `zseq_document_types_lookup` 921 -- Dumping data for table `zseq_document_types_lookup`
@@ -924,11 +933,13 @@ INSERT INTO `zseq_documents` VALUES (1); @@ -924,11 +933,13 @@ INSERT INTO `zseq_documents` VALUES (1);
924 -- Dumping data for table `zseq_field_behaviours` 933 -- Dumping data for table `zseq_field_behaviours`
925 -- 934 --
926 935
  936 +INSERT INTO `zseq_field_behaviours` VALUES (1);
927 937
928 -- 938 --
929 -- Dumping data for table `zseq_field_value_instances` 939 -- Dumping data for table `zseq_field_value_instances`
930 -- 940 --
931 941
  942 +INSERT INTO `zseq_field_value_instances` VALUES (1);
932 943
933 -- 944 --
934 -- Dumping data for table `zseq_fieldsets` 945 -- Dumping data for table `zseq_fieldsets`
@@ -961,21 +972,10 @@ INSERT INTO `zseq_folders` VALUES (2); @@ -961,21 +972,10 @@ INSERT INTO `zseq_folders` VALUES (2);
961 INSERT INTO `zseq_folders_users_roles_link` VALUES (1); 972 INSERT INTO `zseq_folders_users_roles_link` VALUES (1);
962 973
963 -- 974 --
964 --- Dumping data for table `zseq_groups_folders_approval_link`  
965 ---  
966 -  
967 -INSERT INTO `zseq_groups_folders_approval_link` VALUES (1);  
968 -  
969 ---  
970 --- Dumping data for table `zseq_groups_folders_link`  
971 ---  
972 -  
973 -INSERT INTO `zseq_groups_folders_link` VALUES (1);  
974 -  
975 ---  
976 -- Dumping data for table `zseq_groups_groups_link` 975 -- Dumping data for table `zseq_groups_groups_link`
977 -- 976 --
978 977
  978 +INSERT INTO `zseq_groups_groups_link` VALUES (1);
979 979
980 -- 980 --
981 -- Dumping data for table `zseq_groups_lookup` 981 -- Dumping data for table `zseq_groups_lookup`
@@ -999,6 +999,7 @@ INSERT INTO `zseq_help` VALUES (98); @@ -999,6 +999,7 @@ INSERT INTO `zseq_help` VALUES (98);
999 -- Dumping data for table `zseq_help_replacement` 999 -- Dumping data for table `zseq_help_replacement`
1000 -- 1000 --
1001 1001
  1002 +INSERT INTO `zseq_help_replacement` VALUES (1);
1002 1003
1003 -- 1004 --
1004 -- Dumping data for table `zseq_links` 1005 -- Dumping data for table `zseq_links`
@@ -1016,6 +1017,7 @@ INSERT INTO `zseq_metadata_lookup` VALUES (1); @@ -1016,6 +1017,7 @@ INSERT INTO `zseq_metadata_lookup` VALUES (1);
1016 -- Dumping data for table `zseq_metadata_lookup_tree` 1017 -- Dumping data for table `zseq_metadata_lookup_tree`
1017 -- 1018 --
1018 1019
  1020 +INSERT INTO `zseq_metadata_lookup_tree` VALUES (1);
1019 1021
1020 -- 1022 --
1021 -- Dumping data for table `zseq_mime_types` 1023 -- Dumping data for table `zseq_mime_types`
@@ -1033,6 +1035,7 @@ INSERT INTO `zseq_news` VALUES (1); @@ -1033,6 +1035,7 @@ INSERT INTO `zseq_news` VALUES (1);
1033 -- Dumping data for table `zseq_notifications` 1035 -- Dumping data for table `zseq_notifications`
1034 -- 1036 --
1035 1037
  1038 +INSERT INTO `zseq_notifications` VALUES (1);
1036 1039
1037 -- 1040 --
1038 -- Dumping data for table `zseq_organisations_lookup` 1041 -- Dumping data for table `zseq_organisations_lookup`
@@ -1056,6 +1059,7 @@ INSERT INTO `zseq_permission_descriptors` VALUES (2); @@ -1056,6 +1059,7 @@ INSERT INTO `zseq_permission_descriptors` VALUES (2);
1056 -- Dumping data for table `zseq_permission_dynamic_conditions` 1059 -- Dumping data for table `zseq_permission_dynamic_conditions`
1057 -- 1060 --
1058 1061
  1062 +INSERT INTO `zseq_permission_dynamic_conditions` VALUES (1);
1059 1063
1060 -- 1064 --
1061 -- Dumping data for table `zseq_permission_lookup_assignments` 1065 -- Dumping data for table `zseq_permission_lookup_assignments`
@@ -1082,26 +1086,28 @@ INSERT INTO `zseq_permission_objects` VALUES (1); @@ -1082,26 +1086,28 @@ INSERT INTO `zseq_permission_objects` VALUES (1);
1082 INSERT INTO `zseq_permissions` VALUES (3); 1086 INSERT INTO `zseq_permissions` VALUES (3);
1083 1087
1084 -- 1088 --
1085 --- Dumping data for table `zseq_role_allocations` 1089 +-- Dumping data for table `zseq_plugins`
1086 -- 1090 --
1087 1091
  1092 +INSERT INTO `zseq_plugins` VALUES (1);
1088 1093
1089 -- 1094 --
1090 --- Dumping data for table `zseq_roles` 1095 +-- Dumping data for table `zseq_role_allocations`
1091 -- 1096 --
1092 1097
1093 -INSERT INTO `zseq_roles` VALUES (1); 1098 +INSERT INTO `zseq_role_allocations` VALUES (1);
1094 1099
1095 -- 1100 --
1096 --- Dumping data for table `zseq_saved_searches` 1101 +-- Dumping data for table `zseq_roles`
1097 -- 1102 --
1098 1103
  1104 +INSERT INTO `zseq_roles` VALUES (1);
1099 1105
1100 -- 1106 --
1101 --- Dumping data for table `zseq_search_document_user_link` 1107 +-- Dumping data for table `zseq_saved_searches`
1102 -- 1108 --
1103 1109
1104 -INSERT INTO `zseq_search_document_user_link` VALUES (1); 1110 +INSERT INTO `zseq_saved_searches` VALUES (1);
1105 1111
1106 -- 1112 --
1107 -- Dumping data for table `zseq_status_lookup` 1113 -- Dumping data for table `zseq_status_lookup`
@@ -1143,7 +1149,7 @@ INSERT INTO `zseq_units_organisations_link` VALUES (1); @@ -1143,7 +1149,7 @@ INSERT INTO `zseq_units_organisations_link` VALUES (1);
1143 -- Dumping data for table `zseq_upgrades` 1149 -- Dumping data for table `zseq_upgrades`
1144 -- 1150 --
1145 1151
1146 -INSERT INTO `zseq_upgrades` VALUES (23); 1152 +INSERT INTO `zseq_upgrades` VALUES (50);
1147 1153
1148 -- 1154 --
1149 -- Dumping data for table `zseq_users` 1155 -- Dumping data for table `zseq_users`
@@ -1158,36 +1164,21 @@ INSERT INTO `zseq_users` VALUES (3); @@ -1158,36 +1164,21 @@ INSERT INTO `zseq_users` VALUES (3);
1158 INSERT INTO `zseq_users_groups_link` VALUES (3); 1164 INSERT INTO `zseq_users_groups_link` VALUES (3);
1159 1165
1160 -- 1166 --
1161 --- Dumping data for table `zseq_web_documents`  
1162 ---  
1163 -  
1164 -INSERT INTO `zseq_web_documents` VALUES (1);  
1165 -  
1166 ---  
1167 --- Dumping data for table `zseq_web_documents_status_lookup`  
1168 ---  
1169 -  
1170 -INSERT INTO `zseq_web_documents_status_lookup` VALUES (3);  
1171 -  
1172 ---  
1173 --- Dumping data for table `zseq_web_sites`  
1174 ---  
1175 -  
1176 -INSERT INTO `zseq_web_sites` VALUES (1);  
1177 -  
1178 ---  
1179 -- Dumping data for table `zseq_workflow_states` 1167 -- Dumping data for table `zseq_workflow_states`
1180 -- 1168 --
1181 1169
  1170 +INSERT INTO `zseq_workflow_states` VALUES (1);
1182 1171
1183 -- 1172 --
1184 -- Dumping data for table `zseq_workflow_transitions` 1173 -- Dumping data for table `zseq_workflow_transitions`
1185 -- 1174 --
1186 1175
  1176 +INSERT INTO `zseq_workflow_transitions` VALUES (1);
1187 1177
1188 -- 1178 --
1189 -- Dumping data for table `zseq_workflows` 1179 -- Dumping data for table `zseq_workflows`
1190 -- 1180 --
1191 1181
  1182 +INSERT INTO `zseq_workflows` VALUES (1);
1192 1183
1193 SET FOREIGN_KEY_CHECKS=1; 1184 SET FOREIGN_KEY_CHECKS=1;
sql/mysql/install/structure.sql
1 -- phpMyAdmin SQL Dump 1 -- phpMyAdmin SQL Dump
2 --- version 2.6.4-pl4-Debian-1 2 +-- version 2.7.0-pl2-Debian-1
3 -- http://www.phpmyadmin.net 3 -- http://www.phpmyadmin.net
4 -- 4 --
5 -- Host: localhost 5 -- Host: localhost
6 --- Generation Time: Dec 15, 2005 at 06:18 PM 6 +-- Generation Time: Jan 20, 2006 at 05:05 PM
7 -- Server version: 4.1.15 7 -- Server version: 4.1.15
8 -- PHP Version: 4.4.0-3 8 -- PHP Version: 4.4.0-3
9 9
@@ -26,7 +26,7 @@ CREATE TABLE `active_sessions` ( @@ -26,7 +26,7 @@ CREATE TABLE `active_sessions` (
26 `ip` char(30) default NULL, 26 `ip` char(30) default NULL,
27 UNIQUE KEY `id` (`id`), 27 UNIQUE KEY `id` (`id`),
28 KEY `session_id_idx` (`session_id`) 28 KEY `session_id_idx` (`session_id`)
29 -) TYPE=InnoDB ; 29 +) TYPE=InnoDB;
30 30
31 -- -------------------------------------------------------- 31 -- --------------------------------------------------------
32 32
@@ -41,7 +41,7 @@ CREATE TABLE `archive_restoration_request` ( @@ -41,7 +41,7 @@ CREATE TABLE `archive_restoration_request` (
41 `admin_user_id` int(11) NOT NULL default '0', 41 `admin_user_id` int(11) NOT NULL default '0',
42 `datetime` datetime NOT NULL default '0000-00-00 00:00:00', 42 `datetime` datetime NOT NULL default '0000-00-00 00:00:00',
43 UNIQUE KEY `id` (`id`) 43 UNIQUE KEY `id` (`id`)
44 -) TYPE=InnoDB ; 44 +) TYPE=InnoDB;
45 45
46 -- -------------------------------------------------------- 46 -- --------------------------------------------------------
47 47
@@ -56,7 +56,7 @@ CREATE TABLE `archiving_settings` ( @@ -56,7 +56,7 @@ CREATE TABLE `archiving_settings` (
56 `document_transaction_id` int(11) default NULL, 56 `document_transaction_id` int(11) default NULL,
57 `time_period_id` int(11) default NULL, 57 `time_period_id` int(11) default NULL,
58 UNIQUE KEY `id` (`id`) 58 UNIQUE KEY `id` (`id`)
59 -) TYPE=InnoDB ; 59 +) TYPE=InnoDB;
60 60
61 -- -------------------------------------------------------- 61 -- --------------------------------------------------------
62 62
@@ -68,7 +68,7 @@ CREATE TABLE `archiving_type_lookup` ( @@ -68,7 +68,7 @@ CREATE TABLE `archiving_type_lookup` (
68 `id` int(11) NOT NULL default '0', 68 `id` int(11) NOT NULL default '0',
69 `name` char(100) default NULL, 69 `name` char(100) default NULL,
70 UNIQUE KEY `id` (`id`) 70 UNIQUE KEY `id` (`id`)
71 -) TYPE=InnoDB ; 71 +) TYPE=InnoDB;
72 72
73 -- -------------------------------------------------------- 73 -- --------------------------------------------------------
74 74
@@ -86,22 +86,7 @@ CREATE TABLE `authentication_sources` ( @@ -86,22 +86,7 @@ CREATE TABLE `authentication_sources` (
86 `is_group_source` tinyint(1) NOT NULL default '0', 86 `is_group_source` tinyint(1) NOT NULL default '0',
87 PRIMARY KEY (`id`), 87 PRIMARY KEY (`id`),
88 KEY `namespace` (`namespace`) 88 KEY `namespace` (`namespace`)
89 -) TYPE=InnoDB ;  
90 -  
91 --- --------------------------------------------------------  
92 -  
93 ---  
94 --- Table structure for table `browse_criteria`  
95 ---  
96 -  
97 -CREATE TABLE `browse_criteria` (  
98 - `id` int(11) NOT NULL default '0',  
99 - `criteria_id` int(11) NOT NULL default '0',  
100 - `precedence` int(11) NOT NULL default '0',  
101 - PRIMARY KEY (`id`),  
102 - UNIQUE KEY `criteria_id` (`criteria_id`),  
103 - UNIQUE KEY `precedence` (`precedence`)  
104 -) TYPE=InnoDB ; 89 +) TYPE=InnoDB;
105 90
106 -- -------------------------------------------------------- 91 -- --------------------------------------------------------
107 92
@@ -116,7 +101,7 @@ CREATE TABLE `dashlet_disables` ( @@ -116,7 +101,7 @@ CREATE TABLE `dashlet_disables` (
116 UNIQUE KEY `id` (`id`), 101 UNIQUE KEY `id` (`id`),
117 KEY `user_id` (`user_id`), 102 KEY `user_id` (`user_id`),
118 KEY `dashlet_namespace` (`dashlet_namespace`) 103 KEY `dashlet_namespace` (`dashlet_namespace`)
119 -) TYPE=InnoDB ; 104 +) TYPE=InnoDB;
120 105
121 -- -------------------------------------------------------- 106 -- --------------------------------------------------------
122 107
@@ -128,37 +113,7 @@ CREATE TABLE `data_types` ( @@ -128,37 +113,7 @@ CREATE TABLE `data_types` (
128 `id` int(11) NOT NULL default '0', 113 `id` int(11) NOT NULL default '0',
129 `name` char(255) NOT NULL default '', 114 `name` char(255) NOT NULL default '',
130 UNIQUE KEY `id` (`id`) 115 UNIQUE KEY `id` (`id`)
131 -) TYPE=InnoDB ;  
132 -  
133 --- --------------------------------------------------------  
134 -  
135 ---  
136 --- Table structure for table `dependant_document_instance`  
137 ---  
138 -  
139 -CREATE TABLE `dependant_document_instance` (  
140 - `id` int(11) NOT NULL default '0',  
141 - `document_title` text NOT NULL,  
142 - `user_id` int(11) NOT NULL default '0',  
143 - `template_document_id` int(11) default NULL,  
144 - `parent_document_id` int(11) default NULL,  
145 - UNIQUE KEY `id` (`id`)  
146 -) TYPE=InnoDB ;  
147 -  
148 --- --------------------------------------------------------  
149 -  
150 ---  
151 --- Table structure for table `dependant_document_template`  
152 ---  
153 -  
154 -CREATE TABLE `dependant_document_template` (  
155 - `id` int(11) NOT NULL default '0',  
156 - `document_title` text NOT NULL,  
157 - `default_user_id` int(11) NOT NULL default '0',  
158 - `template_document_id` int(11) default NULL,  
159 - `group_folder_approval_link_id` int(11) default NULL,  
160 - UNIQUE KEY `id` (`id`)  
161 -) TYPE=InnoDB ; 116 +) TYPE=InnoDB;
162 117
163 -- -------------------------------------------------------- 118 -- --------------------------------------------------------
164 119
@@ -175,7 +130,7 @@ CREATE TABLE `discussion_comments` ( @@ -175,7 +130,7 @@ CREATE TABLE `discussion_comments` (
175 `body` text, 130 `body` text,
176 `date` datetime default NULL, 131 `date` datetime default NULL,
177 UNIQUE KEY `id` (`id`) 132 UNIQUE KEY `id` (`id`)
178 -) TYPE=InnoDB ; 133 +) TYPE=InnoDB;
179 134
180 -- -------------------------------------------------------- 135 -- --------------------------------------------------------
181 136
@@ -195,7 +150,7 @@ CREATE TABLE `discussion_threads` ( @@ -195,7 +150,7 @@ CREATE TABLE `discussion_threads` (
195 `close_reason` text NOT NULL default '', 150 `close_reason` text NOT NULL default '',
196 `creator_id` int(11) NOT NULL default '0', 151 `creator_id` int(11) NOT NULL default '0',
197 UNIQUE KEY `id` (`id`) 152 UNIQUE KEY `id` (`id`)
198 -) TYPE=InnoDB ; 153 +) TYPE=InnoDB;
199 154
200 -- -------------------------------------------------------- 155 -- --------------------------------------------------------
201 156
@@ -208,7 +163,27 @@ CREATE TABLE `document_archiving_link` ( @@ -208,7 +163,27 @@ CREATE TABLE `document_archiving_link` (
208 `document_id` int(11) NOT NULL default '0', 163 `document_id` int(11) NOT NULL default '0',
209 `archiving_settings_id` int(11) NOT NULL default '0', 164 `archiving_settings_id` int(11) NOT NULL default '0',
210 UNIQUE KEY `id` (`id`) 165 UNIQUE KEY `id` (`id`)
211 -) TYPE=InnoDB ; 166 +) TYPE=InnoDB;
  167 +
  168 +-- --------------------------------------------------------
  169 +
  170 +--
  171 +-- Table structure for table `document_content_version`
  172 +--
  173 +
  174 +CREATE TABLE `document_content_version` (
  175 + `id` int(11) NOT NULL default '0',
  176 + `document_id` int(11) NOT NULL default '0',
  177 + `filename` text NOT NULL,
  178 + `size` bigint(20) NOT NULL default '0',
  179 + `mime_id` int(11) NOT NULL default '0',
  180 + `major_version` int(11) NOT NULL default '0',
  181 + `minor_version` int(11) NOT NULL default '0',
  182 + `storage_path` varchar(250) default NULL,
  183 + UNIQUE KEY `id` (`id`),
  184 + KEY `storage_path` (`storage_path`),
  185 + KEY `document_id` (`document_id`)
  186 +) TYPE=InnoDB;
212 187
213 -- -------------------------------------------------------- 188 -- --------------------------------------------------------
214 189
@@ -228,7 +203,7 @@ CREATE TABLE `document_fields` ( @@ -228,7 +203,7 @@ CREATE TABLE `document_fields` (
228 `description` text NOT NULL, 203 `description` text NOT NULL,
229 UNIQUE KEY `id` (`id`), 204 UNIQUE KEY `id` (`id`),
230 KEY `parent_fieldset` (`parent_fieldset`) 205 KEY `parent_fieldset` (`parent_fieldset`)
231 -) TYPE=InnoDB ; 206 +) TYPE=InnoDB;
232 207
233 -- -------------------------------------------------------- 208 -- --------------------------------------------------------
234 209
@@ -238,13 +213,13 @@ CREATE TABLE `document_fields` ( @@ -238,13 +213,13 @@ CREATE TABLE `document_fields` (
238 213
239 CREATE TABLE `document_fields_link` ( 214 CREATE TABLE `document_fields_link` (
240 `id` int(11) NOT NULL default '0', 215 `id` int(11) NOT NULL default '0',
241 - `document_id` int(11) NOT NULL default '0',  
242 `document_field_id` int(11) NOT NULL default '0', 216 `document_field_id` int(11) NOT NULL default '0',
243 `value` char(255) NOT NULL default '', 217 `value` char(255) NOT NULL default '',
  218 + `metadata_version_id` int(11) default NULL,
244 UNIQUE KEY `id` (`id`), 219 UNIQUE KEY `id` (`id`),
245 - KEY `document_id` (`document_id`),  
246 - KEY `document_field_id` (`document_field_id`)  
247 -) TYPE=InnoDB ; 220 + KEY `document_field_id` (`document_field_id`),
  221 + KEY `metadata_version_id` (`metadata_version_id`)
  222 +) TYPE=InnoDB;
248 223
249 -- -------------------------------------------------------- 224 -- --------------------------------------------------------
250 225
@@ -257,7 +232,7 @@ CREATE TABLE `document_incomplete` ( @@ -257,7 +232,7 @@ CREATE TABLE `document_incomplete` (
257 `contents` tinyint(1) unsigned NOT NULL default '0', 232 `contents` tinyint(1) unsigned NOT NULL default '0',
258 `metadata` tinyint(1) unsigned NOT NULL default '0', 233 `metadata` tinyint(1) unsigned NOT NULL default '0',
259 PRIMARY KEY (`id`) 234 PRIMARY KEY (`id`)
260 -) TYPE=InnoDB ; 235 +) TYPE=InnoDB;
261 236
262 -- -------------------------------------------------------- 237 -- --------------------------------------------------------
263 238
@@ -271,7 +246,7 @@ CREATE TABLE `document_link` ( @@ -271,7 +246,7 @@ CREATE TABLE `document_link` (
271 `child_document_id` int(11) NOT NULL default '0', 246 `child_document_id` int(11) NOT NULL default '0',
272 `link_type_id` int(11) NOT NULL default '0', 247 `link_type_id` int(11) NOT NULL default '0',
273 UNIQUE KEY `id` (`id`) 248 UNIQUE KEY `id` (`id`)
274 -) TYPE=InnoDB ; 249 +) TYPE=InnoDB;
275 250
276 -- -------------------------------------------------------- 251 -- --------------------------------------------------------
277 252
@@ -285,7 +260,33 @@ CREATE TABLE `document_link_types` ( @@ -285,7 +260,33 @@ CREATE TABLE `document_link_types` (
285 `reverse_name` char(100) NOT NULL default '', 260 `reverse_name` char(100) NOT NULL default '',
286 `description` char(255) NOT NULL default '', 261 `description` char(255) NOT NULL default '',
287 UNIQUE KEY `id` (`id`) 262 UNIQUE KEY `id` (`id`)
288 -) TYPE=InnoDB ; 263 +) TYPE=InnoDB;
  264 +
  265 +-- --------------------------------------------------------
  266 +
  267 +--
  268 +-- Table structure for table `document_metadata_version`
  269 +--
  270 +
  271 +CREATE TABLE `document_metadata_version` (
  272 + `id` int(11) NOT NULL default '0',
  273 + `document_id` int(11) NOT NULL default '0',
  274 + `content_version_id` int(11) NOT NULL default '0',
  275 + `document_type_id` int(11) NOT NULL default '0',
  276 + `name` text NOT NULL,
  277 + `description` varchar(200) NOT NULL default '',
  278 + `status_id` int(11) default NULL,
  279 + `metadata_version` int(11) NOT NULL default '0',
  280 + `version_created` datetime NOT NULL default '0000-00-00 00:00:00',
  281 + `version_creator_id` int(11) NOT NULL default '0',
  282 + UNIQUE KEY `id` (`id`),
  283 + KEY `fk_document_type_id` (`document_type_id`),
  284 + KEY `fk_status_id` (`status_id`),
  285 + KEY `document_id` (`document_id`),
  286 + KEY `version_created` (`version_created`),
  287 + KEY `version_creator_id` (`version_creator_id`),
  288 + KEY `content_version_id` (`content_version_id`)
  289 +) TYPE=InnoDB;
289 290
290 -- -------------------------------------------------------- 291 -- --------------------------------------------------------
291 292
@@ -298,7 +299,7 @@ CREATE TABLE `document_searchable_text` ( @@ -298,7 +299,7 @@ CREATE TABLE `document_searchable_text` (
298 `document_text` mediumtext, 299 `document_text` mediumtext,
299 KEY `document_text_document_id_indx` (`document_id`), 300 KEY `document_text_document_id_indx` (`document_id`),
300 FULLTEXT KEY `document_text` (`document_text`) 301 FULLTEXT KEY `document_text` (`document_text`)
301 -) TYPE=MyISAM ; 302 +) TYPE=MyISAM;
302 303
303 -- -------------------------------------------------------- 304 -- --------------------------------------------------------
304 305
@@ -312,7 +313,7 @@ CREATE TABLE `document_subscriptions` ( @@ -312,7 +313,7 @@ CREATE TABLE `document_subscriptions` (
312 `document_id` int(11) NOT NULL default '0', 313 `document_id` int(11) NOT NULL default '0',
313 `is_alerted` tinyint(1) default NULL, 314 `is_alerted` tinyint(1) default NULL,
314 UNIQUE KEY `id` (`id`) 315 UNIQUE KEY `id` (`id`)
315 -) TYPE=InnoDB ; 316 +) TYPE=InnoDB;
316 317
317 -- -------------------------------------------------------- 318 -- --------------------------------------------------------
318 319
@@ -325,7 +326,7 @@ CREATE TABLE `document_text` ( @@ -325,7 +326,7 @@ CREATE TABLE `document_text` (
325 `document_text` mediumtext, 326 `document_text` mediumtext,
326 KEY `document_text_document_id_indx` (`document_id`), 327 KEY `document_text_document_id_indx` (`document_id`),
327 FULLTEXT KEY `document_text` (`document_text`) 328 FULLTEXT KEY `document_text` (`document_text`)
328 -) TYPE=MyISAM ; 329 +) TYPE=MyISAM;
329 330
330 -- -------------------------------------------------------- 331 -- --------------------------------------------------------
331 332
@@ -338,7 +339,7 @@ CREATE TABLE `document_transaction_text` ( @@ -338,7 +339,7 @@ CREATE TABLE `document_transaction_text` (
338 `document_text` mediumtext, 339 `document_text` mediumtext,
339 KEY `document_text_document_id_indx` (`document_id`), 340 KEY `document_text_document_id_indx` (`document_id`),
340 FULLTEXT KEY `document_text` (`document_text`) 341 FULLTEXT KEY `document_text` (`document_text`)
341 -) TYPE=MyISAM ; 342 +) TYPE=MyISAM;
342 343
343 -- -------------------------------------------------------- 344 -- --------------------------------------------------------
344 345
@@ -352,7 +353,7 @@ CREATE TABLE `document_transaction_types_lookup` ( @@ -352,7 +353,7 @@ CREATE TABLE `document_transaction_types_lookup` (
352 `namespace` varchar(250) NOT NULL default '', 353 `namespace` varchar(250) NOT NULL default '',
353 UNIQUE KEY `id` (`id`), 354 UNIQUE KEY `id` (`id`),
354 KEY `namespace` (`namespace`) 355 KEY `namespace` (`namespace`)
355 -) TYPE=InnoDB ; 356 +) TYPE=InnoDB;
356 357
357 -- -------------------------------------------------------- 358 -- --------------------------------------------------------
358 359
@@ -373,7 +374,7 @@ CREATE TABLE `document_transactions` ( @@ -373,7 +374,7 @@ CREATE TABLE `document_transactions` (
373 UNIQUE KEY `id` (`id`), 374 UNIQUE KEY `id` (`id`),
374 KEY `fk_document_id` (`document_id`), 375 KEY `fk_document_id` (`document_id`),
375 KEY `fk_user_id` (`user_id`) 376 KEY `fk_user_id` (`user_id`)
376 -) TYPE=InnoDB ; 377 +) TYPE=InnoDB;
377 378
378 -- -------------------------------------------------------- 379 -- --------------------------------------------------------
379 380
@@ -387,7 +388,7 @@ CREATE TABLE `document_type_fields_link` ( @@ -387,7 +388,7 @@ CREATE TABLE `document_type_fields_link` (
387 `field_id` int(11) NOT NULL default '0', 388 `field_id` int(11) NOT NULL default '0',
388 `is_mandatory` tinyint(1) NOT NULL default '0', 389 `is_mandatory` tinyint(1) NOT NULL default '0',
389 UNIQUE KEY `id` (`id`) 390 UNIQUE KEY `id` (`id`)
390 -) TYPE=InnoDB ; 391 +) TYPE=InnoDB;
391 392
392 -- -------------------------------------------------------- 393 -- --------------------------------------------------------
393 394
@@ -402,7 +403,7 @@ CREATE TABLE `document_type_fieldsets_link` ( @@ -402,7 +403,7 @@ CREATE TABLE `document_type_fieldsets_link` (
402 UNIQUE KEY `id` (`id`), 403 UNIQUE KEY `id` (`id`),
403 KEY `document_type_id` (`document_type_id`), 404 KEY `document_type_id` (`document_type_id`),
404 KEY `fieldset_id` (`fieldset_id`) 405 KEY `fieldset_id` (`fieldset_id`)
405 -) TYPE=InnoDB ; 406 +) TYPE=InnoDB;
406 407
407 -- -------------------------------------------------------- 408 -- --------------------------------------------------------
408 409
@@ -415,7 +416,7 @@ CREATE TABLE `document_types_lookup` ( @@ -415,7 +416,7 @@ CREATE TABLE `document_types_lookup` (
415 `name` char(100) default NULL, 416 `name` char(100) default NULL,
416 UNIQUE KEY `id` (`id`), 417 UNIQUE KEY `id` (`id`),
417 UNIQUE KEY `name` (`name`) 418 UNIQUE KEY `name` (`name`)
418 -) TYPE=InnoDB ; 419 +) TYPE=InnoDB;
419 420
420 -- -------------------------------------------------------- 421 -- --------------------------------------------------------
421 422
@@ -425,18 +426,9 @@ CREATE TABLE `document_types_lookup` ( @@ -425,18 +426,9 @@ CREATE TABLE `document_types_lookup` (
425 426
426 CREATE TABLE `documents` ( 427 CREATE TABLE `documents` (
427 `id` int(11) NOT NULL default '0', 428 `id` int(11) NOT NULL default '0',
428 - `document_type_id` int(11) NOT NULL default '0',  
429 - `name` text NOT NULL,  
430 - `filename` text NOT NULL,  
431 - `size` bigint(20) NOT NULL default '0',  
432 `creator_id` int(11) NOT NULL default '0', 429 `creator_id` int(11) NOT NULL default '0',
433 `modified` datetime NOT NULL default '0000-00-00 00:00:00', 430 `modified` datetime NOT NULL default '0000-00-00 00:00:00',
434 - `description` varchar(200) NOT NULL default '',  
435 - `security` int(11) NOT NULL default '0',  
436 - `mime_id` int(11) NOT NULL default '0',  
437 - `folder_id` int(11) default '1',  
438 - `major_version` int(11) NOT NULL default '0',  
439 - `minor_version` int(11) NOT NULL default '0', 431 + `folder_id` int(11) NOT NULL default '0',
440 `is_checked_out` tinyint(1) NOT NULL default '0', 432 `is_checked_out` tinyint(1) NOT NULL default '0',
441 `parent_folder_ids` text, 433 `parent_folder_ids` text,
442 `full_path` text, 434 `full_path` text,
@@ -445,12 +437,10 @@ CREATE TABLE `documents` ( @@ -445,12 +437,10 @@ CREATE TABLE `documents` (
445 `created` datetime NOT NULL default '0000-00-00 00:00:00', 437 `created` datetime NOT NULL default '0000-00-00 00:00:00',
446 `permission_object_id` int(11) default NULL, 438 `permission_object_id` int(11) default NULL,
447 `permission_lookup_id` int(11) default NULL, 439 `permission_lookup_id` int(11) default NULL,
448 - `live_document_id` int(11) default NULL,  
449 `metadata_version` int(11) NOT NULL default '0', 440 `metadata_version` int(11) NOT NULL default '0',
450 - `storage_path` varchar(250) default NULL,  
451 `modified_user_id` int(11) NOT NULL default '0', 441 `modified_user_id` int(11) NOT NULL default '0',
  442 + `metadata_version_id` int(11) default NULL,
452 UNIQUE KEY `id` (`id`), 443 UNIQUE KEY `id` (`id`),
453 - KEY `fk_document_type_id` (`document_type_id`),  
454 KEY `fk_creator_id` (`creator_id`), 444 KEY `fk_creator_id` (`creator_id`),
455 KEY `fk_folder_id` (`folder_id`), 445 KEY `fk_folder_id` (`folder_id`),
456 KEY `fk_checked_out_user_id` (`checked_out_user_id`), 446 KEY `fk_checked_out_user_id` (`checked_out_user_id`),
@@ -458,10 +448,9 @@ CREATE TABLE `documents` ( @@ -458,10 +448,9 @@ CREATE TABLE `documents` (
458 KEY `created` (`created`), 448 KEY `created` (`created`),
459 KEY `permission_object_id` (`permission_object_id`), 449 KEY `permission_object_id` (`permission_object_id`),
460 KEY `permission_lookup_id` (`permission_lookup_id`), 450 KEY `permission_lookup_id` (`permission_lookup_id`),
461 - KEY `live_document_id` (`live_document_id`),  
462 - KEY `storage_path` (`storage_path`),  
463 - KEY `modified_user_id` (`modified_user_id`)  
464 -) TYPE=InnoDB ; 451 + KEY `modified_user_id` (`modified_user_id`),
  452 + KEY `metadata_version_id` (`metadata_version_id`)
  453 +) TYPE=InnoDB;
465 454
466 -- -------------------------------------------------------- 455 -- --------------------------------------------------------
467 456
@@ -476,7 +465,7 @@ CREATE TABLE `field_behaviour_options` ( @@ -476,7 +465,7 @@ CREATE TABLE `field_behaviour_options` (
476 KEY `behaviour_id` (`behaviour_id`), 465 KEY `behaviour_id` (`behaviour_id`),
477 KEY `field_id` (`field_id`), 466 KEY `field_id` (`field_id`),
478 KEY `instance_id` (`instance_id`) 467 KEY `instance_id` (`instance_id`)
479 -) TYPE=InnoDB ; 468 +) TYPE=InnoDB;
480 469
481 -- -------------------------------------------------------- 470 -- --------------------------------------------------------
482 471
@@ -492,7 +481,7 @@ CREATE TABLE `field_behaviours` ( @@ -492,7 +481,7 @@ CREATE TABLE `field_behaviours` (
492 PRIMARY KEY (`id`), 481 PRIMARY KEY (`id`),
493 KEY `field_id` (`field_id`), 482 KEY `field_id` (`field_id`),
494 KEY `name` (`name`) 483 KEY `name` (`name`)
495 -) TYPE=InnoDB ; 484 +) TYPE=InnoDB;
496 485
497 -- -------------------------------------------------------- 486 -- --------------------------------------------------------
498 487
@@ -507,7 +496,7 @@ CREATE TABLE `field_orders` ( @@ -507,7 +496,7 @@ CREATE TABLE `field_orders` (
507 UNIQUE KEY `child_field` (`child_field_id`), 496 UNIQUE KEY `child_field` (`child_field_id`),
508 KEY `parent_field` (`parent_field_id`), 497 KEY `parent_field` (`parent_field_id`),
509 KEY `fieldset_id` (`fieldset_id`) 498 KEY `fieldset_id` (`fieldset_id`)
510 -) TYPE=InnoDB ; 499 +) TYPE=InnoDB;
511 500
512 -- -------------------------------------------------------- 501 -- --------------------------------------------------------
513 502
@@ -524,7 +513,7 @@ CREATE TABLE `field_value_instances` ( @@ -524,7 +513,7 @@ CREATE TABLE `field_value_instances` (
524 KEY `field_id` (`field_id`), 513 KEY `field_id` (`field_id`),
525 KEY `field_value_id` (`field_value_id`), 514 KEY `field_value_id` (`field_value_id`),
526 KEY `behaviour_id` (`behaviour_id`) 515 KEY `behaviour_id` (`behaviour_id`)
527 -) TYPE=InnoDB ; 516 +) TYPE=InnoDB;
528 517
529 -- -------------------------------------------------------- 518 -- --------------------------------------------------------
530 519
@@ -549,7 +538,7 @@ CREATE TABLE `fieldsets` ( @@ -549,7 +538,7 @@ CREATE TABLE `fieldsets` (
549 KEY `is_complete` (`is_complete`), 538 KEY `is_complete` (`is_complete`),
550 KEY `is_system` (`is_system`), 539 KEY `is_system` (`is_system`),
551 KEY `master_field` (`master_field`) 540 KEY `master_field` (`master_field`)
552 -) TYPE=InnoDB ; 541 +) TYPE=InnoDB;
553 542
554 -- -------------------------------------------------------- 543 -- --------------------------------------------------------
555 544
@@ -564,7 +553,7 @@ CREATE TABLE `folder_doctypes_link` ( @@ -564,7 +553,7 @@ CREATE TABLE `folder_doctypes_link` (
564 UNIQUE KEY `id` (`id`), 553 UNIQUE KEY `id` (`id`),
565 KEY `fk_folder_id` (`folder_id`), 554 KEY `fk_folder_id` (`folder_id`),
566 KEY `fk_document_type_id` (`document_type_id`) 555 KEY `fk_document_type_id` (`document_type_id`)
567 -) TYPE=InnoDB ; 556 +) TYPE=InnoDB;
568 557
569 -- -------------------------------------------------------- 558 -- --------------------------------------------------------
570 559
@@ -578,7 +567,7 @@ CREATE TABLE `folder_subscriptions` ( @@ -578,7 +567,7 @@ CREATE TABLE `folder_subscriptions` (
578 `folder_id` int(11) NOT NULL default '0', 567 `folder_id` int(11) NOT NULL default '0',
579 `is_alerted` tinyint(1) default NULL, 568 `is_alerted` tinyint(1) default NULL,
580 UNIQUE KEY `id` (`id`) 569 UNIQUE KEY `id` (`id`)
581 -) TYPE=InnoDB ; 570 +) TYPE=InnoDB;
582 571
583 -- -------------------------------------------------------- 572 -- --------------------------------------------------------
584 573
@@ -605,7 +594,7 @@ CREATE TABLE `folders` ( @@ -605,7 +594,7 @@ CREATE TABLE `folders` (
605 KEY `fk_unit_id` (`unit_id`), 594 KEY `fk_unit_id` (`unit_id`),
606 KEY `permission_object_id` (`permission_object_id`), 595 KEY `permission_object_id` (`permission_object_id`),
607 KEY `permission_lookup_id` (`permission_lookup_id`) 596 KEY `permission_lookup_id` (`permission_lookup_id`)
608 -) TYPE=InnoDB ; 597 +) TYPE=InnoDB;
609 598
610 -- -------------------------------------------------------- 599 -- --------------------------------------------------------
611 600
@@ -623,40 +612,7 @@ CREATE TABLE `folders_users_roles_link` ( @@ -623,40 +612,7 @@ CREATE TABLE `folders_users_roles_link` (
623 `active` tinyint(1) default NULL, 612 `active` tinyint(1) default NULL,
624 `dependant_documents_created` tinyint(1) default NULL, 613 `dependant_documents_created` tinyint(1) default NULL,
625 UNIQUE KEY `id` (`id`) 614 UNIQUE KEY `id` (`id`)
626 -) TYPE=InnoDB ;  
627 -  
628 --- --------------------------------------------------------  
629 -  
630 ---  
631 --- Table structure for table `groups_folders_approval_link`  
632 ---  
633 -  
634 -CREATE TABLE `groups_folders_approval_link` (  
635 - `id` int(11) NOT NULL default '0',  
636 - `folder_id` int(11) NOT NULL default '0',  
637 - `group_id` int(11) NOT NULL default '0',  
638 - `precedence` int(11) NOT NULL default '0',  
639 - `role_id` int(11) NOT NULL default '0',  
640 - `user_id` int(11) NOT NULL default '0',  
641 - UNIQUE KEY `id` (`id`)  
642 -) TYPE=InnoDB ;  
643 -  
644 --- --------------------------------------------------------  
645 -  
646 ---  
647 --- Table structure for table `groups_folders_link`  
648 ---  
649 -  
650 -CREATE TABLE `groups_folders_link` (  
651 - `id` int(11) NOT NULL default '0',  
652 - `group_id` int(11) NOT NULL default '0',  
653 - `folder_id` int(11) NOT NULL default '0',  
654 - `can_read` tinyint(1) NOT NULL default '0',  
655 - `can_write` tinyint(1) NOT NULL default '0',  
656 - UNIQUE KEY `id` (`id`),  
657 - KEY `fk_group_id` (`group_id`),  
658 - KEY `fk_folder_id` (`folder_id`)  
659 -) TYPE=InnoDB ; 615 +) TYPE=InnoDB;
660 616
661 -- -------------------------------------------------------- 617 -- --------------------------------------------------------
662 618
@@ -669,7 +625,7 @@ CREATE TABLE `groups_groups_link` ( @@ -669,7 +625,7 @@ CREATE TABLE `groups_groups_link` (
669 `parent_group_id` int(11) NOT NULL default '0', 625 `parent_group_id` int(11) NOT NULL default '0',
670 `member_group_id` int(11) NOT NULL default '0', 626 `member_group_id` int(11) NOT NULL default '0',
671 PRIMARY KEY (`id`) 627 PRIMARY KEY (`id`)
672 -) TYPE=InnoDB ; 628 +) TYPE=InnoDB;
673 629
674 -- -------------------------------------------------------- 630 -- --------------------------------------------------------
675 631
@@ -684,7 +640,7 @@ CREATE TABLE `groups_lookup` ( @@ -684,7 +640,7 @@ CREATE TABLE `groups_lookup` (
684 `is_unit_admin` tinyint(1) NOT NULL default '0', 640 `is_unit_admin` tinyint(1) NOT NULL default '0',
685 UNIQUE KEY `id` (`id`), 641 UNIQUE KEY `id` (`id`),
686 UNIQUE KEY `name` (`name`) 642 UNIQUE KEY `name` (`name`)
687 -) TYPE=InnoDB ; 643 +) TYPE=InnoDB;
688 644
689 -- -------------------------------------------------------- 645 -- --------------------------------------------------------
690 646
@@ -699,7 +655,7 @@ CREATE TABLE `groups_units_link` ( @@ -699,7 +655,7 @@ CREATE TABLE `groups_units_link` (
699 UNIQUE KEY `id` (`id`), 655 UNIQUE KEY `id` (`id`),
700 KEY `fk_group_id` (`group_id`), 656 KEY `fk_group_id` (`group_id`),
701 KEY `fk_unit_id` (`unit_id`) 657 KEY `fk_unit_id` (`unit_id`)
702 -) TYPE=InnoDB ; 658 +) TYPE=InnoDB;
703 659
704 -- -------------------------------------------------------- 660 -- --------------------------------------------------------
705 661
@@ -712,7 +668,7 @@ CREATE TABLE `help` ( @@ -712,7 +668,7 @@ CREATE TABLE `help` (
712 `fSection` varchar(100) NOT NULL default '', 668 `fSection` varchar(100) NOT NULL default '',
713 `help_info` text NOT NULL, 669 `help_info` text NOT NULL,
714 UNIQUE KEY `id` (`id`) 670 UNIQUE KEY `id` (`id`)
715 -) TYPE=InnoDB ; 671 +) TYPE=InnoDB;
716 672
717 -- -------------------------------------------------------- 673 -- --------------------------------------------------------
718 674
@@ -722,11 +678,10 @@ CREATE TABLE `help` ( @@ -722,11 +678,10 @@ CREATE TABLE `help` (
722 678
723 CREATE TABLE `help_replacement` ( 679 CREATE TABLE `help_replacement` (
724 `id` int(11) NOT NULL default '0', 680 `id` int(11) NOT NULL default '0',
725 - `name` varchar(255) NOT NULL default '',  
726 - `title` varchar(255) NOT NULL default '', 681 + `name` varchar(100) NOT NULL default '',
727 `description` text NOT NULL, 682 `description` text NOT NULL,
728 PRIMARY KEY (`id`) 683 PRIMARY KEY (`id`)
729 -) TYPE=InnoDB ; 684 +) TYPE=InnoDB;
730 685
731 -- -------------------------------------------------------- 686 -- --------------------------------------------------------
732 687
@@ -740,7 +695,7 @@ CREATE TABLE `links` ( @@ -740,7 +695,7 @@ CREATE TABLE `links` (
740 `url` char(100) NOT NULL default '', 695 `url` char(100) NOT NULL default '',
741 `rank` int(11) NOT NULL default '0', 696 `rank` int(11) NOT NULL default '0',
742 UNIQUE KEY `id` (`id`) 697 UNIQUE KEY `id` (`id`)
743 -) TYPE=InnoDB ; 698 +) TYPE=InnoDB;
744 699
745 -- -------------------------------------------------------- 700 -- --------------------------------------------------------
746 701
@@ -758,7 +713,7 @@ CREATE TABLE `metadata_lookup` ( @@ -758,7 +713,7 @@ CREATE TABLE `metadata_lookup` (
758 UNIQUE KEY `id` (`id`), 713 UNIQUE KEY `id` (`id`),
759 KEY `disabled` (`disabled`), 714 KEY `disabled` (`disabled`),
760 KEY `is_stuck` (`is_stuck`) 715 KEY `is_stuck` (`is_stuck`)
761 -) TYPE=InnoDB ; 716 +) TYPE=InnoDB;
762 717
763 -- -------------------------------------------------------- 718 -- --------------------------------------------------------
764 719
@@ -774,7 +729,7 @@ CREATE TABLE `metadata_lookup_tree` ( @@ -774,7 +729,7 @@ CREATE TABLE `metadata_lookup_tree` (
774 UNIQUE KEY `id` (`id`), 729 UNIQUE KEY `id` (`id`),
775 KEY `metadata_lookup_tree_parent` (`metadata_lookup_tree_parent`), 730 KEY `metadata_lookup_tree_parent` (`metadata_lookup_tree_parent`),
776 KEY `document_field_id` (`document_field_id`) 731 KEY `document_field_id` (`document_field_id`)
777 -) TYPE=InnoDB ; 732 +) TYPE=InnoDB;
778 733
779 -- -------------------------------------------------------- 734 -- --------------------------------------------------------
780 735
@@ -788,7 +743,7 @@ CREATE TABLE `mime_types` ( @@ -788,7 +743,7 @@ CREATE TABLE `mime_types` (
788 `mimetypes` char(100) NOT NULL default '', 743 `mimetypes` char(100) NOT NULL default '',
789 `icon_path` char(255) default NULL, 744 `icon_path` char(255) default NULL,
790 UNIQUE KEY `id` (`id`) 745 UNIQUE KEY `id` (`id`)
791 -) TYPE=InnoDB ; 746 +) TYPE=InnoDB;
792 747
793 -- -------------------------------------------------------- 748 -- --------------------------------------------------------
794 749
@@ -806,7 +761,7 @@ CREATE TABLE `news` ( @@ -806,7 +761,7 @@ CREATE TABLE `news` (
806 `image_mime_type_id` int(11) default NULL, 761 `image_mime_type_id` int(11) default NULL,
807 `active` tinyint(1) default NULL, 762 `active` tinyint(1) default NULL,
808 UNIQUE KEY `id` (`id`) 763 UNIQUE KEY `id` (`id`)
809 -) TYPE=InnoDB ; 764 +) TYPE=InnoDB;
810 765
811 -- -------------------------------------------------------- 766 -- --------------------------------------------------------
812 767
@@ -827,7 +782,7 @@ CREATE TABLE `notifications` ( @@ -827,7 +782,7 @@ CREATE TABLE `notifications` (
827 UNIQUE KEY `id` (`id`), 782 UNIQUE KEY `id` (`id`),
828 KEY `type` (`type`), 783 KEY `type` (`type`),
829 KEY `user_id` (`user_id`) 784 KEY `user_id` (`user_id`)
830 -) TYPE=InnoDB ; 785 +) TYPE=InnoDB;
831 786
832 -- -------------------------------------------------------- 787 -- --------------------------------------------------------
833 788
@@ -840,22 +795,10 @@ CREATE TABLE `organisations_lookup` ( @@ -840,22 +795,10 @@ CREATE TABLE `organisations_lookup` (
840 `name` char(100) NOT NULL default '', 795 `name` char(100) NOT NULL default '',
841 UNIQUE KEY `id` (`id`), 796 UNIQUE KEY `id` (`id`),
842 UNIQUE KEY `name` (`name`) 797 UNIQUE KEY `name` (`name`)
843 -) TYPE=InnoDB ; 798 +) TYPE=InnoDB;
844 799
845 -- -------------------------------------------------------- 800 -- --------------------------------------------------------
846 801
847 -CREATE TABLE `plugins` (  
848 - `id` int(11) NOT NULL default '0',  
849 - `namespace` varchar(255) NOT NULL default '',  
850 - `path` varchar(255) NOT NULL default '',  
851 - `version` int(11) NOT NULL default '0',  
852 - `disabled` tinyint(1) NOT NULL default '0',  
853 - `data` text,  
854 - PRIMARY KEY (`id`),  
855 - KEY `name` (`namespace`)  
856 -) ENGINE=InnoDB;  
857 -  
858 -  
859 -- 802 --
860 -- Table structure for table `permission_assignments` 803 -- Table structure for table `permission_assignments`
861 -- 804 --
@@ -870,7 +813,7 @@ CREATE TABLE `permission_assignments` ( @@ -870,7 +813,7 @@ CREATE TABLE `permission_assignments` (
870 KEY `permission_id` (`permission_id`), 813 KEY `permission_id` (`permission_id`),
871 KEY `permission_object_id` (`permission_object_id`), 814 KEY `permission_object_id` (`permission_object_id`),
872 KEY `permission_descriptor_id` (`permission_descriptor_id`) 815 KEY `permission_descriptor_id` (`permission_descriptor_id`)
873 -) TYPE=InnoDB ; 816 +) TYPE=InnoDB;
874 817
875 -- -------------------------------------------------------- 818 -- --------------------------------------------------------
876 819
@@ -884,7 +827,7 @@ CREATE TABLE `permission_descriptor_groups` ( @@ -884,7 +827,7 @@ CREATE TABLE `permission_descriptor_groups` (
884 UNIQUE KEY `descriptor_id` (`descriptor_id`,`group_id`), 827 UNIQUE KEY `descriptor_id` (`descriptor_id`,`group_id`),
885 KEY `descriptor_id_2` (`descriptor_id`), 828 KEY `descriptor_id_2` (`descriptor_id`),
886 KEY `group_id` (`group_id`) 829 KEY `group_id` (`group_id`)
887 -) TYPE=InnoDB ; 830 +) TYPE=InnoDB;
888 831
889 -- -------------------------------------------------------- 832 -- --------------------------------------------------------
890 833
@@ -898,7 +841,7 @@ CREATE TABLE `permission_descriptor_roles` ( @@ -898,7 +841,7 @@ CREATE TABLE `permission_descriptor_roles` (
898 UNIQUE KEY `descriptor_id` (`descriptor_id`,`role_id`), 841 UNIQUE KEY `descriptor_id` (`descriptor_id`,`role_id`),
899 KEY `descriptor_id_2` (`descriptor_id`), 842 KEY `descriptor_id_2` (`descriptor_id`),
900 KEY `role_id` (`role_id`) 843 KEY `role_id` (`role_id`)
901 -) TYPE=InnoDB ; 844 +) TYPE=InnoDB;
902 845
903 -- -------------------------------------------------------- 846 -- --------------------------------------------------------
904 847
@@ -912,7 +855,7 @@ CREATE TABLE `permission_descriptor_users` ( @@ -912,7 +855,7 @@ CREATE TABLE `permission_descriptor_users` (
912 UNIQUE KEY `descriptor_id` (`descriptor_id`,`user_id`), 855 UNIQUE KEY `descriptor_id` (`descriptor_id`,`user_id`),
913 KEY `descriptor_id_2` (`descriptor_id`), 856 KEY `descriptor_id_2` (`descriptor_id`),
914 KEY `user_id` (`user_id`) 857 KEY `user_id` (`user_id`)
915 -) TYPE=InnoDB ; 858 +) TYPE=InnoDB;
916 859
917 -- -------------------------------------------------------- 860 -- --------------------------------------------------------
918 861
@@ -927,7 +870,7 @@ CREATE TABLE `permission_descriptors` ( @@ -927,7 +870,7 @@ CREATE TABLE `permission_descriptors` (
927 PRIMARY KEY (`id`), 870 PRIMARY KEY (`id`),
928 UNIQUE KEY `descriptor_2` (`descriptor`), 871 UNIQUE KEY `descriptor_2` (`descriptor`),
929 KEY `descriptor` (`descriptor`) 872 KEY `descriptor` (`descriptor`)
930 -) TYPE=InnoDB ; 873 +) TYPE=InnoDB;
931 874
932 -- -------------------------------------------------------- 875 -- --------------------------------------------------------
933 876
@@ -940,7 +883,7 @@ CREATE TABLE `permission_dynamic_assignments` ( @@ -940,7 +883,7 @@ CREATE TABLE `permission_dynamic_assignments` (
940 `permission_id` int(11) NOT NULL default '0', 883 `permission_id` int(11) NOT NULL default '0',
941 KEY `dynamic_conditiond_id` (`dynamic_condition_id`), 884 KEY `dynamic_conditiond_id` (`dynamic_condition_id`),
942 KEY `permission_id` (`permission_id`) 885 KEY `permission_id` (`permission_id`)
943 -) TYPE=InnoDB ; 886 +) TYPE=InnoDB;
944 887
945 -- -------------------------------------------------------- 888 -- --------------------------------------------------------
946 889
@@ -957,7 +900,7 @@ CREATE TABLE `permission_dynamic_conditions` ( @@ -957,7 +900,7 @@ CREATE TABLE `permission_dynamic_conditions` (
957 KEY `permission_object_id` (`permission_object_id`), 900 KEY `permission_object_id` (`permission_object_id`),
958 KEY `group_id` (`group_id`), 901 KEY `group_id` (`group_id`),
959 KEY `condition_id` (`condition_id`) 902 KEY `condition_id` (`condition_id`)
960 -) TYPE=InnoDB ; 903 +) TYPE=InnoDB;
961 904
962 -- -------------------------------------------------------- 905 -- --------------------------------------------------------
963 906
@@ -975,7 +918,7 @@ CREATE TABLE `permission_lookup_assignments` ( @@ -975,7 +918,7 @@ CREATE TABLE `permission_lookup_assignments` (
975 KEY `permission_id` (`permission_id`), 918 KEY `permission_id` (`permission_id`),
976 KEY `permission_lookup_id` (`permission_lookup_id`), 919 KEY `permission_lookup_id` (`permission_lookup_id`),
977 KEY `permission_descriptor_id` (`permission_descriptor_id`) 920 KEY `permission_descriptor_id` (`permission_descriptor_id`)
978 -) TYPE=InnoDB ; 921 +) TYPE=InnoDB;
979 922
980 -- -------------------------------------------------------- 923 -- --------------------------------------------------------
981 924
@@ -986,7 +929,7 @@ CREATE TABLE `permission_lookup_assignments` ( @@ -986,7 +929,7 @@ CREATE TABLE `permission_lookup_assignments` (
986 CREATE TABLE `permission_lookups` ( 929 CREATE TABLE `permission_lookups` (
987 `id` int(11) NOT NULL default '0', 930 `id` int(11) NOT NULL default '0',
988 PRIMARY KEY (`id`) 931 PRIMARY KEY (`id`)
989 -) TYPE=InnoDB ; 932 +) TYPE=InnoDB;
990 933
991 -- -------------------------------------------------------- 934 -- --------------------------------------------------------
992 935
@@ -997,7 +940,7 @@ CREATE TABLE `permission_lookups` ( @@ -997,7 +940,7 @@ CREATE TABLE `permission_lookups` (
997 CREATE TABLE `permission_objects` ( 940 CREATE TABLE `permission_objects` (
998 `id` int(11) NOT NULL default '0', 941 `id` int(11) NOT NULL default '0',
999 PRIMARY KEY (`id`) 942 PRIMARY KEY (`id`)
1000 -) TYPE=InnoDB ; 943 +) TYPE=InnoDB;
1001 944
1002 -- -------------------------------------------------------- 945 -- --------------------------------------------------------
1003 946
@@ -1012,7 +955,24 @@ CREATE TABLE `permissions` ( @@ -1012,7 +955,24 @@ CREATE TABLE `permissions` (
1012 `built_in` tinyint(4) NOT NULL default '0', 955 `built_in` tinyint(4) NOT NULL default '0',
1013 PRIMARY KEY (`id`), 956 PRIMARY KEY (`id`),
1014 UNIQUE KEY `name` (`name`) 957 UNIQUE KEY `name` (`name`)
1015 -) TYPE=InnoDB ; 958 +) TYPE=InnoDB;
  959 +
  960 +-- --------------------------------------------------------
  961 +
  962 +--
  963 +-- Table structure for table `plugins`
  964 +--
  965 +
  966 +CREATE TABLE `plugins` (
  967 + `id` int(11) NOT NULL default '0',
  968 + `namespace` varchar(255) NOT NULL default '',
  969 + `path` varchar(255) NOT NULL default '',
  970 + `version` int(11) NOT NULL default '0',
  971 + `disabled` tinyint(1) NOT NULL default '0',
  972 + `data` text,
  973 + PRIMARY KEY (`id`),
  974 + KEY `name` (`namespace`)
  975 +) TYPE=InnoDB;
1016 976
1017 -- -------------------------------------------------------- 977 -- --------------------------------------------------------
1018 978
@@ -1027,7 +987,7 @@ CREATE TABLE `role_allocations` ( @@ -1027,7 +987,7 @@ CREATE TABLE `role_allocations` (
1027 `permission_descriptor_id` int(11) NOT NULL default '0', 987 `permission_descriptor_id` int(11) NOT NULL default '0',
1028 UNIQUE KEY `id` (`id`), 988 UNIQUE KEY `id` (`id`),
1029 KEY `folder_id` (`folder_id`) 989 KEY `folder_id` (`folder_id`)
1030 -) TYPE=InnoDB ; 990 +) TYPE=InnoDB;
1031 991
1032 -- -------------------------------------------------------- 992 -- --------------------------------------------------------
1033 993
@@ -1040,7 +1000,7 @@ CREATE TABLE `roles` ( @@ -1040,7 +1000,7 @@ CREATE TABLE `roles` (
1040 `name` char(255) NOT NULL default '', 1000 `name` char(255) NOT NULL default '',
1041 UNIQUE KEY `id` (`id`), 1001 UNIQUE KEY `id` (`id`),
1042 UNIQUE KEY `name` (`name`) 1002 UNIQUE KEY `name` (`name`)
1043 -) TYPE=InnoDB ; 1003 +) TYPE=InnoDB;
1044 1004
1045 -- -------------------------------------------------------- 1005 -- --------------------------------------------------------
1046 1006
@@ -1061,7 +1021,7 @@ CREATE TABLE `saved_searches` ( @@ -1061,7 +1021,7 @@ CREATE TABLE `saved_searches` (
1061 KEY `is_condition` (`is_condition`), 1021 KEY `is_condition` (`is_condition`),
1062 KEY `is_complete` (`is_complete`), 1022 KEY `is_complete` (`is_complete`),
1063 KEY `user_id` (`user_id`) 1023 KEY `user_id` (`user_id`)
1064 -) TYPE=InnoDB ; 1024 +) TYPE=InnoDB;
1065 1025
1066 -- -------------------------------------------------------- 1026 -- --------------------------------------------------------
1067 1027
@@ -1074,7 +1034,7 @@ CREATE TABLE `search_document_user_link` ( @@ -1074,7 +1034,7 @@ CREATE TABLE `search_document_user_link` (
1074 `user_id` int(11) default NULL, 1034 `user_id` int(11) default NULL,
1075 KEY `fk_user_id` (`user_id`), 1035 KEY `fk_user_id` (`user_id`),
1076 KEY `fk_document_ids` (`document_id`) 1036 KEY `fk_document_ids` (`document_id`)
1077 -) TYPE=InnoDB ; 1037 +) TYPE=InnoDB;
1078 1038
1079 -- -------------------------------------------------------- 1039 -- --------------------------------------------------------
1080 1040
@@ -1086,7 +1046,7 @@ CREATE TABLE `status_lookup` ( @@ -1086,7 +1046,7 @@ CREATE TABLE `status_lookup` (
1086 `id` int(11) NOT NULL default '0', 1046 `id` int(11) NOT NULL default '0',
1087 `name` char(255) default NULL, 1047 `name` char(255) default NULL,
1088 UNIQUE KEY `id` (`id`) 1048 UNIQUE KEY `id` (`id`)
1089 -) TYPE=InnoDB ; 1049 +) TYPE=InnoDB;
1090 1050
1091 -- -------------------------------------------------------- 1051 -- --------------------------------------------------------
1092 1052
@@ -1099,7 +1059,7 @@ CREATE TABLE `system_settings` ( @@ -1099,7 +1059,7 @@ CREATE TABLE `system_settings` (
1099 `name` char(255) NOT NULL default '', 1059 `name` char(255) NOT NULL default '',
1100 `value` char(255) NOT NULL default '', 1060 `value` char(255) NOT NULL default '',
1101 UNIQUE KEY `id` (`id`) 1061 UNIQUE KEY `id` (`id`)
1102 -) TYPE=InnoDB ; 1062 +) TYPE=InnoDB;
1103 1063
1104 -- -------------------------------------------------------- 1064 -- --------------------------------------------------------
1105 1065
@@ -1112,7 +1072,7 @@ CREATE TABLE `time_period` ( @@ -1112,7 +1072,7 @@ CREATE TABLE `time_period` (
1112 `time_unit_id` int(11) default NULL, 1072 `time_unit_id` int(11) default NULL,
1113 `units` int(11) default NULL, 1073 `units` int(11) default NULL,
1114 UNIQUE KEY `id` (`id`) 1074 UNIQUE KEY `id` (`id`)
1115 -) TYPE=InnoDB ; 1075 +) TYPE=InnoDB;
1116 1076
1117 -- -------------------------------------------------------- 1077 -- --------------------------------------------------------
1118 1078
@@ -1124,7 +1084,7 @@ CREATE TABLE `time_unit_lookup` ( @@ -1124,7 +1084,7 @@ CREATE TABLE `time_unit_lookup` (
1124 `id` int(11) NOT NULL default '0', 1084 `id` int(11) NOT NULL default '0',
1125 `name` char(100) default NULL, 1085 `name` char(100) default NULL,
1126 UNIQUE KEY `id` (`id`) 1086 UNIQUE KEY `id` (`id`)
1127 -) TYPE=InnoDB ; 1087 +) TYPE=InnoDB;
1128 1088
1129 -- -------------------------------------------------------- 1089 -- --------------------------------------------------------
1130 1090
@@ -1137,7 +1097,7 @@ CREATE TABLE `units_lookup` ( @@ -1137,7 +1097,7 @@ CREATE TABLE `units_lookup` (
1137 `name` char(100) NOT NULL default '', 1097 `name` char(100) NOT NULL default '',
1138 UNIQUE KEY `id` (`id`), 1098 UNIQUE KEY `id` (`id`),
1139 UNIQUE KEY `name` (`name`) 1099 UNIQUE KEY `name` (`name`)
1140 -) TYPE=InnoDB ; 1100 +) TYPE=InnoDB;
1141 1101
1142 -- -------------------------------------------------------- 1102 -- --------------------------------------------------------
1143 1103
@@ -1152,7 +1112,7 @@ CREATE TABLE `units_organisations_link` ( @@ -1152,7 +1112,7 @@ CREATE TABLE `units_organisations_link` (
1152 UNIQUE KEY `id` (`id`), 1112 UNIQUE KEY `id` (`id`),
1153 KEY `fk_unit_id` (`unit_id`), 1113 KEY `fk_unit_id` (`unit_id`),
1154 KEY `fk_organisation_id` (`organisation_id`) 1114 KEY `fk_organisation_id` (`organisation_id`)
1155 -) TYPE=InnoDB ; 1115 +) TYPE=InnoDB;
1156 1116
1157 -- -------------------------------------------------------- 1117 -- --------------------------------------------------------
1158 1118
@@ -1170,7 +1130,7 @@ CREATE TABLE `upgrades` ( @@ -1170,7 +1130,7 @@ CREATE TABLE `upgrades` (
1170 PRIMARY KEY (`id`), 1130 PRIMARY KEY (`id`),
1171 KEY `descriptor` (`descriptor`), 1131 KEY `descriptor` (`descriptor`),
1172 KEY `parent` (`parent`) 1132 KEY `parent` (`parent`)
1173 -) TYPE=InnoDB ; 1133 +) TYPE=InnoDB;
1174 1134
1175 -- -------------------------------------------------------- 1135 -- --------------------------------------------------------
1176 1136
@@ -1197,7 +1157,7 @@ CREATE TABLE `users` ( @@ -1197,7 +1157,7 @@ CREATE TABLE `users` (
1197 UNIQUE KEY `id` (`id`), 1157 UNIQUE KEY `id` (`id`),
1198 UNIQUE KEY `username` (`username`), 1158 UNIQUE KEY `username` (`username`),
1199 KEY `authentication_source` (`authentication_source_id`) 1159 KEY `authentication_source` (`authentication_source_id`)
1200 -) TYPE=InnoDB ; 1160 +) TYPE=InnoDB;
1201 1161
1202 -- -------------------------------------------------------- 1162 -- --------------------------------------------------------
1203 1163
@@ -1212,49 +1172,7 @@ CREATE TABLE `users_groups_link` ( @@ -1212,49 +1172,7 @@ CREATE TABLE `users_groups_link` (
1212 UNIQUE KEY `id` (`id`), 1172 UNIQUE KEY `id` (`id`),
1213 KEY `fk_user_id` (`user_id`), 1173 KEY `fk_user_id` (`user_id`),
1214 KEY `fk_group_id` (`group_id`) 1174 KEY `fk_group_id` (`group_id`)
1215 -) TYPE=InnoDB ;  
1216 -  
1217 --- --------------------------------------------------------  
1218 -  
1219 ---  
1220 --- Table structure for table `web_documents`  
1221 ---  
1222 -  
1223 -CREATE TABLE `web_documents` (  
1224 - `id` int(11) NOT NULL default '0',  
1225 - `document_id` int(11) NOT NULL default '0',  
1226 - `web_site_id` int(11) NOT NULL default '0',  
1227 - `unit_id` int(11) NOT NULL default '0',  
1228 - `status_id` int(11) NOT NULL default '0',  
1229 - `datetime` datetime NOT NULL default '0000-00-00 00:00:00',  
1230 - UNIQUE KEY `id` (`id`)  
1231 -) TYPE=InnoDB ;  
1232 -  
1233 --- --------------------------------------------------------  
1234 -  
1235 ---  
1236 --- Table structure for table `web_documents_status_lookup`  
1237 ---  
1238 -  
1239 -CREATE TABLE `web_documents_status_lookup` (  
1240 - `id` int(11) NOT NULL default '0',  
1241 - `name` char(50) NOT NULL default '',  
1242 - UNIQUE KEY `id` (`id`)  
1243 -) TYPE=InnoDB ;  
1244 -  
1245 --- --------------------------------------------------------  
1246 -  
1247 ---  
1248 --- Table structure for table `web_sites`  
1249 ---  
1250 -  
1251 -CREATE TABLE `web_sites` (  
1252 - `id` int(11) NOT NULL default '0',  
1253 - `web_site_name` char(100) NOT NULL default '',  
1254 - `web_site_url` char(50) NOT NULL default '',  
1255 - `web_master_id` int(11) NOT NULL default '0',  
1256 - UNIQUE KEY `id` (`id`)  
1257 -) TYPE=InnoDB ; 1175 +) TYPE=InnoDB;
1258 1176
1259 -- -------------------------------------------------------- 1177 -- --------------------------------------------------------
1260 1178
@@ -1267,7 +1185,7 @@ CREATE TABLE `workflow_actions` ( @@ -1267,7 +1185,7 @@ CREATE TABLE `workflow_actions` (
1267 `action_name` char(255) NOT NULL default '', 1185 `action_name` char(255) NOT NULL default '',
1268 KEY `workflow_id` (`workflow_id`), 1186 KEY `workflow_id` (`workflow_id`),
1269 KEY `action_name` (`action_name`) 1187 KEY `action_name` (`action_name`)
1270 -) TYPE=InnoDB ; 1188 +) TYPE=InnoDB;
1271 1189
1272 -- -------------------------------------------------------- 1190 -- --------------------------------------------------------
1273 1191
@@ -1282,7 +1200,7 @@ CREATE TABLE `workflow_documents` ( @@ -1282,7 +1200,7 @@ CREATE TABLE `workflow_documents` (
1282 PRIMARY KEY (`document_id`), 1200 PRIMARY KEY (`document_id`),
1283 KEY `workflow_id` (`workflow_id`), 1201 KEY `workflow_id` (`workflow_id`),
1284 KEY `state_id` (`state_id`) 1202 KEY `state_id` (`state_id`)
1285 -) TYPE=InnoDB ; 1203 +) TYPE=InnoDB;
1286 1204
1287 -- -------------------------------------------------------- 1205 -- --------------------------------------------------------
1288 1206
@@ -1295,7 +1213,7 @@ CREATE TABLE `workflow_state_actions` ( @@ -1295,7 +1213,7 @@ CREATE TABLE `workflow_state_actions` (
1295 `action_name` char(255) NOT NULL default '0', 1213 `action_name` char(255) NOT NULL default '0',
1296 KEY `state_id` (`state_id`), 1214 KEY `state_id` (`state_id`),
1297 KEY `action_name` (`action_name`) 1215 KEY `action_name` (`action_name`)
1298 -) TYPE=InnoDB ; 1216 +) TYPE=InnoDB;
1299 1217
1300 -- -------------------------------------------------------- 1218 -- --------------------------------------------------------
1301 1219
@@ -1306,7 +1224,7 @@ CREATE TABLE `workflow_state_actions` ( @@ -1306,7 +1224,7 @@ CREATE TABLE `workflow_state_actions` (
1306 CREATE TABLE `workflow_state_transitions` ( 1224 CREATE TABLE `workflow_state_transitions` (
1307 `state_id` int(11) NOT NULL default '0', 1225 `state_id` int(11) NOT NULL default '0',
1308 `transition_id` int(11) NOT NULL default '0' 1226 `transition_id` int(11) NOT NULL default '0'
1309 -) TYPE=InnoDB ; 1227 +) TYPE=InnoDB;
1310 1228
1311 -- -------------------------------------------------------- 1229 -- --------------------------------------------------------
1312 1230
@@ -1324,7 +1242,7 @@ CREATE TABLE `workflow_states` ( @@ -1324,7 +1242,7 @@ CREATE TABLE `workflow_states` (
1324 KEY `workflow_id` (`workflow_id`), 1242 KEY `workflow_id` (`workflow_id`),
1325 KEY `name` (`name`), 1243 KEY `name` (`name`),
1326 KEY `inform_descriptor_id` (`inform_descriptor_id`) 1244 KEY `inform_descriptor_id` (`inform_descriptor_id`)
1327 -) TYPE=InnoDB ; 1245 +) TYPE=InnoDB;
1328 1246
1329 -- -------------------------------------------------------- 1247 -- --------------------------------------------------------
1330 1248
@@ -1351,7 +1269,7 @@ CREATE TABLE `workflow_transitions` ( @@ -1351,7 +1269,7 @@ CREATE TABLE `workflow_transitions` (
1351 KEY `guard_condition` (`guard_condition_id`), 1269 KEY `guard_condition` (`guard_condition_id`),
1352 KEY `guard_group_id` (`guard_group_id`), 1270 KEY `guard_group_id` (`guard_group_id`),
1353 KEY `guard_role_id` (`guard_role_id`) 1271 KEY `guard_role_id` (`guard_role_id`)
1354 -) TYPE=InnoDB ; 1272 +) TYPE=InnoDB;
1355 1273
1356 -- -------------------------------------------------------- 1274 -- --------------------------------------------------------
1357 1275
@@ -1367,7 +1285,7 @@ CREATE TABLE `workflows` ( @@ -1367,7 +1285,7 @@ CREATE TABLE `workflows` (
1367 PRIMARY KEY (`id`), 1285 PRIMARY KEY (`id`),
1368 UNIQUE KEY `name` (`name`), 1286 UNIQUE KEY `name` (`name`),
1369 KEY `start_state_id` (`start_state_id`) 1287 KEY `start_state_id` (`start_state_id`)
1370 -) TYPE=InnoDB ; 1288 +) TYPE=InnoDB;
1371 1289
1372 -- -------------------------------------------------------- 1290 -- --------------------------------------------------------
1373 1291
@@ -1376,9 +1294,9 @@ CREATE TABLE `workflows` ( @@ -1376,9 +1294,9 @@ CREATE TABLE `workflows` (
1376 -- 1294 --
1377 1295
1378 CREATE TABLE `zseq_active_sessions` ( 1296 CREATE TABLE `zseq_active_sessions` (
1379 - `id` int(10) unsigned NOT NULL auto_increment, 1297 + `id` int(10) unsigned NOT NULL,
1380 PRIMARY KEY (`id`) 1298 PRIMARY KEY (`id`)
1381 -) TYPE=MyISAM ; 1299 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1382 1300
1383 -- -------------------------------------------------------- 1301 -- --------------------------------------------------------
1384 1302
@@ -1387,9 +1305,9 @@ CREATE TABLE `zseq_active_sessions` ( @@ -1387,9 +1305,9 @@ CREATE TABLE `zseq_active_sessions` (
1387 -- 1305 --
1388 1306
1389 CREATE TABLE `zseq_archive_restoration_request` ( 1307 CREATE TABLE `zseq_archive_restoration_request` (
1390 - `id` int(10) unsigned NOT NULL auto_increment, 1308 + `id` int(10) unsigned NOT NULL,
1391 PRIMARY KEY (`id`) 1309 PRIMARY KEY (`id`)
1392 -) TYPE=MyISAM ; 1310 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1393 1311
1394 -- -------------------------------------------------------- 1312 -- --------------------------------------------------------
1395 1313
@@ -1398,9 +1316,9 @@ CREATE TABLE `zseq_archive_restoration_request` ( @@ -1398,9 +1316,9 @@ CREATE TABLE `zseq_archive_restoration_request` (
1398 -- 1316 --
1399 1317
1400 CREATE TABLE `zseq_archiving_settings` ( 1318 CREATE TABLE `zseq_archiving_settings` (
1401 - `id` int(10) unsigned NOT NULL auto_increment, 1319 + `id` int(10) unsigned NOT NULL,
1402 PRIMARY KEY (`id`) 1320 PRIMARY KEY (`id`)
1403 -) TYPE=MyISAM ; 1321 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1404 1322
1405 -- -------------------------------------------------------- 1323 -- --------------------------------------------------------
1406 1324
@@ -1409,9 +1327,9 @@ CREATE TABLE `zseq_archiving_settings` ( @@ -1409,9 +1327,9 @@ CREATE TABLE `zseq_archiving_settings` (
1409 -- 1327 --
1410 1328
1411 CREATE TABLE `zseq_archiving_type_lookup` ( 1329 CREATE TABLE `zseq_archiving_type_lookup` (
1412 - `id` int(10) unsigned NOT NULL auto_increment, 1330 + `id` int(10) unsigned NOT NULL,
1413 PRIMARY KEY (`id`) 1331 PRIMARY KEY (`id`)
1414 -) TYPE=MyISAM ; 1332 +) TYPE=MyISAM AUTO_INCREMENT=3 ;
1415 1333
1416 -- -------------------------------------------------------- 1334 -- --------------------------------------------------------
1417 1335
@@ -1420,9 +1338,9 @@ CREATE TABLE `zseq_archiving_type_lookup` ( @@ -1420,9 +1338,9 @@ CREATE TABLE `zseq_archiving_type_lookup` (
1420 -- 1338 --
1421 1339
1422 CREATE TABLE `zseq_authentication_sources` ( 1340 CREATE TABLE `zseq_authentication_sources` (
1423 - `id` int(10) unsigned NOT NULL auto_increment, 1341 + `id` int(10) unsigned NOT NULL,
1424 PRIMARY KEY (`id`) 1342 PRIMARY KEY (`id`)
1425 -) TYPE=MyISAM ; 1343 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1426 1344
1427 -- -------------------------------------------------------- 1345 -- --------------------------------------------------------
1428 1346
@@ -1431,9 +1349,9 @@ CREATE TABLE `zseq_authentication_sources` ( @@ -1431,9 +1349,9 @@ CREATE TABLE `zseq_authentication_sources` (
1431 -- 1349 --
1432 1350
1433 CREATE TABLE `zseq_browse_criteria` ( 1351 CREATE TABLE `zseq_browse_criteria` (
1434 - `id` int(10) unsigned NOT NULL auto_increment, 1352 + `id` int(10) unsigned NOT NULL,
1435 PRIMARY KEY (`id`) 1353 PRIMARY KEY (`id`)
1436 -) TYPE=MyISAM ; 1354 +) TYPE=MyISAM AUTO_INCREMENT=6 ;
1437 1355
1438 -- -------------------------------------------------------- 1356 -- --------------------------------------------------------
1439 1357
@@ -1442,9 +1360,9 @@ CREATE TABLE `zseq_browse_criteria` ( @@ -1442,9 +1360,9 @@ CREATE TABLE `zseq_browse_criteria` (
1442 -- 1360 --
1443 1361
1444 CREATE TABLE `zseq_dashlet_disables` ( 1362 CREATE TABLE `zseq_dashlet_disables` (
1445 - `id` int(10) unsigned NOT NULL auto_increment, 1363 + `id` int(10) unsigned NOT NULL,
1446 PRIMARY KEY (`id`) 1364 PRIMARY KEY (`id`)
1447 -) TYPE=MyISAM ; 1365 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1448 1366
1449 -- -------------------------------------------------------- 1367 -- --------------------------------------------------------
1450 1368
@@ -1453,9 +1371,9 @@ CREATE TABLE `zseq_dashlet_disables` ( @@ -1453,9 +1371,9 @@ CREATE TABLE `zseq_dashlet_disables` (
1453 -- 1371 --
1454 1372
1455 CREATE TABLE `zseq_data_types` ( 1373 CREATE TABLE `zseq_data_types` (
1456 - `id` int(10) unsigned NOT NULL auto_increment, 1374 + `id` int(10) unsigned NOT NULL,
1457 PRIMARY KEY (`id`) 1375 PRIMARY KEY (`id`)
1458 -) TYPE=MyISAM ; 1376 +) TYPE=MyISAM AUTO_INCREMENT=6 ;
1459 1377
1460 -- -------------------------------------------------------- 1378 -- --------------------------------------------------------
1461 1379
@@ -1464,9 +1382,9 @@ CREATE TABLE `zseq_data_types` ( @@ -1464,9 +1382,9 @@ CREATE TABLE `zseq_data_types` (
1464 -- 1382 --
1465 1383
1466 CREATE TABLE `zseq_dependant_document_instance` ( 1384 CREATE TABLE `zseq_dependant_document_instance` (
1467 - `id` int(10) unsigned NOT NULL auto_increment, 1385 + `id` int(10) unsigned NOT NULL,
1468 PRIMARY KEY (`id`) 1386 PRIMARY KEY (`id`)
1469 -) TYPE=MyISAM ; 1387 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1470 1388
1471 -- -------------------------------------------------------- 1389 -- --------------------------------------------------------
1472 1390
@@ -1475,9 +1393,9 @@ CREATE TABLE `zseq_dependant_document_instance` ( @@ -1475,9 +1393,9 @@ CREATE TABLE `zseq_dependant_document_instance` (
1475 -- 1393 --
1476 1394
1477 CREATE TABLE `zseq_dependant_document_template` ( 1395 CREATE TABLE `zseq_dependant_document_template` (
1478 - `id` int(10) unsigned NOT NULL auto_increment, 1396 + `id` int(10) unsigned NOT NULL,
1479 PRIMARY KEY (`id`) 1397 PRIMARY KEY (`id`)
1480 -) TYPE=MyISAM ; 1398 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1481 1399
1482 -- -------------------------------------------------------- 1400 -- --------------------------------------------------------
1483 1401
@@ -1486,9 +1404,9 @@ CREATE TABLE `zseq_dependant_document_template` ( @@ -1486,9 +1404,9 @@ CREATE TABLE `zseq_dependant_document_template` (
1486 -- 1404 --
1487 1405
1488 CREATE TABLE `zseq_discussion_comments` ( 1406 CREATE TABLE `zseq_discussion_comments` (
1489 - `id` int(10) unsigned NOT NULL auto_increment, 1407 + `id` int(10) unsigned NOT NULL,
1490 PRIMARY KEY (`id`) 1408 PRIMARY KEY (`id`)
1491 -) TYPE=MyISAM ; 1409 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1492 1410
1493 -- -------------------------------------------------------- 1411 -- --------------------------------------------------------
1494 1412
@@ -1497,9 +1415,9 @@ CREATE TABLE `zseq_discussion_comments` ( @@ -1497,9 +1415,9 @@ CREATE TABLE `zseq_discussion_comments` (
1497 -- 1415 --
1498 1416
1499 CREATE TABLE `zseq_discussion_threads` ( 1417 CREATE TABLE `zseq_discussion_threads` (
1500 - `id` int(10) unsigned NOT NULL auto_increment, 1418 + `id` int(10) unsigned NOT NULL,
1501 PRIMARY KEY (`id`) 1419 PRIMARY KEY (`id`)
1502 -) TYPE=MyISAM ; 1420 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1503 1421
1504 -- -------------------------------------------------------- 1422 -- --------------------------------------------------------
1505 1423
@@ -1508,9 +1426,20 @@ CREATE TABLE `zseq_discussion_threads` ( @@ -1508,9 +1426,20 @@ CREATE TABLE `zseq_discussion_threads` (
1508 -- 1426 --
1509 1427
1510 CREATE TABLE `zseq_document_archiving_link` ( 1428 CREATE TABLE `zseq_document_archiving_link` (
1511 - `id` int(10) unsigned NOT NULL auto_increment, 1429 + `id` int(10) unsigned NOT NULL,
  1430 + PRIMARY KEY (`id`)
  1431 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
  1432 +
  1433 +-- --------------------------------------------------------
  1434 +
  1435 +--
  1436 +-- Table structure for table `zseq_document_content_version`
  1437 +--
  1438 +
  1439 +CREATE TABLE `zseq_document_content_version` (
  1440 + `id` int(10) unsigned NOT NULL,
1512 PRIMARY KEY (`id`) 1441 PRIMARY KEY (`id`)
1513 -) TYPE=MyISAM ; 1442 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1514 1443
1515 -- -------------------------------------------------------- 1444 -- --------------------------------------------------------
1516 1445
@@ -1519,9 +1448,9 @@ CREATE TABLE `zseq_document_archiving_link` ( @@ -1519,9 +1448,9 @@ CREATE TABLE `zseq_document_archiving_link` (
1519 -- 1448 --
1520 1449
1521 CREATE TABLE `zseq_document_fields` ( 1450 CREATE TABLE `zseq_document_fields` (
1522 - `id` int(10) unsigned NOT NULL auto_increment, 1451 + `id` int(10) unsigned NOT NULL,
1523 PRIMARY KEY (`id`) 1452 PRIMARY KEY (`id`)
1524 -) TYPE=MyISAM ; 1453 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1525 1454
1526 -- -------------------------------------------------------- 1455 -- --------------------------------------------------------
1527 1456
@@ -1530,9 +1459,9 @@ CREATE TABLE `zseq_document_fields` ( @@ -1530,9 +1459,9 @@ CREATE TABLE `zseq_document_fields` (
1530 -- 1459 --
1531 1460
1532 CREATE TABLE `zseq_document_fields_link` ( 1461 CREATE TABLE `zseq_document_fields_link` (
1533 - `id` int(10) unsigned NOT NULL auto_increment, 1462 + `id` int(10) unsigned NOT NULL,
1534 PRIMARY KEY (`id`) 1463 PRIMARY KEY (`id`)
1535 -) TYPE=MyISAM ; 1464 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1536 1465
1537 -- -------------------------------------------------------- 1466 -- --------------------------------------------------------
1538 1467
@@ -1541,9 +1470,9 @@ CREATE TABLE `zseq_document_fields_link` ( @@ -1541,9 +1470,9 @@ CREATE TABLE `zseq_document_fields_link` (
1541 -- 1470 --
1542 1471
1543 CREATE TABLE `zseq_document_link` ( 1472 CREATE TABLE `zseq_document_link` (
1544 - `id` int(10) unsigned NOT NULL auto_increment, 1473 + `id` int(10) unsigned NOT NULL,
1545 PRIMARY KEY (`id`) 1474 PRIMARY KEY (`id`)
1546 -) TYPE=MyISAM ; 1475 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1547 1476
1548 -- -------------------------------------------------------- 1477 -- --------------------------------------------------------
1549 1478
@@ -1552,9 +1481,20 @@ CREATE TABLE `zseq_document_link` ( @@ -1552,9 +1481,20 @@ CREATE TABLE `zseq_document_link` (
1552 -- 1481 --
1553 1482
1554 CREATE TABLE `zseq_document_link_types` ( 1483 CREATE TABLE `zseq_document_link_types` (
1555 - `id` int(10) unsigned NOT NULL auto_increment, 1484 + `id` int(10) unsigned NOT NULL,
  1485 + PRIMARY KEY (`id`)
  1486 +) TYPE=MyISAM AUTO_INCREMENT=3 ;
  1487 +
  1488 +-- --------------------------------------------------------
  1489 +
  1490 +--
  1491 +-- Table structure for table `zseq_document_metadata_version`
  1492 +--
  1493 +
  1494 +CREATE TABLE `zseq_document_metadata_version` (
  1495 + `id` int(10) unsigned NOT NULL,
1556 PRIMARY KEY (`id`) 1496 PRIMARY KEY (`id`)
1557 -) TYPE=MyISAM ; 1497 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1558 1498
1559 -- -------------------------------------------------------- 1499 -- --------------------------------------------------------
1560 1500
@@ -1563,9 +1503,9 @@ CREATE TABLE `zseq_document_link_types` ( @@ -1563,9 +1503,9 @@ CREATE TABLE `zseq_document_link_types` (
1563 -- 1503 --
1564 1504
1565 CREATE TABLE `zseq_document_subscriptions` ( 1505 CREATE TABLE `zseq_document_subscriptions` (
1566 - `id` int(10) unsigned NOT NULL auto_increment, 1506 + `id` int(10) unsigned NOT NULL,
1567 PRIMARY KEY (`id`) 1507 PRIMARY KEY (`id`)
1568 -) TYPE=MyISAM ; 1508 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1569 1509
1570 -- -------------------------------------------------------- 1510 -- --------------------------------------------------------
1571 1511
@@ -1574,9 +1514,9 @@ CREATE TABLE `zseq_document_subscriptions` ( @@ -1574,9 +1514,9 @@ CREATE TABLE `zseq_document_subscriptions` (
1574 -- 1514 --
1575 1515
1576 CREATE TABLE `zseq_document_transaction_types_lookup` ( 1516 CREATE TABLE `zseq_document_transaction_types_lookup` (
1577 - `id` int(10) unsigned NOT NULL auto_increment, 1517 + `id` int(10) unsigned NOT NULL,
1578 PRIMARY KEY (`id`) 1518 PRIMARY KEY (`id`)
1579 -) TYPE=MyISAM ; 1519 +) TYPE=MyISAM AUTO_INCREMENT=17 ;
1580 1520
1581 -- -------------------------------------------------------- 1521 -- --------------------------------------------------------
1582 1522
@@ -1585,9 +1525,9 @@ CREATE TABLE `zseq_document_transaction_types_lookup` ( @@ -1585,9 +1525,9 @@ CREATE TABLE `zseq_document_transaction_types_lookup` (
1585 -- 1525 --
1586 1526
1587 CREATE TABLE `zseq_document_transactions` ( 1527 CREATE TABLE `zseq_document_transactions` (
1588 - `id` int(10) unsigned NOT NULL auto_increment, 1528 + `id` int(10) unsigned NOT NULL,
1589 PRIMARY KEY (`id`) 1529 PRIMARY KEY (`id`)
1590 -) TYPE=MyISAM ; 1530 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1591 1531
1592 -- -------------------------------------------------------- 1532 -- --------------------------------------------------------
1593 1533
@@ -1596,9 +1536,9 @@ CREATE TABLE `zseq_document_transactions` ( @@ -1596,9 +1536,9 @@ CREATE TABLE `zseq_document_transactions` (
1596 -- 1536 --
1597 1537
1598 CREATE TABLE `zseq_document_type_fields_link` ( 1538 CREATE TABLE `zseq_document_type_fields_link` (
1599 - `id` int(10) unsigned NOT NULL auto_increment, 1539 + `id` int(10) unsigned NOT NULL,
1600 PRIMARY KEY (`id`) 1540 PRIMARY KEY (`id`)
1601 -) TYPE=MyISAM ; 1541 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1602 1542
1603 -- -------------------------------------------------------- 1543 -- --------------------------------------------------------
1604 1544
@@ -1607,9 +1547,9 @@ CREATE TABLE `zseq_document_type_fields_link` ( @@ -1607,9 +1547,9 @@ CREATE TABLE `zseq_document_type_fields_link` (
1607 -- 1547 --
1608 1548
1609 CREATE TABLE `zseq_document_type_fieldsets_link` ( 1549 CREATE TABLE `zseq_document_type_fieldsets_link` (
1610 - `id` int(10) unsigned NOT NULL auto_increment, 1550 + `id` int(10) unsigned NOT NULL,
1611 PRIMARY KEY (`id`) 1551 PRIMARY KEY (`id`)
1612 -) TYPE=MyISAM ; 1552 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1613 1553
1614 -- -------------------------------------------------------- 1554 -- --------------------------------------------------------
1615 1555
@@ -1618,9 +1558,9 @@ CREATE TABLE `zseq_document_type_fieldsets_link` ( @@ -1618,9 +1558,9 @@ CREATE TABLE `zseq_document_type_fieldsets_link` (
1618 -- 1558 --
1619 1559
1620 CREATE TABLE `zseq_document_types_lookup` ( 1560 CREATE TABLE `zseq_document_types_lookup` (
1621 - `id` int(10) unsigned NOT NULL auto_increment, 1561 + `id` int(10) unsigned NOT NULL,
1622 PRIMARY KEY (`id`) 1562 PRIMARY KEY (`id`)
1623 -) TYPE=MyISAM ; 1563 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1624 1564
1625 -- -------------------------------------------------------- 1565 -- --------------------------------------------------------
1626 1566
@@ -1629,9 +1569,9 @@ CREATE TABLE `zseq_document_types_lookup` ( @@ -1629,9 +1569,9 @@ CREATE TABLE `zseq_document_types_lookup` (
1629 -- 1569 --
1630 1570
1631 CREATE TABLE `zseq_documents` ( 1571 CREATE TABLE `zseq_documents` (
1632 - `id` int(10) unsigned NOT NULL auto_increment, 1572 + `id` int(10) unsigned NOT NULL,
1633 PRIMARY KEY (`id`) 1573 PRIMARY KEY (`id`)
1634 -) TYPE=MyISAM ; 1574 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1635 1575
1636 -- -------------------------------------------------------- 1576 -- --------------------------------------------------------
1637 1577
@@ -1640,9 +1580,9 @@ CREATE TABLE `zseq_documents` ( @@ -1640,9 +1580,9 @@ CREATE TABLE `zseq_documents` (
1640 -- 1580 --
1641 1581
1642 CREATE TABLE `zseq_field_behaviours` ( 1582 CREATE TABLE `zseq_field_behaviours` (
1643 - `id` int(10) unsigned NOT NULL auto_increment, 1583 + `id` int(10) unsigned NOT NULL,
1644 PRIMARY KEY (`id`) 1584 PRIMARY KEY (`id`)
1645 -) TYPE=MyISAM ; 1585 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1646 1586
1647 -- -------------------------------------------------------- 1587 -- --------------------------------------------------------
1648 1588
@@ -1651,9 +1591,9 @@ CREATE TABLE `zseq_field_behaviours` ( @@ -1651,9 +1591,9 @@ CREATE TABLE `zseq_field_behaviours` (
1651 -- 1591 --
1652 1592
1653 CREATE TABLE `zseq_field_value_instances` ( 1593 CREATE TABLE `zseq_field_value_instances` (
1654 - `id` int(10) unsigned NOT NULL auto_increment, 1594 + `id` int(10) unsigned NOT NULL,
1655 PRIMARY KEY (`id`) 1595 PRIMARY KEY (`id`)
1656 -) TYPE=MyISAM ; 1596 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1657 1597
1658 -- -------------------------------------------------------- 1598 -- --------------------------------------------------------
1659 1599
@@ -1662,9 +1602,9 @@ CREATE TABLE `zseq_field_value_instances` ( @@ -1662,9 +1602,9 @@ CREATE TABLE `zseq_field_value_instances` (
1662 -- 1602 --
1663 1603
1664 CREATE TABLE `zseq_fieldsets` ( 1604 CREATE TABLE `zseq_fieldsets` (
1665 - `id` int(10) unsigned NOT NULL auto_increment, 1605 + `id` int(10) unsigned NOT NULL,
1666 PRIMARY KEY (`id`) 1606 PRIMARY KEY (`id`)
1667 -) TYPE=MyISAM ; 1607 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1668 1608
1669 -- -------------------------------------------------------- 1609 -- --------------------------------------------------------
1670 1610
@@ -1673,9 +1613,9 @@ CREATE TABLE `zseq_fieldsets` ( @@ -1673,9 +1613,9 @@ CREATE TABLE `zseq_fieldsets` (
1673 -- 1613 --
1674 1614
1675 CREATE TABLE `zseq_folder_doctypes_link` ( 1615 CREATE TABLE `zseq_folder_doctypes_link` (
1676 - `id` int(10) unsigned NOT NULL auto_increment, 1616 + `id` int(10) unsigned NOT NULL,
1677 PRIMARY KEY (`id`) 1617 PRIMARY KEY (`id`)
1678 -) TYPE=MyISAM ; 1618 +) TYPE=MyISAM AUTO_INCREMENT=3 ;
1679 1619
1680 -- -------------------------------------------------------- 1620 -- --------------------------------------------------------
1681 1621
@@ -1684,9 +1624,9 @@ CREATE TABLE `zseq_folder_doctypes_link` ( @@ -1684,9 +1624,9 @@ CREATE TABLE `zseq_folder_doctypes_link` (
1684 -- 1624 --
1685 1625
1686 CREATE TABLE `zseq_folder_subscriptions` ( 1626 CREATE TABLE `zseq_folder_subscriptions` (
1687 - `id` int(10) unsigned NOT NULL auto_increment, 1627 + `id` int(10) unsigned NOT NULL,
1688 PRIMARY KEY (`id`) 1628 PRIMARY KEY (`id`)
1689 -) TYPE=MyISAM ; 1629 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1690 1630
1691 -- -------------------------------------------------------- 1631 -- --------------------------------------------------------
1692 1632
@@ -1695,9 +1635,9 @@ CREATE TABLE `zseq_folder_subscriptions` ( @@ -1695,9 +1635,9 @@ CREATE TABLE `zseq_folder_subscriptions` (
1695 -- 1635 --
1696 1636
1697 CREATE TABLE `zseq_folders` ( 1637 CREATE TABLE `zseq_folders` (
1698 - `id` int(10) unsigned NOT NULL auto_increment, 1638 + `id` int(10) unsigned NOT NULL,
1699 PRIMARY KEY (`id`) 1639 PRIMARY KEY (`id`)
1700 -) TYPE=MyISAM ; 1640 +) TYPE=MyISAM AUTO_INCREMENT=3 ;
1701 1641
1702 -- -------------------------------------------------------- 1642 -- --------------------------------------------------------
1703 1643
@@ -1706,31 +1646,9 @@ CREATE TABLE `zseq_folders` ( @@ -1706,31 +1646,9 @@ CREATE TABLE `zseq_folders` (
1706 -- 1646 --
1707 1647
1708 CREATE TABLE `zseq_folders_users_roles_link` ( 1648 CREATE TABLE `zseq_folders_users_roles_link` (
1709 - `id` int(10) unsigned NOT NULL auto_increment, 1649 + `id` int(10) unsigned NOT NULL,
1710 PRIMARY KEY (`id`) 1650 PRIMARY KEY (`id`)
1711 -) TYPE=MyISAM ;  
1712 -  
1713 --- --------------------------------------------------------  
1714 -  
1715 ---  
1716 --- Table structure for table `zseq_groups_folders_approval_link`  
1717 ---  
1718 -  
1719 -CREATE TABLE `zseq_groups_folders_approval_link` (  
1720 - `id` int(10) unsigned NOT NULL auto_increment,  
1721 - PRIMARY KEY (`id`)  
1722 -) TYPE=MyISAM ;  
1723 -  
1724 --- --------------------------------------------------------  
1725 -  
1726 ---  
1727 --- Table structure for table `zseq_groups_folders_link`  
1728 ---  
1729 -  
1730 -CREATE TABLE `zseq_groups_folders_link` (  
1731 - `id` int(10) unsigned NOT NULL auto_increment,  
1732 - PRIMARY KEY (`id`)  
1733 -) TYPE=MyISAM ; 1651 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1734 1652
1735 -- -------------------------------------------------------- 1653 -- --------------------------------------------------------
1736 1654
@@ -1739,9 +1657,9 @@ CREATE TABLE `zseq_groups_folders_link` ( @@ -1739,9 +1657,9 @@ CREATE TABLE `zseq_groups_folders_link` (
1739 -- 1657 --
1740 1658
1741 CREATE TABLE `zseq_groups_groups_link` ( 1659 CREATE TABLE `zseq_groups_groups_link` (
1742 - `id` int(10) unsigned NOT NULL auto_increment, 1660 + `id` int(10) unsigned NOT NULL,
1743 PRIMARY KEY (`id`) 1661 PRIMARY KEY (`id`)
1744 -) TYPE=MyISAM ; 1662 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1745 1663
1746 -- -------------------------------------------------------- 1664 -- --------------------------------------------------------
1747 1665
@@ -1750,9 +1668,9 @@ CREATE TABLE `zseq_groups_groups_link` ( @@ -1750,9 +1668,9 @@ CREATE TABLE `zseq_groups_groups_link` (
1750 -- 1668 --
1751 1669
1752 CREATE TABLE `zseq_groups_lookup` ( 1670 CREATE TABLE `zseq_groups_lookup` (
1753 - `id` int(10) unsigned NOT NULL auto_increment, 1671 + `id` int(10) unsigned NOT NULL,
1754 PRIMARY KEY (`id`) 1672 PRIMARY KEY (`id`)
1755 -) TYPE=MyISAM ; 1673 +) TYPE=MyISAM AUTO_INCREMENT=4 ;
1756 1674
1757 -- -------------------------------------------------------- 1675 -- --------------------------------------------------------
1758 1676
@@ -1761,9 +1679,9 @@ CREATE TABLE `zseq_groups_lookup` ( @@ -1761,9 +1679,9 @@ CREATE TABLE `zseq_groups_lookup` (
1761 -- 1679 --
1762 1680
1763 CREATE TABLE `zseq_groups_units_link` ( 1681 CREATE TABLE `zseq_groups_units_link` (
1764 - `id` int(10) unsigned NOT NULL auto_increment, 1682 + `id` int(10) unsigned NOT NULL,
1765 PRIMARY KEY (`id`) 1683 PRIMARY KEY (`id`)
1766 -) TYPE=MyISAM ; 1684 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1767 1685
1768 -- -------------------------------------------------------- 1686 -- --------------------------------------------------------
1769 1687
@@ -1772,9 +1690,9 @@ CREATE TABLE `zseq_groups_units_link` ( @@ -1772,9 +1690,9 @@ CREATE TABLE `zseq_groups_units_link` (
1772 -- 1690 --
1773 1691
1774 CREATE TABLE `zseq_help` ( 1692 CREATE TABLE `zseq_help` (
1775 - `id` int(10) unsigned NOT NULL auto_increment, 1693 + `id` int(10) unsigned NOT NULL,
1776 PRIMARY KEY (`id`) 1694 PRIMARY KEY (`id`)
1777 -) TYPE=MyISAM ; 1695 +) TYPE=MyISAM AUTO_INCREMENT=99 ;
1778 1696
1779 -- -------------------------------------------------------- 1697 -- --------------------------------------------------------
1780 1698
@@ -1783,9 +1701,9 @@ CREATE TABLE `zseq_help` ( @@ -1783,9 +1701,9 @@ CREATE TABLE `zseq_help` (
1783 -- 1701 --
1784 1702
1785 CREATE TABLE `zseq_help_replacement` ( 1703 CREATE TABLE `zseq_help_replacement` (
1786 - `id` int(10) unsigned NOT NULL auto_increment, 1704 + `id` int(10) unsigned NOT NULL,
1787 PRIMARY KEY (`id`) 1705 PRIMARY KEY (`id`)
1788 -) TYPE=MyISAM ; 1706 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1789 1707
1790 -- -------------------------------------------------------- 1708 -- --------------------------------------------------------
1791 1709
@@ -1794,9 +1712,9 @@ CREATE TABLE `zseq_help_replacement` ( @@ -1794,9 +1712,9 @@ CREATE TABLE `zseq_help_replacement` (
1794 -- 1712 --
1795 1713
1796 CREATE TABLE `zseq_links` ( 1714 CREATE TABLE `zseq_links` (
1797 - `id` int(10) unsigned NOT NULL auto_increment, 1715 + `id` int(10) unsigned NOT NULL,
1798 PRIMARY KEY (`id`) 1716 PRIMARY KEY (`id`)
1799 -) TYPE=MyISAM ; 1717 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1800 1718
1801 -- -------------------------------------------------------- 1719 -- --------------------------------------------------------
1802 1720
@@ -1805,9 +1723,9 @@ CREATE TABLE `zseq_links` ( @@ -1805,9 +1723,9 @@ CREATE TABLE `zseq_links` (
1805 -- 1723 --
1806 1724
1807 CREATE TABLE `zseq_metadata_lookup` ( 1725 CREATE TABLE `zseq_metadata_lookup` (
1808 - `id` int(10) unsigned NOT NULL auto_increment, 1726 + `id` int(10) unsigned NOT NULL,
1809 PRIMARY KEY (`id`) 1727 PRIMARY KEY (`id`)
1810 -) TYPE=MyISAM ; 1728 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1811 1729
1812 -- -------------------------------------------------------- 1730 -- --------------------------------------------------------
1813 1731
@@ -1816,9 +1734,9 @@ CREATE TABLE `zseq_metadata_lookup` ( @@ -1816,9 +1734,9 @@ CREATE TABLE `zseq_metadata_lookup` (
1816 -- 1734 --
1817 1735
1818 CREATE TABLE `zseq_metadata_lookup_tree` ( 1736 CREATE TABLE `zseq_metadata_lookup_tree` (
1819 - `id` int(10) unsigned NOT NULL auto_increment, 1737 + `id` int(10) unsigned NOT NULL,
1820 PRIMARY KEY (`id`) 1738 PRIMARY KEY (`id`)
1821 -) TYPE=MyISAM ; 1739 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1822 1740
1823 -- -------------------------------------------------------- 1741 -- --------------------------------------------------------
1824 1742
@@ -1827,9 +1745,9 @@ CREATE TABLE `zseq_metadata_lookup_tree` ( @@ -1827,9 +1745,9 @@ CREATE TABLE `zseq_metadata_lookup_tree` (
1827 -- 1745 --
1828 1746
1829 CREATE TABLE `zseq_mime_types` ( 1747 CREATE TABLE `zseq_mime_types` (
1830 - `id` int(10) unsigned NOT NULL auto_increment, 1748 + `id` int(10) unsigned NOT NULL,
1831 PRIMARY KEY (`id`) 1749 PRIMARY KEY (`id`)
1832 -) TYPE=MyISAM ; 1750 +) TYPE=MyISAM AUTO_INCREMENT=142 ;
1833 1751
1834 -- -------------------------------------------------------- 1752 -- --------------------------------------------------------
1835 1753
@@ -1838,9 +1756,9 @@ CREATE TABLE `zseq_mime_types` ( @@ -1838,9 +1756,9 @@ CREATE TABLE `zseq_mime_types` (
1838 -- 1756 --
1839 1757
1840 CREATE TABLE `zseq_news` ( 1758 CREATE TABLE `zseq_news` (
1841 - `id` int(10) unsigned NOT NULL auto_increment, 1759 + `id` int(10) unsigned NOT NULL,
1842 PRIMARY KEY (`id`) 1760 PRIMARY KEY (`id`)
1843 -) TYPE=MyISAM ; 1761 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1844 1762
1845 -- -------------------------------------------------------- 1763 -- --------------------------------------------------------
1846 1764
@@ -1849,9 +1767,9 @@ CREATE TABLE `zseq_news` ( @@ -1849,9 +1767,9 @@ CREATE TABLE `zseq_news` (
1849 -- 1767 --
1850 1768
1851 CREATE TABLE `zseq_notifications` ( 1769 CREATE TABLE `zseq_notifications` (
1852 - `id` int(10) unsigned NOT NULL auto_increment, 1770 + `id` int(10) unsigned NOT NULL,
1853 PRIMARY KEY (`id`) 1771 PRIMARY KEY (`id`)
1854 -) TYPE=MyISAM ; 1772 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1855 1773
1856 -- -------------------------------------------------------- 1774 -- --------------------------------------------------------
1857 1775
@@ -1860,9 +1778,9 @@ CREATE TABLE `zseq_notifications` ( @@ -1860,9 +1778,9 @@ CREATE TABLE `zseq_notifications` (
1860 -- 1778 --
1861 1779
1862 CREATE TABLE `zseq_organisations_lookup` ( 1780 CREATE TABLE `zseq_organisations_lookup` (
1863 - `id` int(10) unsigned NOT NULL auto_increment, 1781 + `id` int(10) unsigned NOT NULL,
1864 PRIMARY KEY (`id`) 1782 PRIMARY KEY (`id`)
1865 -) TYPE=MyISAM ; 1783 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1866 1784
1867 -- -------------------------------------------------------- 1785 -- --------------------------------------------------------
1868 1786
@@ -1871,9 +1789,9 @@ CREATE TABLE `zseq_organisations_lookup` ( @@ -1871,9 +1789,9 @@ CREATE TABLE `zseq_organisations_lookup` (
1871 -- 1789 --
1872 1790
1873 CREATE TABLE `zseq_permission_assignments` ( 1791 CREATE TABLE `zseq_permission_assignments` (
1874 - `id` int(10) unsigned NOT NULL auto_increment, 1792 + `id` int(10) unsigned NOT NULL,
1875 PRIMARY KEY (`id`) 1793 PRIMARY KEY (`id`)
1876 -) TYPE=MyISAM ; 1794 +) TYPE=MyISAM AUTO_INCREMENT=4 ;
1877 1795
1878 -- -------------------------------------------------------- 1796 -- --------------------------------------------------------
1879 1797
@@ -1882,9 +1800,9 @@ CREATE TABLE `zseq_permission_assignments` ( @@ -1882,9 +1800,9 @@ CREATE TABLE `zseq_permission_assignments` (
1882 -- 1800 --
1883 1801
1884 CREATE TABLE `zseq_permission_descriptors` ( 1802 CREATE TABLE `zseq_permission_descriptors` (
1885 - `id` int(10) unsigned NOT NULL auto_increment, 1803 + `id` int(10) unsigned NOT NULL,
1886 PRIMARY KEY (`id`) 1804 PRIMARY KEY (`id`)
1887 -) TYPE=MyISAM ; 1805 +) TYPE=MyISAM AUTO_INCREMENT=3 ;
1888 1806
1889 -- -------------------------------------------------------- 1807 -- --------------------------------------------------------
1890 1808
@@ -1893,9 +1811,9 @@ CREATE TABLE `zseq_permission_descriptors` ( @@ -1893,9 +1811,9 @@ CREATE TABLE `zseq_permission_descriptors` (
1893 -- 1811 --
1894 1812
1895 CREATE TABLE `zseq_permission_dynamic_conditions` ( 1813 CREATE TABLE `zseq_permission_dynamic_conditions` (
1896 - `id` int(10) unsigned NOT NULL auto_increment, 1814 + `id` int(10) unsigned NOT NULL,
1897 PRIMARY KEY (`id`) 1815 PRIMARY KEY (`id`)
1898 -) TYPE=MyISAM ; 1816 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1899 1817
1900 -- -------------------------------------------------------- 1818 -- --------------------------------------------------------
1901 1819
@@ -1904,9 +1822,9 @@ CREATE TABLE `zseq_permission_dynamic_conditions` ( @@ -1904,9 +1822,9 @@ CREATE TABLE `zseq_permission_dynamic_conditions` (
1904 -- 1822 --
1905 1823
1906 CREATE TABLE `zseq_permission_lookup_assignments` ( 1824 CREATE TABLE `zseq_permission_lookup_assignments` (
1907 - `id` int(10) unsigned NOT NULL auto_increment, 1825 + `id` int(10) unsigned NOT NULL,
1908 PRIMARY KEY (`id`) 1826 PRIMARY KEY (`id`)
1909 -) TYPE=MyISAM ; 1827 +) TYPE=MyISAM AUTO_INCREMENT=7 ;
1910 1828
1911 -- -------------------------------------------------------- 1829 -- --------------------------------------------------------
1912 1830
@@ -1915,9 +1833,9 @@ CREATE TABLE `zseq_permission_lookup_assignments` ( @@ -1915,9 +1833,9 @@ CREATE TABLE `zseq_permission_lookup_assignments` (
1915 -- 1833 --
1916 1834
1917 CREATE TABLE `zseq_permission_lookups` ( 1835 CREATE TABLE `zseq_permission_lookups` (
1918 - `id` int(10) unsigned NOT NULL auto_increment, 1836 + `id` int(10) unsigned NOT NULL,
1919 PRIMARY KEY (`id`) 1837 PRIMARY KEY (`id`)
1920 -) TYPE=MyISAM ; 1838 +) TYPE=MyISAM AUTO_INCREMENT=3 ;
1921 1839
1922 -- -------------------------------------------------------- 1840 -- --------------------------------------------------------
1923 1841
@@ -1926,9 +1844,9 @@ CREATE TABLE `zseq_permission_lookups` ( @@ -1926,9 +1844,9 @@ CREATE TABLE `zseq_permission_lookups` (
1926 -- 1844 --
1927 1845
1928 CREATE TABLE `zseq_permission_objects` ( 1846 CREATE TABLE `zseq_permission_objects` (
1929 - `id` int(10) unsigned NOT NULL auto_increment, 1847 + `id` int(10) unsigned NOT NULL,
1930 PRIMARY KEY (`id`) 1848 PRIMARY KEY (`id`)
1931 -) TYPE=MyISAM ; 1849 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1932 1850
1933 -- -------------------------------------------------------- 1851 -- --------------------------------------------------------
1934 1852
@@ -1937,53 +1855,53 @@ CREATE TABLE `zseq_permission_objects` ( @@ -1937,53 +1855,53 @@ CREATE TABLE `zseq_permission_objects` (
1937 -- 1855 --
1938 1856
1939 CREATE TABLE `zseq_permissions` ( 1857 CREATE TABLE `zseq_permissions` (
1940 - `id` int(10) unsigned NOT NULL auto_increment, 1858 + `id` int(10) unsigned NOT NULL,
1941 PRIMARY KEY (`id`) 1859 PRIMARY KEY (`id`)
1942 -) TYPE=MyISAM ; 1860 +) TYPE=MyISAM AUTO_INCREMENT=4 ;
1943 1861
1944 -- -------------------------------------------------------- 1862 -- --------------------------------------------------------
1945 1863
1946 -- 1864 --
1947 --- Table structure for table `zseq_role_allocations` 1865 +-- Table structure for table `zseq_plugins`
1948 -- 1866 --
1949 1867
1950 -CREATE TABLE `zseq_role_allocations` (  
1951 - `id` int(10) unsigned NOT NULL auto_increment, 1868 +CREATE TABLE `zseq_plugins` (
  1869 + `id` int(10) unsigned NOT NULL,
1952 PRIMARY KEY (`id`) 1870 PRIMARY KEY (`id`)
1953 -) TYPE=MyISAM ; 1871 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1954 1872
1955 -- -------------------------------------------------------- 1873 -- --------------------------------------------------------
1956 1874
1957 -- 1875 --
1958 --- Table structure for table `zseq_roles` 1876 +-- Table structure for table `zseq_role_allocations`
1959 -- 1877 --
1960 1878
1961 -CREATE TABLE `zseq_roles` (  
1962 - `id` int(10) unsigned NOT NULL auto_increment, 1879 +CREATE TABLE `zseq_role_allocations` (
  1880 + `id` int(10) unsigned NOT NULL,
1963 PRIMARY KEY (`id`) 1881 PRIMARY KEY (`id`)
1964 -) TYPE=MyISAM ; 1882 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1965 1883
1966 -- -------------------------------------------------------- 1884 -- --------------------------------------------------------
1967 1885
1968 -- 1886 --
1969 --- Table structure for table `zseq_saved_searches` 1887 +-- Table structure for table `zseq_roles`
1970 -- 1888 --
1971 1889
1972 -CREATE TABLE `zseq_saved_searches` (  
1973 - `id` int(10) unsigned NOT NULL auto_increment, 1890 +CREATE TABLE `zseq_roles` (
  1891 + `id` int(10) unsigned NOT NULL,
1974 PRIMARY KEY (`id`) 1892 PRIMARY KEY (`id`)
1975 -) TYPE=MyISAM ; 1893 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
1976 1894
1977 -- -------------------------------------------------------- 1895 -- --------------------------------------------------------
1978 1896
1979 -- 1897 --
1980 --- Table structure for table `zseq_search_document_user_link` 1898 +-- Table structure for table `zseq_saved_searches`
1981 -- 1899 --
1982 1900
1983 -CREATE TABLE `zseq_search_document_user_link` (  
1984 - `id` int(10) unsigned NOT NULL auto_increment, 1901 +CREATE TABLE `zseq_saved_searches` (
  1902 + `id` int(10) unsigned NOT NULL,
1985 PRIMARY KEY (`id`) 1903 PRIMARY KEY (`id`)
1986 -) TYPE=MyISAM ; 1904 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
1987 1905
1988 -- -------------------------------------------------------- 1906 -- --------------------------------------------------------
1989 1907
@@ -1992,9 +1910,9 @@ CREATE TABLE `zseq_search_document_user_link` ( @@ -1992,9 +1910,9 @@ CREATE TABLE `zseq_search_document_user_link` (
1992 -- 1910 --
1993 1911
1994 CREATE TABLE `zseq_status_lookup` ( 1912 CREATE TABLE `zseq_status_lookup` (
1995 - `id` int(10) unsigned NOT NULL auto_increment, 1913 + `id` int(10) unsigned NOT NULL,
1996 PRIMARY KEY (`id`) 1914 PRIMARY KEY (`id`)
1997 -) TYPE=MyISAM ; 1915 +) TYPE=MyISAM AUTO_INCREMENT=5 ;
1998 1916
1999 -- -------------------------------------------------------- 1917 -- --------------------------------------------------------
2000 1918
@@ -2003,9 +1921,9 @@ CREATE TABLE `zseq_status_lookup` ( @@ -2003,9 +1921,9 @@ CREATE TABLE `zseq_status_lookup` (
2003 -- 1921 --
2004 1922
2005 CREATE TABLE `zseq_system_settings` ( 1923 CREATE TABLE `zseq_system_settings` (
2006 - `id` int(10) unsigned NOT NULL auto_increment, 1924 + `id` int(10) unsigned NOT NULL,
2007 PRIMARY KEY (`id`) 1925 PRIMARY KEY (`id`)
2008 -) TYPE=MyISAM ; 1926 +) TYPE=MyISAM AUTO_INCREMENT=4 ;
2009 1927
2010 -- -------------------------------------------------------- 1928 -- --------------------------------------------------------
2011 1929
@@ -2014,9 +1932,9 @@ CREATE TABLE `zseq_system_settings` ( @@ -2014,9 +1932,9 @@ CREATE TABLE `zseq_system_settings` (
2014 -- 1932 --
2015 1933
2016 CREATE TABLE `zseq_time_period` ( 1934 CREATE TABLE `zseq_time_period` (
2017 - `id` int(10) unsigned NOT NULL auto_increment, 1935 + `id` int(10) unsigned NOT NULL,
2018 PRIMARY KEY (`id`) 1936 PRIMARY KEY (`id`)
2019 -) TYPE=MyISAM ; 1937 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
2020 1938
2021 -- -------------------------------------------------------- 1939 -- --------------------------------------------------------
2022 1940
@@ -2025,9 +1943,9 @@ CREATE TABLE `zseq_time_period` ( @@ -2025,9 +1943,9 @@ CREATE TABLE `zseq_time_period` (
2025 -- 1943 --
2026 1944
2027 CREATE TABLE `zseq_time_unit_lookup` ( 1945 CREATE TABLE `zseq_time_unit_lookup` (
2028 - `id` int(10) unsigned NOT NULL auto_increment, 1946 + `id` int(10) unsigned NOT NULL,
2029 PRIMARY KEY (`id`) 1947 PRIMARY KEY (`id`)
2030 -) TYPE=MyISAM ; 1948 +) TYPE=MyISAM AUTO_INCREMENT=4 ;
2031 1949
2032 -- -------------------------------------------------------- 1950 -- --------------------------------------------------------
2033 1951
@@ -2036,9 +1954,9 @@ CREATE TABLE `zseq_time_unit_lookup` ( @@ -2036,9 +1954,9 @@ CREATE TABLE `zseq_time_unit_lookup` (
2036 -- 1954 --
2037 1955
2038 CREATE TABLE `zseq_units_lookup` ( 1956 CREATE TABLE `zseq_units_lookup` (
2039 - `id` int(10) unsigned NOT NULL auto_increment, 1957 + `id` int(10) unsigned NOT NULL,
2040 PRIMARY KEY (`id`) 1958 PRIMARY KEY (`id`)
2041 -) TYPE=MyISAM ; 1959 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
2042 1960
2043 -- -------------------------------------------------------- 1961 -- --------------------------------------------------------
2044 1962
@@ -2047,9 +1965,9 @@ CREATE TABLE `zseq_units_lookup` ( @@ -2047,9 +1965,9 @@ CREATE TABLE `zseq_units_lookup` (
2047 -- 1965 --
2048 1966
2049 CREATE TABLE `zseq_units_organisations_link` ( 1967 CREATE TABLE `zseq_units_organisations_link` (
2050 - `id` int(10) unsigned NOT NULL auto_increment, 1968 + `id` int(10) unsigned NOT NULL,
2051 PRIMARY KEY (`id`) 1969 PRIMARY KEY (`id`)
2052 -) TYPE=MyISAM ; 1970 +) TYPE=MyISAM AUTO_INCREMENT=2 ;
2053 1971
2054 -- -------------------------------------------------------- 1972 -- --------------------------------------------------------
2055 1973
@@ -2058,9 +1976,9 @@ CREATE TABLE `zseq_units_organisations_link` ( @@ -2058,9 +1976,9 @@ CREATE TABLE `zseq_units_organisations_link` (
2058 -- 1976 --
2059 1977
2060 CREATE TABLE `zseq_upgrades` ( 1978 CREATE TABLE `zseq_upgrades` (
2061 - `id` int(10) unsigned NOT NULL auto_increment, 1979 + `id` int(10) unsigned NOT NULL,
2062 PRIMARY KEY (`id`) 1980 PRIMARY KEY (`id`)
2063 -) TYPE=MyISAM ; 1981 +) TYPE=MyISAM AUTO_INCREMENT=51 ;
2064 1982
2065 -- -------------------------------------------------------- 1983 -- --------------------------------------------------------
2066 1984
@@ -2069,9 +1987,9 @@ CREATE TABLE `zseq_upgrades` ( @@ -2069,9 +1987,9 @@ CREATE TABLE `zseq_upgrades` (
2069 -- 1987 --
2070 1988
2071 CREATE TABLE `zseq_users` ( 1989 CREATE TABLE `zseq_users` (
2072 - `id` int(10) unsigned NOT NULL auto_increment, 1990 + `id` int(10) unsigned NOT NULL,
2073 PRIMARY KEY (`id`) 1991 PRIMARY KEY (`id`)
2074 -) TYPE=MyISAM ; 1992 +) TYPE=MyISAM AUTO_INCREMENT=4 ;
2075 1993
2076 -- -------------------------------------------------------- 1994 -- --------------------------------------------------------
2077 1995
@@ -2080,42 +1998,9 @@ CREATE TABLE `zseq_users` ( @@ -2080,42 +1998,9 @@ CREATE TABLE `zseq_users` (
2080 -- 1998 --
2081 1999
2082 CREATE TABLE `zseq_users_groups_link` ( 2000 CREATE TABLE `zseq_users_groups_link` (
2083 - `id` int(10) unsigned NOT NULL auto_increment, 2001 + `id` int(10) unsigned NOT NULL,
2084 PRIMARY KEY (`id`) 2002 PRIMARY KEY (`id`)
2085 -) TYPE=MyISAM ;  
2086 -  
2087 --- --------------------------------------------------------  
2088 -  
2089 ---  
2090 --- Table structure for table `zseq_web_documents`  
2091 ---  
2092 -  
2093 -CREATE TABLE `zseq_web_documents` (  
2094 - `id` int(10) unsigned NOT NULL auto_increment,  
2095 - PRIMARY KEY (`id`)  
2096 -) TYPE=MyISAM ;  
2097 -  
2098 --- --------------------------------------------------------  
2099 -  
2100 ---  
2101 --- Table structure for table `zseq_web_documents_status_lookup`  
2102 ---  
2103 -  
2104 -CREATE TABLE `zseq_web_documents_status_lookup` (  
2105 - `id` int(10) unsigned NOT NULL auto_increment,  
2106 - PRIMARY KEY (`id`)  
2107 -) TYPE=MyISAM ;  
2108 -  
2109 --- --------------------------------------------------------  
2110 -  
2111 ---  
2112 --- Table structure for table `zseq_web_sites`  
2113 ---  
2114 -  
2115 -CREATE TABLE `zseq_web_sites` (  
2116 - `id` int(10) unsigned NOT NULL auto_increment,  
2117 - PRIMARY KEY (`id`)  
2118 -) TYPE=MyISAM ; 2003 +) TYPE=MyISAM AUTO_INCREMENT=4 ;
2119 2004
2120 -- -------------------------------------------------------- 2005 -- --------------------------------------------------------
2121 2006
@@ -2124,9 +2009,9 @@ CREATE TABLE `zseq_web_sites` ( @@ -2124,9 +2009,9 @@ CREATE TABLE `zseq_web_sites` (
2124 -- 2009 --
2125 2010
2126 CREATE TABLE `zseq_workflow_states` ( 2011 CREATE TABLE `zseq_workflow_states` (
2127 - `id` int(10) unsigned NOT NULL auto_increment, 2012 + `id` int(10) unsigned NOT NULL,
2128 PRIMARY KEY (`id`) 2013 PRIMARY KEY (`id`)
2129 -) TYPE=MyISAM ; 2014 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
2130 2015
2131 -- -------------------------------------------------------- 2016 -- --------------------------------------------------------
2132 2017
@@ -2135,9 +2020,9 @@ CREATE TABLE `zseq_workflow_states` ( @@ -2135,9 +2020,9 @@ CREATE TABLE `zseq_workflow_states` (
2135 -- 2020 --
2136 2021
2137 CREATE TABLE `zseq_workflow_transitions` ( 2022 CREATE TABLE `zseq_workflow_transitions` (
2138 - `id` int(10) unsigned NOT NULL auto_increment, 2023 + `id` int(10) unsigned NOT NULL,
2139 PRIMARY KEY (`id`) 2024 PRIMARY KEY (`id`)
2140 -) TYPE=MyISAM ; 2025 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
2141 2026
2142 -- -------------------------------------------------------- 2027 -- --------------------------------------------------------
2143 2028
@@ -2146,18 +2031,9 @@ CREATE TABLE `zseq_workflow_transitions` ( @@ -2146,18 +2031,9 @@ CREATE TABLE `zseq_workflow_transitions` (
2146 -- 2031 --
2147 2032
2148 CREATE TABLE `zseq_workflows` ( 2033 CREATE TABLE `zseq_workflows` (
2149 - `id` int(10) unsigned NOT NULL auto_increment,  
2150 - PRIMARY KEY (`id`)  
2151 -) TYPE=MyISAM ;  
2152 -  
2153 -  
2154 -CREATE TABLE `zseq_plugins` (  
2155 - `id` int(10) unsigned NOT NULL auto_increment, 2034 + `id` int(10) unsigned NOT NULL,
2156 PRIMARY KEY (`id`) 2035 PRIMARY KEY (`id`)
2157 -) ENGINE=MyISAM;  
2158 -  
2159 -  
2160 - 2036 +) TYPE=MyISAM AUTO_INCREMENT=1 ;
2161 2037
2162 -- 2038 --
2163 -- Constraints for dumped tables 2039 -- Constraints for dumped tables
@@ -2173,8 +2049,16 @@ ALTER TABLE `document_fields` @@ -2173,8 +2049,16 @@ ALTER TABLE `document_fields`
2173 -- Constraints for table `document_fields_link` 2049 -- Constraints for table `document_fields_link`
2174 -- 2050 --
2175 ALTER TABLE `document_fields_link` 2051 ALTER TABLE `document_fields_link`
2176 - ADD CONSTRAINT `document_fields_link_ibfk_2` FOREIGN KEY (`document_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE,  
2177 - ADD CONSTRAINT `document_fields_link_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE; 2052 + ADD CONSTRAINT `document_fields_link_ibfk_2` FOREIGN KEY (`document_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE;
  2053 +
  2054 +--
  2055 +-- Constraints for table `document_metadata_version`
  2056 +--
  2057 +ALTER TABLE `document_metadata_version`
  2058 + ADD CONSTRAINT `document_metadata_version_ibfk_4` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE,
  2059 + ADD CONSTRAINT `document_metadata_version_ibfk_5` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`),
  2060 + ADD CONSTRAINT `document_metadata_version_ibfk_6` FOREIGN KEY (`status_id`) REFERENCES `status_lookup` (`id`),
  2061 + ADD CONSTRAINT `document_metadata_version_ibfk_7` FOREIGN KEY (`version_creator_id`) REFERENCES `users` (`id`);
2178 2062
2179 -- 2063 --
2180 -- Constraints for table `document_type_fieldsets_link` 2064 -- Constraints for table `document_type_fieldsets_link`
sql/mysql/upgrade/2.99.2/1-constraints.sql
  1 +SET FOREIGN_KEY_CHECKS=0;
1 ALTER TABLE `document_type_fieldsets_link` ADD INDEX `document_type_id` (`document_type_id`); 2 ALTER TABLE `document_type_fieldsets_link` ADD INDEX `document_type_id` (`document_type_id`);
2 ALTER TABLE `document_type_fieldsets_link` ADD INDEX `fieldset_id` (`fieldset_id`); 3 ALTER TABLE `document_type_fieldsets_link` ADD INDEX `fieldset_id` (`fieldset_id`);
3 ALTER TABLE `document_type_fieldsets_link` ADD CONSTRAINT `document_type_fieldsets_link_ibfk_1` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`) ON DELETE CASCADE; 4 ALTER TABLE `document_type_fieldsets_link` ADD CONSTRAINT `document_type_fieldsets_link_ibfk_1` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`) ON DELETE CASCADE;
@@ -35,3 +36,4 @@ ALTER TABLE `workflow_transitions` ADD CONSTRAINT `workflow_transitions_ibfk_46` @@ -35,3 +36,4 @@ ALTER TABLE `workflow_transitions` ADD CONSTRAINT `workflow_transitions_ibfk_46`
35 ALTER TABLE `workflow_transitions` ADD CONSTRAINT `workflow_transitions_ibfk_47` FOREIGN KEY (`guard_permission_id`) REFERENCES `permissions` (`id`) ON DELETE SET NULL; 36 ALTER TABLE `workflow_transitions` ADD CONSTRAINT `workflow_transitions_ibfk_47` FOREIGN KEY (`guard_permission_id`) REFERENCES `permissions` (`id`) ON DELETE SET NULL;
36 ALTER TABLE `workflow_transitions` ADD CONSTRAINT `workflow_transitions_ibfk_49` FOREIGN KEY (`guard_role_id`) REFERENCES `roles` (`id`) ON DELETE SET NULL; 37 ALTER TABLE `workflow_transitions` ADD CONSTRAINT `workflow_transitions_ibfk_49` FOREIGN KEY (`guard_role_id`) REFERENCES `roles` (`id`) ON DELETE SET NULL;
37 ALTER TABLE `workflow_transitions` ADD CONSTRAINT `workflow_transitions_ibfk_45` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`) ON DELETE CASCADE; 38 ALTER TABLE `workflow_transitions` ADD CONSTRAINT `workflow_transitions_ibfk_45` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`) ON DELETE CASCADE;
  39 +SET FOREIGN_KEY_CHECKS=1;
sql/mysql/upgrade/2.99.2/permission_by_user_and_roles.sql
  1 +SET FOREIGN_KEY_CHECKS=0;
1 CREATE TABLE `permission_descriptor_roles` ( 2 CREATE TABLE `permission_descriptor_roles` (
2 `descriptor_id` int(11) NOT NULL default '0', 3 `descriptor_id` int(11) NOT NULL default '0',
3 `role_id` int(11) NOT NULL default '0', 4 `role_id` int(11) NOT NULL default '0',
@@ -15,3 +16,4 @@ CREATE TABLE `permission_descriptor_users` ( @@ -15,3 +16,4 @@ CREATE TABLE `permission_descriptor_users` (
15 KEY `user_id` (`user_id`), 16 KEY `user_id` (`user_id`),
16 CONSTRAINT `permission_descriptor_users_ibfk_1` FOREIGN KEY (`descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE, CONSTRAINT `permission_descriptor_users_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE 17 CONSTRAINT `permission_descriptor_users_ibfk_1` FOREIGN KEY (`descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE, CONSTRAINT `permission_descriptor_users_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
17 ) TYPE=InnoDB; 18 ) TYPE=InnoDB;
  19 +SET FOREIGN_KEY_CHECKS=1;
sql/mysql/upgrade/2.99.6/table_cleanup.sql
1 -- Drop unused tables 1 -- Drop unused tables
  2 +DROP TABLE IF EXISTS `browse_criteria`;
  3 +DROP TABLE IF EXISTS `dependant_document_instance`;
  4 +DROP TABLE IF EXISTS `dependant_document_template`;
  5 +DROP TABLE IF EXISTS `groups_folders_approval_link`;
  6 +DROP TABLE IF EXISTS `groups_folders_link`;
2 DROP TABLE IF EXISTS `metadata_lookup_condition`; 7 DROP TABLE IF EXISTS `metadata_lookup_condition`;
3 DROP TABLE IF EXISTS `metadata_lookup_condition_chain`; 8 DROP TABLE IF EXISTS `metadata_lookup_condition_chain`;
4 DROP TABLE IF EXISTS `zseq_metadata_lookup_condition`; 9 DROP TABLE IF EXISTS `zseq_metadata_lookup_condition`;
5 DROP TABLE IF EXISTS `zseq_metadata_lookup_condition_chain`; 10 DROP TABLE IF EXISTS `zseq_metadata_lookup_condition_chain`;
  11 +DROP TABLE IF EXISTS `zseq_search_document_user_link`;
  12 +DROP TABLE IF EXISTS `zseq_web_documents`;
  13 +DROP TABLE IF EXISTS `zseq_web_documents_status_lookup`;
  14 +DROP TABLE IF EXISTS `zseq_web_sites`;
6 15
7 -- Make sure sequence tables are MyISAM to avoid transaction-safety. 16 -- Make sure sequence tables are MyISAM to avoid transaction-safety.
8 ALTER TABLE `zseq_active_sessions` ENGINE=MyISAM; 17 ALTER TABLE `zseq_active_sessions` ENGINE=MyISAM;
@@ -49,7 +58,6 @@ ALTER TABLE `zseq_permission_lookups` ENGINE=MyISAM; @@ -49,7 +58,6 @@ ALTER TABLE `zseq_permission_lookups` ENGINE=MyISAM;
49 ALTER TABLE `zseq_permission_objects` ENGINE=MyISAM; 58 ALTER TABLE `zseq_permission_objects` ENGINE=MyISAM;
50 ALTER TABLE `zseq_permissions` ENGINE=MyISAM; 59 ALTER TABLE `zseq_permissions` ENGINE=MyISAM;
51 ALTER TABLE `zseq_roles` ENGINE=MyISAM; 60 ALTER TABLE `zseq_roles` ENGINE=MyISAM;
52 -ALTER TABLE `zseq_search_document_user_link` ENGINE=MyISAM;  
53 ALTER TABLE `zseq_status_lookup` ENGINE=MyISAM; 61 ALTER TABLE `zseq_status_lookup` ENGINE=MyISAM;
54 ALTER TABLE `zseq_system_settings` ENGINE=MyISAM; 62 ALTER TABLE `zseq_system_settings` ENGINE=MyISAM;
55 ALTER TABLE `zseq_time_period` ENGINE=MyISAM; 63 ALTER TABLE `zseq_time_period` ENGINE=MyISAM;
@@ -59,6 +67,46 @@ ALTER TABLE `zseq_units_organisations_link` ENGINE=MyISAM; @@ -59,6 +67,46 @@ ALTER TABLE `zseq_units_organisations_link` ENGINE=MyISAM;
59 ALTER TABLE `zseq_upgrades` ENGINE=MyISAM; 67 ALTER TABLE `zseq_upgrades` ENGINE=MyISAM;
60 ALTER TABLE `zseq_users` ENGINE=MyISAM; 68 ALTER TABLE `zseq_users` ENGINE=MyISAM;
61 ALTER TABLE `zseq_users_groups_link` ENGINE=MyISAM; 69 ALTER TABLE `zseq_users_groups_link` ENGINE=MyISAM;
62 -ALTER TABLE `zseq_web_documents` ENGINE=MyISAM;  
63 -ALTER TABLE `zseq_web_documents_status_lookup` ENGINE=MyISAM;  
64 -ALTER TABLE `zseq_web_sites` ENGINE=MyISAM; 70 +
  71 +ALTER TABLE `active_sessions` TYPE=InnoDB;
  72 +ALTER TABLE `archive_restoration_request` TYPE=InnoDB;
  73 +ALTER TABLE `archiving_settings` TYPE=InnoDB;
  74 +ALTER TABLE `archiving_type_lookup` TYPE=InnoDB;
  75 +ALTER TABLE `data_types` TYPE=InnoDB;
  76 +ALTER TABLE `discussion_comments` TYPE=InnoDB;
  77 +ALTER TABLE `discussion_threads` TYPE=InnoDB;
  78 +ALTER TABLE `document_archiving_link` TYPE=InnoDB;
  79 +ALTER TABLE `document_fields` TYPE=InnoDB;
  80 +ALTER TABLE `document_fields_link` TYPE=InnoDB;
  81 +ALTER TABLE `document_link` TYPE=InnoDB;
  82 +ALTER TABLE `document_subscriptions` TYPE=InnoDB;
  83 +ALTER TABLE `document_transaction_types_lookup` TYPE=InnoDB;
  84 +ALTER TABLE `document_transactions` TYPE=InnoDB;
  85 +ALTER TABLE `document_type_fields_link` TYPE=InnoDB;
  86 +ALTER TABLE `document_types_lookup` TYPE=InnoDB;
  87 +ALTER TABLE `documents` TYPE=InnoDB;
  88 +ALTER TABLE `folder_doctypes_link` TYPE=InnoDB;
  89 +ALTER TABLE `folder_subscriptions` TYPE=InnoDB;
  90 +ALTER TABLE `folders` TYPE=InnoDB;
  91 +ALTER TABLE `folders_users_roles_link` TYPE=InnoDB;
  92 +ALTER TABLE `groups_lookup` TYPE=InnoDB;
  93 +ALTER TABLE `groups_units_link` TYPE=InnoDB;
  94 +ALTER TABLE `help` TYPE=InnoDB;
  95 +ALTER TABLE `links` TYPE=InnoDB;
  96 +ALTER TABLE `metadata_lookup` TYPE=InnoDB;
  97 +ALTER TABLE `mime_types` TYPE=InnoDB;
  98 +ALTER TABLE `news` TYPE=InnoDB;
  99 +ALTER TABLE `organisations_lookup` TYPE=InnoDB;
  100 +ALTER TABLE `roles` TYPE=InnoDB;
  101 +ALTER TABLE `status_lookup` TYPE=InnoDB;
  102 +ALTER TABLE `system_settings` TYPE=InnoDB;
  103 +ALTER TABLE `time_period` TYPE=InnoDB;
  104 +ALTER TABLE `time_unit_lookup` TYPE=InnoDB;
  105 +ALTER TABLE `units_lookup` TYPE=InnoDB;
  106 +ALTER TABLE `units_organisations_link` TYPE=InnoDB;
  107 +ALTER TABLE `users` TYPE=InnoDB;
  108 +ALTER TABLE `users_groups_link` TYPE=InnoDB;
  109 +ALTER TABLE `web_documents` TYPE=InnoDB;
  110 +ALTER TABLE `web_documents_status_lookup` TYPE=InnoDB;
  111 +ALTER TABLE `web_sites` TYPE=InnoDB;
  112 +
sql/mysql/upgrade/2.99.7/10-documents_normalisation.sql
  1 +
  2 +
1 ALTER TABLE `documents` DROP COLUMN `document_type_id`; # was int(11) NOT NULL default '0' 3 ALTER TABLE `documents` DROP COLUMN `document_type_id`; # was int(11) NOT NULL default '0'
2 ALTER TABLE `documents` DROP COLUMN `size`; # was bigint(20) NOT NULL default '0' 4 ALTER TABLE `documents` DROP COLUMN `size`; # was bigint(20) NOT NULL default '0'
3 ALTER TABLE `documents` DROP COLUMN `description`; # was varchar(200) NOT NULL default '' 5 ALTER TABLE `documents` DROP COLUMN `description`; # was varchar(200) NOT NULL default ''
@@ -9,6 +11,3 @@ ALTER TABLE `documents` DROP COLUMN `filename`; # was text NOT NULL @@ -9,6 +11,3 @@ ALTER TABLE `documents` DROP COLUMN `filename`; # was text NOT NULL
9 ALTER TABLE `documents` DROP COLUMN `storage_path`; # was varchar(250) default NULL 11 ALTER TABLE `documents` DROP COLUMN `storage_path`; # was varchar(250) default NULL
10 ALTER TABLE `documents` DROP COLUMN `mime_id`; # was int(11) NOT NULL default '0' 12 ALTER TABLE `documents` DROP COLUMN `mime_id`; # was int(11) NOT NULL default '0'
11 ALTER TABLE `documents` DROP COLUMN `name`; # was text NOT NULL 13 ALTER TABLE `documents` DROP COLUMN `name`; # was text NOT NULL
12 -ALTER TABLE `documents` DROP INDEX `fk_document_type_id`; # was INDEX (`document_type_id`)  
13 -ALTER TABLE `documents` DROP INDEX `live_document_id`; # was INDEX (`live_document_id`)  
14 -ALTER TABLE `documents` DROP INDEX `storage_path`; # was INDEX (`storage_path`)  
sql/mysql/upgrade/2.99.7/20-fields.sql 0 โ†’ 100644
  1 +SET FOREIGN_KEY_CHECKS=0;
  2 +ALTER TABLE `document_fields_link` DROP FOREIGN KEY `document_fields_link_ibfk_1`;
  3 +ALTER TABLE document_fields_link DROP COLUMN document_id;
  4 +SET FOREIGN_KEY_CHECKS=1;
sql/mysql/upgrade/2.99.7/documents_normalisation.sql
  1 +SET FOREIGN_KEY_CHECKS=0;
  2 +ALTER TABLE `document_fields_link` ADD COLUMN `metadata_version_id` int(11) default NULL;
  3 +ALTER TABLE `document_fields_link` ADD INDEX `metadata_version_id` (`metadata_version_id`);
  4 +
1 CREATE TABLE `document_content_version` ( 5 CREATE TABLE `document_content_version` (
2 `id` int(11) NOT NULL default '0', 6 `id` int(11) NOT NULL default '0',
3 `document_id` int(11) NOT NULL default '0', 7 `document_id` int(11) NOT NULL default '0',
@@ -10,7 +14,7 @@ CREATE TABLE `document_content_version` ( @@ -10,7 +14,7 @@ CREATE TABLE `document_content_version` (
10 UNIQUE KEY `id` (`id`), 14 UNIQUE KEY `id` (`id`),
11 KEY `storage_path` (`storage_path`), 15 KEY `storage_path` (`storage_path`),
12 KEY `document_id` (`document_id`) 16 KEY `document_id` (`document_id`)
13 -) ENGINE=InnoDB DEFAULT CHARSET=latin1; 17 +) ENGINE=InnoDB;
14 18
15 CREATE TABLE `document_metadata_version` ( 19 CREATE TABLE `document_metadata_version` (
16 `id` int(11) NOT NULL default '0', 20 `id` int(11) NOT NULL default '0',
@@ -34,4 +38,18 @@ CREATE TABLE `document_metadata_version` ( @@ -34,4 +38,18 @@ CREATE TABLE `document_metadata_version` (
34 CONSTRAINT `document_metadata_version_ibfk_5` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`), 38 CONSTRAINT `document_metadata_version_ibfk_5` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`),
35 CONSTRAINT `document_metadata_version_ibfk_6` FOREIGN KEY (`status_id`) REFERENCES `status_lookup` (`id`), 39 CONSTRAINT `document_metadata_version_ibfk_6` FOREIGN KEY (`status_id`) REFERENCES `status_lookup` (`id`),
36 CONSTRAINT `document_metadata_version_ibfk_7` FOREIGN KEY (`version_creator_id`) REFERENCES `users` (`id`) 40 CONSTRAINT `document_metadata_version_ibfk_7` FOREIGN KEY (`version_creator_id`) REFERENCES `users` (`id`)
37 -) ENGINE=InnoDB DEFAULT CHARSET=latin1; 41 +) ENGINE=InnoDB;
  42 +
  43 +ALTER TABLE `documents` ADD metadata_version_id int(11) default NULL;
  44 +ALTER TABLE `documents` ADD INDEX `metadata_version_id` (`metadata_version_id`);
  45 +
  46 +CREATE TABLE `zseq_document_content_version` (
  47 + `id` int(10) unsigned NOT NULL auto_increment,
  48 + PRIMARY KEY (`id`)
  49 +) ENGINE=MyISAM;
  50 +
  51 +CREATE TABLE `zseq_document_metadata_version` (
  52 + `id` int(10) unsigned NOT NULL auto_increment,
  53 + PRIMARY KEY (`id`)
  54 +) ENGINE=MyISAM;
  55 +SET FOREIGN_KEY_CHECKS=1;
sql/mysql/upgrade/2.99.7/table_cleanup.sql 0 โ†’ 100644
  1 +SET FOREIGN_KEY_CHECKS=0;
  2 +ALTER TABLE `active_sessions` CHANGE COLUMN `session_id` `session_id` char(255) default NULL; # was varchar(255) default NULL
  3 +ALTER TABLE `active_sessions` CHANGE COLUMN `ip` `ip` char(30) default NULL; # was varchar(30) default NULL
  4 +ALTER TABLE `archiving_type_lookup` CHANGE COLUMN `name` `name` char(100) default NULL; # was varchar(100) default NULL
  5 +ALTER TABLE `data_types` CHANGE COLUMN `name` `name` char(255) NOT NULL default ''; # was varchar(255) default NULL
  6 +ALTER TABLE `document_fields` CHANGE COLUMN `data_type` `data_type` varchar(100) NOT NULL default ''; # was varchar(100) default NULL
  7 +ALTER TABLE `document_fields` CHANGE COLUMN `name` `name` varchar(255) NOT NULL default ''; # was varchar(255) default NULL
  8 +ALTER TABLE `document_fields_link` CHANGE COLUMN `value` `value` char(255) NOT NULL default ''; # was varchar(255) default NULL
  9 +ALTER TABLE `document_transactions` CHANGE COLUMN `ip` `ip` char(30) default NULL; # was varchar(30) default NULL
  10 +ALTER TABLE `document_transactions` CHANGE COLUMN `transaction_namespace` `transaction_namespace` char(255) NOT NULL default 'ktcore.transactions.event'; # was varchar(255) NOT NULL default 'ktcore.transactions.event'
  11 +ALTER TABLE `document_transactions` CHANGE COLUMN `comment` `comment` char(255) NOT NULL default ''; # was varchar(255) default NULL
  12 +ALTER TABLE `document_transactions` CHANGE COLUMN `filename` `filename` char(255) NOT NULL default ''; # was varchar(255) default NULL
  13 +ALTER TABLE `document_transactions` CHANGE COLUMN `version` `version` char(50) default NULL; # was varchar(50) default NULL
  14 +ALTER TABLE `document_types_lookup` CHANGE COLUMN `name` `name` char(100) default NULL; # was varchar(100) default NULL
  15 +ALTER TABLE `groups_lookup` CHANGE COLUMN `name` `name` char(100) NOT NULL default ''; # was varchar(100) default NULL
  16 +ALTER TABLE `help_replacement` DROP COLUMN `title`; # was varchar(255) NOT NULL default ''
  17 +ALTER TABLE `help_replacement` CHANGE COLUMN `name` `name` varchar(100) NOT NULL default ''; # was varchar(255) NOT NULL default ''
  18 +DROP TABLE IF EXISTS `language_lookup`;
  19 +ALTER TABLE `links` CHANGE COLUMN `url` `url` char(100) NOT NULL default ''; # was varchar(100) default NULL
  20 +ALTER TABLE `links` CHANGE COLUMN `name` `name` char(100) NOT NULL default ''; # was varchar(100) default NULL
  21 +ALTER TABLE `metadata_lookup` CHANGE COLUMN `name` `name` char(255) default NULL; # was varchar(255) default NULL
  22 +ALTER TABLE `mime_types` CHANGE COLUMN `filetypes` `filetypes` char(100) NOT NULL default ''; # was varchar(100) default NULL
  23 +ALTER TABLE `mime_types` CHANGE COLUMN `mimetypes` `mimetypes` char(100) NOT NULL default ''; # was varchar(100) default NULL
  24 +ALTER TABLE `mime_types` CHANGE COLUMN `icon_path` `icon_path` char(255) default NULL; # was varchar(255) default NULL
  25 +ALTER TABLE `notifications` CHANGE COLUMN `data_str_1` `data_str_1` varchar(255) default NULL; # was varchar(255) NOT NULL default ''
  26 +ALTER TABLE `notifications` CHANGE COLUMN `data_int_2` `data_int_2` int(11) default NULL; # was int(11) NOT NULL default '0'
  27 +ALTER TABLE `notifications` CHANGE COLUMN `data_int_1` `data_int_1` int(11) default NULL; # was int(11) NOT NULL default '0'
  28 +ALTER TABLE `notifications` CHANGE COLUMN `data_str_2` `data_str_2` varchar(255) default NULL; # was varchar(255) NOT NULL default ''
  29 +ALTER TABLE `organisations_lookup` CHANGE COLUMN `name` `name` char(100) NOT NULL default ''; # was varchar(100) default NULL
  30 +ALTER TABLE `roles` CHANGE COLUMN `name` `name` char(255) NOT NULL default ''; # was varchar(255) default NULL
  31 +ALTER TABLE `status_lookup` CHANGE COLUMN `name` `name` char(255) default NULL; # was varchar(255) default NULL
  32 +ALTER TABLE `system_settings` CHANGE COLUMN `value` `value` char(255) NOT NULL default ''; # was varchar(255) default NULL
  33 +ALTER TABLE `system_settings` CHANGE COLUMN `name` `name` char(255) NOT NULL default ''; # was varchar(255) default NULL
  34 +ALTER TABLE `time_unit_lookup` CHANGE COLUMN `name` `name` char(100) default NULL; # was varchar(100) default NULL
  35 +ALTER TABLE `units_lookup` CHANGE COLUMN `name` `name` char(100) NOT NULL default ''; # was varchar(100) default NULL
  36 +ALTER TABLE `users` CHANGE COLUMN `password` `password` varchar(255) NOT NULL default ''; # was varchar(255) default NULL
  37 +ALTER TABLE `users` CHANGE COLUMN `username` `username` varchar(255) NOT NULL default ''; # was varchar(255) default NULL
  38 +ALTER TABLE `users` CHANGE COLUMN `name` `name` varchar(255) NOT NULL default ''; # was varchar(255) default NULL
  39 +DROP TABLE IF EXISTS `zseq_groups_folders_approval_link`;
  40 +DROP TABLE IF EXISTS `zseq_groups_folders_link`;
  41 +DROP TABLE IF EXISTS `web_documents`;
  42 +DROP TABLE IF EXISTS `web_documents_status_lookup`;
  43 +DROP TABLE IF EXISTS `web_sites`;
  44 +SET FOREIGN_KEY_CHECKS=1;
tests/document/add.php
@@ -13,7 +13,6 @@ $sLocalname = KT_DIR . &quot;/tests/document/dataset1/critique-of-pure-reason.txt&quot;; @@ -13,7 +13,6 @@ $sLocalname = KT_DIR . &quot;/tests/document/dataset1/critique-of-pure-reason.txt&quot;;
13 $sFilename = tempnam("/tmp", "kt_tests_document_add"); 13 $sFilename = tempnam("/tmp", "kt_tests_document_add");
14 copy($sLocalname, $sFilename); 14 copy($sLocalname, $sFilename);
15 15
16 -/*  
17 $oDocument =& KTDocumentUtil::add($oFolder, "testquickupload.txt", $oUser, array( 16 $oDocument =& KTDocumentUtil::add($oFolder, "testquickupload.txt", $oUser, array(
18 'contents' => new KTFSFileLike($sFilename), 17 'contents' => new KTFSFileLike($sFilename),
19 )); 18 ));
@@ -23,7 +22,6 @@ if (PEAR::isError($oDocument)) { @@ -23,7 +22,6 @@ if (PEAR::isError($oDocument)) {
23 var_dump($oDocument); 22 var_dump($oDocument);
24 exit(0); 23 exit(0);
25 } 24 }
26 -*/  
27 25
28 if (!file_exists($sFilename)) { 26 if (!file_exists($sFilename)) {
29 copy($sLocalname, $sFilename); 27 copy($sLocalname, $sFilename);
@@ -35,11 +33,10 @@ if (PEAR::isError($oDocument)) { @@ -35,11 +33,10 @@ if (PEAR::isError($oDocument)) {
35 var_dump($oDocument); 33 var_dump($oDocument);
36 } 34 }
37 35
38 -/*  
39 -  
40 $res = KTDocumentUtil::storeContents($oDocument, new KTFSFileLike($sFilename)); 36 $res = KTDocumentUtil::storeContents($oDocument, new KTFSFileLike($sFilename));
41 var_dump($res); 37 var_dump($res);
42 38
  39 +/*
43 if (file_exists($sFilename)) { 40 if (file_exists($sFilename)) {
44 unlink($sFilename); 41 unlink($sFilename);
45 } 42 }
tests/permissions/updatePermissionLookup.php
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 require_once("../../config/dmsDefaults.php"); 3 require_once("../../config/dmsDefaults.php");
4 require_once(KT_LIB_DIR . '/foldermanagement/Folder.inc'); 4 require_once(KT_LIB_DIR . '/foldermanagement/Folder.inc');
  5 +require_once(KT_LIB_DIR . '/documentmanagement/Document.inc');
5 require_once(KT_LIB_DIR . '/permissions/permissionutil.inc.php'); 6 require_once(KT_LIB_DIR . '/permissions/permissionutil.inc.php');
6 7
7 error_reporting(E_ALL); 8 error_reporting(E_ALL);
@@ -16,7 +17,7 @@ foreach ($aDocuments as $oDocument) { @@ -16,7 +17,7 @@ foreach ($aDocuments as $oDocument) {
16 KTPermissionUtil::updatePermissionLookup($oDocument); 17 KTPermissionUtil::updatePermissionLookup($oDocument);
17 } 18 }
18 */ 19 */
19 -$oFolder = Folder::get(18);  
20 -KTPermissionUtil::updatePermissionLookup($oFolder); 20 +$oDocument = Document::get(447);
  21 +KTPermissionUtil::updatePermissionLookup($oDocument);
21 22
22 ?> 23 ?>
view.php
@@ -89,7 +89,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher { @@ -89,7 +89,7 @@ class ViewDocumentDispatcher extends KTStandardDispatcher {
89 } 89 }
90 90
91 // we want to grab all the md for this doc, since its faster that way. 91 // we want to grab all the md for this doc, since its faster that way.
92 - $mdlist =& DocumentFieldLink::getList(array('document_id = ?', array($document_id))); 92 + $mdlist =& DocumentFieldLink::getByDocument($oDocument);
93 93
94 $field_values = array(); 94 $field_values = array();
95 foreach ($mdlist as $oFieldLink) { 95 foreach ($mdlist as $oFieldLink) {