Commit 8c280307a6c2825cfff152a91c0b9caaef0a6373

Authored by kevin_fourie
1 parent 08cb82b0

Merged in from DEV trunk...

KTS-2601
"Create indexer administration page"
Updated. Added a status column to the index_files table so that reporting can be done more easily.

Committed By: Conrad Vermeulen
Reviewed By: Jonathan Burne

KTS-2601
"Create indexer administration page"
Implemented. Added all search & indexing administration/reporting pages.

Committed By: Jonathan Byrne
Reviewed By: Conrad Vermeulen

KTS-2634
"When changing the view of the 'Browse documents' tab the option 'Checked out by' is needed in the options list of columns to add to the view"
Fixed. Added a new column.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen

KTS-2601
"Create indexer administration page"
Updated. Added better text descriptions for admin section and implemented status_msg update mechanism.

Committed By: Conrad Vermeulen
Reviewed By: Jonathan Byrne

WSA-100
"When adding a document with metadata, failure to update metadata returns an error, but the document is in the repositor"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Jonathan Byrne

WSA-102
"Mechanics of adding a document to repository is not the same from 3.4.4 to 3.4.5+. This means that the web service base code results in empty documents being added in 3.4.4 if the newer ktapi code is backported."
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Jonathan Byrne

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@7947 c91229c3-7414-0410-bfa2-8a42b809f60b
ktapi/KTAPIDocument.inc.php
@@ -1071,7 +1071,7 @@ class KTAPI_Document extends KTAPI_FolderItem @@ -1071,7 +1071,7 @@ class KTAPI_Document extends KTAPI_FolderItem
1071 $packed = $this->get_packed_metadata($metadata); 1071 $packed = $this->get_packed_metadata($metadata);
1072 1072
1073 DBUtil::startTransaction(); 1073 DBUtil::startTransaction();
1074 - $result = KTDocumentUtil::saveMetadata($this->document, $packed); 1074 + $result = KTDocumentUtil::saveMetadata($this->document, $packed, array('novalidate'=>true));
1075 1075
1076 if (is_null($result)) 1076 if (is_null($result))
1077 { 1077 {
ktapi/KTAPIFolder.inc.php
@@ -610,7 +610,7 @@ class KTAPI_Folder extends KTAPI_FolderItem @@ -610,7 +610,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
610 610
611 611
612 $options = array( 612 $options = array(
613 - //'contents' => new KTFSFileLike($tempfilename), 613 + 'contents' => new KTFSFileLike($tempfilename),
614 'temp_file' => $tempfilename, 614 'temp_file' => $tempfilename,
615 'novalidate' => true, 615 'novalidate' => true,
616 'documenttype' => DocumentType::get($documenttypeid), 616 'documenttype' => DocumentType::get($documenttypeid),
@@ -622,7 +622,7 @@ class KTAPI_Folder extends KTAPI_FolderItem @@ -622,7 +622,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
622 DBUtil::startTransaction(); 622 DBUtil::startTransaction();
623 $document =& KTDocumentUtil::add($this->folder, $filename, $user, $options); 623 $document =& KTDocumentUtil::add($this->folder, $filename, $user, $options);
624 624
625 - if (!is_a($document,'Document')) 625 + if (PEAR::isError($document))
626 { 626 {
627 DBUtil::rollback(); 627 DBUtil::rollback();
628 return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR . ' : ' . $document->getMessage()); 628 return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR . ' : ' . $document->getMessage());
ktwebservice/webservice.php
@@ -1978,6 +1978,7 @@ class KTWebService @@ -1978,6 +1978,7 @@ class KTWebService
1978 $status_code = $update_result->value['status_code']; 1978 $status_code = $update_result->value['status_code'];
1979 if ($status_code != 0) 1979 if ($status_code != 0)
1980 { 1980 {
  1981 + $this->delete_document($session_id, $document_id, 'Rollback because metadata could not be added');
1981 return $update_result; 1982 return $update_result;
1982 } 1983 }
1983 1984
@@ -2017,6 +2018,7 @@ class KTWebService @@ -2017,6 +2018,7 @@ class KTWebService
2017 $status_code = $update_result->value['status_code']; 2018 $status_code = $update_result->value['status_code'];
2018 if ($status_code != 0) 2019 if ($status_code != 0)
2019 { 2020 {
  2021 + $this->delete_document($session_id, $document_id, 'Rollback because metadata could not be added');
2020 return $update_result; 2022 return $update_result;
2021 } 2023 }
2022 2024
lib/mime.inc.php
@@ -207,6 +207,44 @@ class KTMime { @@ -207,6 +207,44 @@ class KTMime {
207 function stripAllButExtension($sFileName) { 207 function stripAllButExtension($sFileName) {
208 return strtolower(substr($sFileName, strrpos($sFileName, ".")+1, strlen($sFileName) - strrpos($sFileName, "."))); 208 return strtolower(substr($sFileName, strrpos($sFileName, ".")+1, strlen($sFileName) - strrpos($sFileName, ".")));
209 } 209 }
  210 +
  211 + /**
  212 + * getAllMimeTypesInformation is a staic function used to get a fuller set of
  213 + * information on the mime types held in the database.
  214 + *
  215 + */
  216 + function getAllMimeTypesInformation()
  217 + {
  218 + $sTable = KTUtil::getTableName('mimetypes');
  219 + $aQuery = array('SELECT MT.id, MT.filetypes, MT.mimetypes, MT.icon_path, MT.friendly_name, ME.name as extractor FROM '
  220 + . $sTable .' MT LEFT JOIN mime_extractors ME ON(MT.extractor_id = ME.id) ORDER BY MT.filetypes', array());
  221 + $res = DBUtil::getResultArray($aQuery);
  222 + return $res;
  223 + }
  224 +
  225 + /**
  226 + * get all information on all the extractors in the database
  227 + *
  228 + */
  229 + function getMimeExtractorInformation()
  230 + {
  231 + $aQuery = array('SELECT id, name, active FROM mime_extractors ORDER BY name', array());
  232 + $res = DBUtil::getResultArray($aQuery);
  233 + return $res;
  234 + }
  235 +
  236 + /**
  237 + *give the mimetype name and get the friendly names and the extensions
  238 + *
  239 + */
  240 + function getFriendlyNameAndExtension($sMimeType)
  241 + {
  242 + $sTable = KTUtil::getTableName('mimetypes');
  243 + $sQuery = "SELECT friendly_name, filetypes FROM " . $sTable . " WHERE mimetypes = ?";
  244 + $aQuery = array($sQuery, array($sMimeType));
  245 + $res = DBUtil::getResultArray($aQuery);
  246 + return $res;
  247 + }
210 } 248 }
211 249
212 $_KT_icon_path_cache = array(); 250 $_KT_icon_path_cache = array();
plugins/ktcore/KTColumns.inc.php
@@ -5,32 +5,32 @@ @@ -5,32 +5,32 @@
5 * KnowledgeTree Open Source Edition 5 * KnowledgeTree Open Source Edition
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited 7 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
8 - * 8 + *
9 * This program is free software; you can redistribute it and/or modify it under 9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 3 as published by the 10 * the terms of the GNU General Public License version 3 as published by the
11 * Free Software Foundation. 11 * Free Software Foundation.
12 - * 12 + *
13 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * details. 16 * details.
17 - * 17 + *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 - * 20 + *
21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23 - * 23 + *
24 * The interactive user interfaces in modified source and object code versions 24 * The interactive user interfaces in modified source and object code versions
25 * of this program must display Appropriate Legal Notices, as required under 25 * of this program must display Appropriate Legal Notices, as required under
26 * Section 5 of the GNU General Public License version 3. 26 * Section 5 of the GNU General Public License version 3.
27 - * 27 + *
28 * In accordance with Section 7(b) of the GNU General Public License version 3, 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 * these Appropriate Legal Notices must retain the display of the "Powered by 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32 - * must display the words "Powered by KnowledgeTree" and retain the original  
33 - * copyright notice. 32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 * Contributor( s): ______________________________________ 34 * Contributor( s): ______________________________________
35 */ 35 */
36 36
@@ -418,6 +418,36 @@ class AdvancedWorkflowColumn extends AdvancedColumn { @@ -418,6 +418,36 @@ class AdvancedWorkflowColumn extends AdvancedColumn {
418 } 418 }
419 } 419 }
420 420
  421 +class CheckedOutByColumn extends AdvancedColumn {
  422 + var $namespace = 'ktcore.columns.checkedout_by';
  423 + var $sortable = false;
  424 +
  425 + function CheckedOutByColumn() {
  426 + $this->label = _kt('Checked Out By');
  427 + $this->sortable = false;
  428 + }
  429 +
  430 + function renderData($aDataRow) {
  431 + // only show this for documents.
  432 + if ($aDataRow['type'] === 'folder') {
  433 + return '&nbsp;';
  434 + }
  435 +
  436 + // Check if document is checked out
  437 + $bIsCheckedOut = $aDataRow['document']->getIsCheckedOut();
  438 +
  439 + if($bIsCheckedOut){
  440 + // Get the user id
  441 + $iUserId = $aDataRow['document']->getCheckedOutUserID();
  442 + $oUser = User::get($iUserId);
  443 + $sUser = $oUser->getName();
  444 +
  445 + return '<span class="descriptive">'.htmlentities($sUser, ENT_NOQUOTES, 'UTF-8').'</span>';
  446 + }
  447 + return '&mdash;';
  448 + }
  449 +}
  450 +
421 class AdvancedDownloadColumn extends AdvancedColumn { 451 class AdvancedDownloadColumn extends AdvancedColumn {
422 452
423 var $namespace = 'ktcore.columns.download'; 453 var $namespace = 'ktcore.columns.download';
plugins/ktcore/KTCorePlugin.php
@@ -5,32 +5,32 @@ @@ -5,32 +5,32 @@
5 * KnowledgeTree Open Source Edition 5 * KnowledgeTree Open Source Edition
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited 7 * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
8 - * 8 + *
9 * This program is free software; you can redistribute it and/or modify it under 9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 3 as published by the 10 * the terms of the GNU General Public License version 3 as published by the
11 * Free Software Foundation. 11 * Free Software Foundation.
12 - * 12 + *
13 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * details. 16 * details.
17 - * 17 + *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 - * 20 + *
21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, 21 * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 22 * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
23 - * 23 + *
24 * The interactive user interfaces in modified source and object code versions 24 * The interactive user interfaces in modified source and object code versions
25 * of this program must display Appropriate Legal Notices, as required under 25 * of this program must display Appropriate Legal Notices, as required under
26 * Section 5 of the GNU General Public License version 3. 26 * Section 5 of the GNU General Public License version 3.
27 - * 27 + *
28 * In accordance with Section 7(b) of the GNU General Public License version 3, 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 * these Appropriate Legal Notices must retain the display of the "Powered by 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32 - * must display the words "Powered by KnowledgeTree" and retain the original  
33 - * copyright notice. 32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
34 * Contributor( s): ______________________________________ 34 * Contributor( s): ______________________________________
35 * 35 *
36 */ 36 */
@@ -110,7 +110,7 @@ class KTCorePlugin extends KTPlugin { @@ -110,7 +110,7 @@ class KTCorePlugin extends KTPlugin {
110 $this->registerDashlet('IndexingStatusDashlet', 'ktcore.dashlet.indexing_status', KT_DIR . '/plugins/search2/IndexingStatusDashlet.php'); 110 $this->registerDashlet('IndexingStatusDashlet', 'ktcore.dashlet.indexing_status', KT_DIR . '/plugins/search2/IndexingStatusDashlet.php');
111 $this->registerDashlet('LuceneStatisticsDashlet', 'ktcore.dashlet.indexing_statss', KT_DIR . '/plugins/search2/LuceneStatisticsDashlet.php'); 111 $this->registerDashlet('LuceneStatisticsDashlet', 'ktcore.dashlet.indexing_statss', KT_DIR . '/plugins/search2/LuceneStatisticsDashlet.php');
112 $this->registerDashlet('schedulerDashlet', 'ktcore.schedulerdashlet.plugin', 'scheduler/schedulerDashlet.php'); 112 $this->registerDashlet('schedulerDashlet', 'ktcore.schedulerdashlet.plugin', 'scheduler/schedulerDashlet.php');
113 - 113 +
114 $this->registerAdminPage('scheduler', 'manageSchedulerDispatcher', 'misc', _kt('Manage Task Scheduler'), _kt('Manage the task scheduler'), 'scheduler/taskScheduler.php'); 114 $this->registerAdminPage('scheduler', 'manageSchedulerDispatcher', 'misc', _kt('Manage Task Scheduler'), _kt('Manage the task scheduler'), 'scheduler/taskScheduler.php');
115 $this->registerAdminPage('authentication', 'KTAuthenticationAdminPage', 'principals', _kt('Authentication'), sprintf(_kt('By default, %s controls its own users and groups and stores all information about them inside the database. In many situations, an organisation will already have a list of users and groups, and needs to use that existing information to allow access to the DMS. These <strong>Authentication Sources</strong> allow the system administrator to specify additional sources of authentication data.'), APP_NAME), 'authentication/authenticationadminpage.inc.php'); 115 $this->registerAdminPage('authentication', 'KTAuthenticationAdminPage', 'principals', _kt('Authentication'), sprintf(_kt('By default, %s controls its own users and groups and stores all information about them inside the database. In many situations, an organisation will already have a list of users and groups, and needs to use that existing information to allow access to the DMS. These <strong>Authentication Sources</strong> allow the system administrator to specify additional sources of authentication data.'), APP_NAME), 'authentication/authenticationadminpage.inc.php');
116 116
@@ -134,6 +134,7 @@ class KTCorePlugin extends KTPlugin { @@ -134,6 +134,7 @@ class KTCorePlugin extends KTPlugin {
134 $this->registerColumn(_kt('Selection'), 'ktcore.columns.selection', 'AdvancedSelectionColumn', 'KTColumns.inc.php'); 134 $this->registerColumn(_kt('Selection'), 'ktcore.columns.selection', 'AdvancedSelectionColumn', 'KTColumns.inc.php');
135 $this->registerColumn(_kt('Single Selection'), 'ktcore.columns.singleselection', 'AdvancedSingleSelectionColumn', 'KTColumns.inc.php'); 135 $this->registerColumn(_kt('Single Selection'), 'ktcore.columns.singleselection', 'AdvancedSingleSelectionColumn', 'KTColumns.inc.php');
136 $this->registerColumn(_kt('Workflow State'), 'ktcore.columns.workflow_state', 'AdvancedWorkflowColumn', 'KTColumns.inc.php'); 136 $this->registerColumn(_kt('Workflow State'), 'ktcore.columns.workflow_state', 'AdvancedWorkflowColumn', 'KTColumns.inc.php');
  137 + $this->registerColumn(_kt('Checked Out By'), 'ktcore.columns.checkedout_by', 'CheckedOutByColumn', 'KTColumns.inc.php');
137 $this->registerColumn(_kt('Creation Date'), 'ktcore.columns.creationdate', 'CreationDateColumn', 'KTColumns.inc.php'); 138 $this->registerColumn(_kt('Creation Date'), 'ktcore.columns.creationdate', 'CreationDateColumn', 'KTColumns.inc.php');
138 $this->registerColumn(_kt('Modification Date'), 'ktcore.columns.modificationdate', 'ModificationDateColumn', 'KTColumns.inc.php'); 139 $this->registerColumn(_kt('Modification Date'), 'ktcore.columns.modificationdate', 'ModificationDateColumn', 'KTColumns.inc.php');
139 $this->registerColumn(_kt('Creator'), 'ktcore.columns.creator', 'CreatorColumn', 'KTColumns.inc.php'); 140 $this->registerColumn(_kt('Creator'), 'ktcore.columns.creator', 'CreatorColumn', 'KTColumns.inc.php');
@@ -158,7 +159,7 @@ class KTCorePlugin extends KTPlugin { @@ -158,7 +159,7 @@ class KTCorePlugin extends KTPlugin {
158 $this->registerTrigger('edit', 'postValidate', 'SavedSearchSubscriptionTrigger', 'ktcore.search2.savedsearch.subscription.edit', KT_DIR . '/plugins/search2/Search2Triggers.php'); 159 $this->registerTrigger('edit', 'postValidate', 'SavedSearchSubscriptionTrigger', 'ktcore.search2.savedsearch.subscription.edit', KT_DIR . '/plugins/search2/Search2Triggers.php');
159 $this->registerTrigger('add', 'postValidate', 'SavedSearchSubscriptionTrigger', 'ktcore.search2.savedsearch.subscription.add', KT_DIR . '/plugins/search2/Search2Triggers.php'); 160 $this->registerTrigger('add', 'postValidate', 'SavedSearchSubscriptionTrigger', 'ktcore.search2.savedsearch.subscription.add', KT_DIR . '/plugins/search2/Search2Triggers.php');
160 $this->registerTrigger('discussion', 'postValidate', 'SavedSearchSubscriptionTrigger', 'ktcore.search2.savedsearch.subscription.discussion', KT_DIR . '/plugins/search2/Search2Triggers.php'); 161 $this->registerTrigger('discussion', 'postValidate', 'SavedSearchSubscriptionTrigger', 'ktcore.search2.savedsearch.subscription.discussion', KT_DIR . '/plugins/search2/Search2Triggers.php');
161 - 162 +
162 //Tag Cloud Triggers 163 //Tag Cloud Triggers
163 $this->registerTrigger('add', 'postValidate', 'KTAddDocumentTrigger', 'ktcore.triggers.tagcloud.add', KT_DIR.'/plugins/tagcloud/TagCloudTriggers.php'); 164 $this->registerTrigger('add', 'postValidate', 'KTAddDocumentTrigger', 'ktcore.triggers.tagcloud.add', KT_DIR.'/plugins/tagcloud/TagCloudTriggers.php');
164 $this->registerTrigger('edit', 'postValidate', 'KTEditDocumentTrigger', 'ktcore.triggers.tagcloud.edit', KT_DIR.'/plugins/tagcloud/TagCloudTriggers.php'); 165 $this->registerTrigger('edit', 'postValidate', 'KTEditDocumentTrigger', 'ktcore.triggers.tagcloud.edit', KT_DIR.'/plugins/tagcloud/TagCloudTriggers.php');
@@ -182,7 +183,7 @@ class KTCorePlugin extends KTPlugin { @@ -182,7 +183,7 @@ class KTCorePlugin extends KTPlugin {
182 $this->registerWidget('KTCoreFolderCollectionWidget', 'ktcore.widgets.foldercollection', 'KTWidgets.php'); 183 $this->registerWidget('KTCoreFolderCollectionWidget', 'ktcore.widgets.foldercollection', 'KTWidgets.php');
183 184
184 $this->registerWidget('KTCoreConditionalSelectionWidget', 'ktcore.widgets.conditionalselection', 'KTWidgets.php'); 185 $this->registerWidget('KTCoreConditionalSelectionWidget', 'ktcore.widgets.conditionalselection', 'KTWidgets.php');
185 - 186 +
186 $this->registerPage('collection', 'KTCoreCollectionPage', 'KTWidgets.php'); 187 $this->registerPage('collection', 'KTCoreCollectionPage', 'KTWidgets.php');
187 $this->registerPage('notifications', 'KTNotificationOverflowPage', 'KTMiscPages.php'); 188 $this->registerPage('notifications', 'KTNotificationOverflowPage', 'KTMiscPages.php');
188 189
@@ -232,6 +233,8 @@ class KTCorePlugin extends KTPlugin { @@ -232,6 +233,8 @@ class KTCorePlugin extends KTPlugin {
232 _kt('Manage checked-out, archived and deleted documents.')); 233 _kt('Manage checked-out, archived and deleted documents.'));
233 $this->registerAdminCategory('documents', _kt('Document Metadata and Workflow Configuration'), 234 $this->registerAdminCategory('documents', _kt('Document Metadata and Workflow Configuration'),
234 _kt('Configure the document metadata: Document Types, Document Fieldsets, Link Types and Workflows.')); 235 _kt('Configure the document metadata: Document Types, Document Fieldsets, Link Types and Workflows.'));
  236 + $this->registerAdminCategory('search', _kt('Search and Indexing'),
  237 + _kt('Search and Indexing Settings'));
235 $this->registerAdminCategory('misc', _kt('Miscellaneous'), 238 $this->registerAdminCategory('misc', _kt('Miscellaneous'),
236 _kt('Various settings which do not fit into the other categories, including managing help and saved searches.')); 239 _kt('Various settings which do not fit into the other categories, including managing help and saved searches.'));
237 240
@@ -289,7 +292,26 @@ class KTCorePlugin extends KTPlugin { @@ -289,7 +292,26 @@ class KTCorePlugin extends KTPlugin {
289 _kt('Restore or Expunge Deleted Documents'), _kt('Restore previously deleted documents, or permanently expunge them.'), 292 _kt('Restore or Expunge Deleted Documents'), _kt('Restore previously deleted documents, or permanently expunge them.'),
290 'admin/deletedDocuments.php', null); 293 'admin/deletedDocuments.php', null);
291 294
  295 + //Search and Indexing
  296 + $this->registerAdminPage('managemimetypes', 'ManageMimeTypesDispatcher', 'search',
  297 + _kt('Mime Types'), _kt('This report lists all mime types and extensions that can be identified by KnowledgeTree.'),
  298 + '../search2/reporting/ManageMimeTypes.php', null);
  299 +
  300 + $this->registerAdminPage('extractorinfo', 'ExtractorInfoDispatcher', 'search',
  301 + _kt('Extractor Information'), _kt('This report lists the text extractors and their supported mime types.'),
  302 + '../search2/reporting/ExtractorInfo.php', null);
  303 +
  304 + $this->registerAdminPage('indexerrors', 'IndexErrorsDispatcher', 'search',
  305 + _kt('Document Indexing Diagnostics'), _kt('This report will help to diagnose problems with document indexing.'),
  306 + '../search2/reporting/IndexErrors.php', null);
  307 +
  308 + $this->registerAdminPage('pendingdocuments', 'PendingDocumentsDispatcher', 'search',
  309 + _kt('Pending Documents Indexing Queue'), _kt('This report lists documents that are waiting to be indexed.'),
  310 + '../search2/reporting/PendingDocuments.php', null);
292 311
  312 + $this->registerAdminPage('reschedulealldocuments', 'RescheduleDocumentsDispatcher', 'search',
  313 + _kt('Reschedule all documents'), _kt('This function allows you to re-index your entire repository.'),
  314 + '../search2/reporting/RescheduleDocuments.php', null);
293 315
294 // misc 316 // misc
295 $this->registerAdminPage('helpmanagement', 'ManageHelpDispatcher', 'misc', 317 $this->registerAdminPage('helpmanagement', 'ManageHelpDispatcher', 'misc',
plugins/search2/reporting/ExtractorInfo.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * $Id:$
  4 + *
  5 + * KnowledgeTree Open Source Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify it under
  10 + * the terms of the GNU General Public License version 3 as published by the
  11 + * Free Software Foundation.
  12 + *
  13 + * This program is distributed in the hope that it will be useful, but WITHOUT
  14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  16 + * details.
  17 + *
  18 + * You should have received a copy of the GNU General Public License
  19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20 + *
  21 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  22 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  23 + *
  24 + * The interactive user interfaces in modified source and object code versions
  25 + * of this program must display Appropriate Legal Notices, as required under
  26 + * Section 5 of the GNU General Public License version 3.
  27 + *
  28 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  29 + * these Appropriate Legal Notices must retain the display of the "Powered by
  30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
  34 + * Contributor( s): ______________________________________
  35 + *
  36 + */
  37 +
  38 +require_once(KT_LIB_DIR . '/dispatcher.inc.php');
  39 +require_once(KT_LIB_DIR . '/templating/templating.inc.php');
  40 +require_once(KT_LIB_DIR . '/mime.inc.php');
  41 +
  42 +class ExtractorInfoDispatcher extends KTAdminDispatcher {
  43 +
  44 +
  45 + function check() {
  46 + $this->aBreadcrumbs[] = array(
  47 + 'url' => $_SERVER['PHP_SELF'],
  48 + 'name' => _kt('Extractor Information'),
  49 + );
  50 + return parent::check();
  51 + }
  52 +
  53 + function do_main() {
  54 +
  55 + //registerTypes registers the mime types and populates the needed tables.
  56 + $indexer = Indexer::get();
  57 + $indexer->registerTypes();
  58 +
  59 + $oTemplating =& KTTemplating::getSingleton();
  60 + $oTemplating->addLocation('Extractor Information', '/plugins/search2/reporting/templates');
  61 +
  62 + $oTemplate =& $oTemplating->loadTemplate('extractorinfo');
  63 +
  64 + $aExtractorInfo = KTMime::getMimeExtractorInformation();
  65 +
  66 + if(empty($aExtractorInfo))
  67 + {
  68 + $oTemplate->setData(array(
  69 + 'context' => $this,
  70 + 'extractor_info' => $aExtractorInfo
  71 + ));
  72 +
  73 + return $oTemplate;
  74 + }
  75 +
  76 + foreach($aExtractorInfo as $key=>$info)
  77 + {
  78 + $extractorClass = $info['name'];
  79 + $extractor = $indexer->getExtractor($extractorClass);
  80 + $info['mimeTypes'] = array();
  81 + $aMimeTypes = $this->getSupportedMimeTypesDB($extractorClass);//$extractor->getSupportedMimeTypes();
  82 +
  83 +
  84 + foreach($aMimeTypes as $mimeType)
  85 + {
  86 + $sMimeInfo = KTMime::getFriendlyNameAndExtension($mimeType);
  87 +
  88 + $info['mimeTypes'][$mimeType] = array('description'=>$sMimeInfo[0]['friendly_name'], 'extensions'=>array($sMimeInfo[0]['filetypes']));
  89 +
  90 + $extensions = array();
  91 + foreach($sMimeInfo as $item)
  92 + {
  93 + $extensions[] = $item['filetypes'];
  94 + }
  95 + $info['mimeTypes'][$mimeType]['extensions'] = implode(', ', $extensions);
  96 + }
  97 +
  98 + $aExtractorInfo[$key] = $info;
  99 + }
  100 +
  101 + $oTemplate->setData(array(
  102 + 'context' => $this,
  103 + 'extractor_info' => $aExtractorInfo
  104 + ));
  105 + return $oTemplate;
  106 + }
  107 +
  108 + function getSupportedMimeTypesDB($sExtractorName)
  109 + {
  110 + $sQuery = "SELECT MT.mimetypes FROM mime_extractors as ME LEFT JOIN mime_types as MT ON " .
  111 + "(ME.id = MT.extractor_id) WHERE ME.name = ?";
  112 + $aQuery = array($sQuery, array($sExtractorName));
  113 + $aTempRes = DBUtil::getResultArray($aQuery);
  114 + $aRes = array();
  115 + for($i = 0; $i < count($aTempRes); $i++ )
  116 + {
  117 + if(!in_array($aTempRes[$i]['mimetypes'], $aRes))
  118 + {
  119 + $aRes[] = $aTempRes[$i]['mimetypes'];
  120 +
  121 + }
  122 + }
  123 + return $aRes;
  124 + }
  125 +
  126 +}
  127 +
  128 +
  129 +?>
plugins/search2/reporting/IndexErrors.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * $Id:$
  4 + *
  5 + * KnowledgeTree Open Source Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify it under
  10 + * the terms of the GNU General Public License version 3 as published by the
  11 + * Free Software Foundation.
  12 + *
  13 + * This program is distributed in the hope that it will be useful, but WITHOUT
  14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  16 + * details.
  17 + *
  18 + * You should have received a copy of the GNU General Public License
  19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20 + *
  21 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  22 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  23 + *
  24 + * The interactive user interfaces in modified source and object code versions
  25 + * of this program must display Appropriate Legal Notices, as required under
  26 + * Section 5 of the GNU General Public License version 3.
  27 + *
  28 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  29 + * these Appropriate Legal Notices must retain the display of the "Powered by
  30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
  34 + * Contributor( s): ______________________________________
  35 + *
  36 + */
  37 +
  38 +require_once(KT_LIB_DIR . '/dispatcher.inc.php');
  39 +require_once(KT_LIB_DIR . '/templating/templating.inc.php');
  40 +require_once(KT_LIB_DIR . '/mime.inc.php');
  41 +
  42 +class IndexErrorsDispatcher extends KTAdminDispatcher {
  43 +
  44 + function check() {
  45 + $this->aBreadcrumbs[] = array(
  46 + 'url' => $_SERVER['PHP_SELF'],
  47 + 'name' => _kt('Document Indexing Diagnostics'),
  48 + );
  49 + return parent::check();
  50 + }
  51 +
  52 + function do_main() {
  53 +
  54 + //registerTypes registers the mime types and populates the needed tables.
  55 + $indexer = Indexer::get();
  56 + $indexer->registerTypes();
  57 +
  58 + if($_REQUEST['rescheduleValue'] == 'reschedule')
  59 + {
  60 +
  61 + foreach(KTUtil::arrayGet($_REQUEST, 'index_error', array()) as $sDocId => $v)
  62 + {
  63 + Indexer::reindexDocument($sDocId);
  64 +
  65 + }
  66 +
  67 + }
  68 + else if($_REQUEST['rescheduleValue'] == 'rescheduleall')
  69 + {
  70 + $aIndexerValues = Indexer::getIndexingQueue();
  71 + foreach ($aIndexerValues as $sDocValues)
  72 + {
  73 + Indexer::reindexDocument($sDocValues['document_id']);
  74 + }
  75 +
  76 + }
  77 + require_once(KT_LIB_DIR . "/templating/templating.inc.php");
  78 + $oTemplating =& KTTemplating::getSingleton();
  79 + $oTemplating->addLocation('Index Errors', '/plugins/search2/reporting/templates');
  80 +
  81 + $oTemplate =& $oTemplating->loadTemplate('indexerrors');
  82 +
  83 + $aIndexerValues = Indexer::getIndexingQueue();
  84 +
  85 + $oTemplate->setData(array(
  86 + 'context' => $this,
  87 + 'index_errors' => $aIndexerValues
  88 +
  89 + ));
  90 + return $oTemplate;
  91 + }
  92 +
  93 +
  94 +
  95 +}
  96 +
  97 +
  98 +?>
plugins/search2/reporting/ManageMimeTypes.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * $Id:$
  4 + *
  5 + * KnowledgeTree Open Source Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify it under
  10 + * the terms of the GNU General Public License version 3 as published by the
  11 + * Free Software Foundation.
  12 + *
  13 + * This program is distributed in the hope that it will be useful, but WITHOUT
  14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  16 + * details.
  17 + *
  18 + * You should have received a copy of the GNU General Public License
  19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20 + *
  21 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  22 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  23 + *
  24 + * The interactive user interfaces in modified source and object code versions
  25 + * of this program must display Appropriate Legal Notices, as required under
  26 + * Section 5 of the GNU General Public License version 3.
  27 + *
  28 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  29 + * these Appropriate Legal Notices must retain the display of the "Powered by
  30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
  34 + * Contributor( s): ______________________________________
  35 + *
  36 + */
  37 +require_once(KT_LIB_DIR . '/dispatcher.inc.php');
  38 +require_once(KT_LIB_DIR . '/templating/templating.inc.php');
  39 +require_once(KT_LIB_DIR . '/mime.inc.php');
  40 +
  41 +class ManageMimeTypesDispatcher extends KTAdminDispatcher {
  42 +
  43 + function check() {
  44 + $this->aBreadcrumbs[] = array(
  45 + 'url' => $_SERVER['PHP_SELF'],
  46 + 'name' => _kt('Manage Mime Types'),
  47 + );
  48 + return parent::check();
  49 + }
  50 +
  51 + function do_main() {
  52 +
  53 + //registerTypes registers the mime types and populates the needed tables.
  54 + $indexer = Indexer::get();
  55 + $indexer->registerTypes();
  56 +
  57 + $oTemplating =& KTTemplating::getSingleton();
  58 + $oTemplating->addLocation('Manage Mime Type Plugin', '/plugins/search2/reporting/templates');
  59 +
  60 + $oTemplate =& $oTemplating->loadTemplate('managemimetypes');
  61 +
  62 + $aMimeTypes = KTMime::getAllMimeTypesInformation();
  63 +
  64 + $indexer = Indexer::get();
  65 +
  66 + $numExtensions = 0;
  67 + $numIndexedExtensions = 0;
  68 +
  69 + foreach($aMimeTypes as $key=>$mimeType)
  70 + {
  71 + $extractorClass = $mimeType['extractor'];
  72 + $numExtensions++;
  73 + if (empty($extractorClass))
  74 + {
  75 + continue;
  76 + }
  77 + $extractor = $indexer->getExtractor($extractorClass);
  78 + $aMimeTypes[$key]['extractor'] = $extractor->getDisplayName();
  79 + $numIndexedExtensions++;
  80 + }
  81 +
  82 + $indexedPercentage = 0;
  83 + if ($numExtensions > 0)
  84 + {
  85 + $indexedPercentage = number_format(($numIndexedExtensions * 100)/$numExtensions,2,'.',',');
  86 + }
  87 +
  88 + $oTemplate->setData(array(
  89 + 'context' => $this,
  90 + 'mime_types' => $aMimeTypes,
  91 + 'numExtensions'=>$numExtensions,
  92 + 'numIndexedExtensions'=>$numIndexedExtensions,
  93 + 'indexedPercentage'=>$indexedPercentage
  94 +
  95 + ));
  96 + return $oTemplate;
  97 + }
  98 +}
0 \ No newline at end of file 99 \ No newline at end of file
plugins/search2/reporting/PendingDocuments.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * $Id:$
  4 + *
  5 + * KnowledgeTree Open Source Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify it under
  10 + * the terms of the GNU General Public License version 3 as published by the
  11 + * Free Software Foundation.
  12 + *
  13 + * This program is distributed in the hope that it will be useful, but WITHOUT
  14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  16 + * details.
  17 + *
  18 + * You should have received a copy of the GNU General Public License
  19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20 + *
  21 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  22 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  23 + *
  24 + * The interactive user interfaces in modified source and object code versions
  25 + * of this program must display Appropriate Legal Notices, as required under
  26 + * Section 5 of the GNU General Public License version 3.
  27 + *
  28 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  29 + * these Appropriate Legal Notices must retain the display of the "Powered by
  30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
  34 + * Contributor( s): ______________________________________
  35 + *
  36 + */
  37 +
  38 +require_once(KT_LIB_DIR . '/dispatcher.inc.php');
  39 +require_once(KT_LIB_DIR . '/templating/templating.inc.php');
  40 +
  41 +class PendingDocumentsDispatcher extends KTAdminDispatcher
  42 +{
  43 + function check() {
  44 + $this->aBreadcrumbs[] = array(
  45 + 'url' => $_SERVER['PHP_SELF'],
  46 + 'name' => _kt('Pending Documents Indexing Queue'),
  47 + );
  48 + return parent::check();
  49 + }
  50 +
  51 + function do_main() {
  52 +
  53 + //registerTypes registers the mime types and populates the needed tables.
  54 + $indexer = Indexer::get();
  55 + $indexer->registerTypes();
  56 +
  57 + $aPendingDocs = Indexer::getPendingIndexingQueue();
  58 +
  59 + $oTemplating =& KTTemplating::getSingleton();
  60 + $oTemplating->addLocation('Pending Documents', '/plugins/search2/reporting/templates');
  61 + $oTemplate =& $oTemplating->loadTemplate('pendingdocuments');
  62 +
  63 + $oTemplate->setData(array(
  64 + 'context' => $this,
  65 + 'pending_docs' => $aPendingDocs
  66 +
  67 + ));
  68 + return $oTemplate;
  69 + }
  70 +
  71 +}
  72 +
  73 +
  74 +?>
plugins/search2/reporting/RescheduleDocuments.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * $Id:$
  4 + *
  5 + * KnowledgeTree Open Source Edition
  6 + * Document Management Made Simple
  7 + * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify it under
  10 + * the terms of the GNU General Public License version 3 as published by the
  11 + * Free Software Foundation.
  12 + *
  13 + * This program is distributed in the hope that it will be useful, but WITHOUT
  14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  16 + * details.
  17 + *
  18 + * You should have received a copy of the GNU General Public License
  19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20 + *
  21 + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
  22 + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
  23 + *
  24 + * The interactive user interfaces in modified source and object code versions
  25 + * of this program must display Appropriate Legal Notices, as required under
  26 + * Section 5 of the GNU General Public License version 3.
  27 + *
  28 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  29 + * these Appropriate Legal Notices must retain the display of the "Powered by
  30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  32 + * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * copyright notice.
  34 + * Contributor( s): ______________________________________
  35 + *
  36 + */
  37 +
  38 +require_once(KT_LIB_DIR . '/dispatcher.inc.php');
  39 +require_once(KT_LIB_DIR . '/templating/templating.inc.php');
  40 +
  41 +class RescheduleDocumentsDispatcher extends KTAdminDispatcher
  42 +{
  43 + function check() {
  44 + $this->aBreadcrumbs[] = array(
  45 + 'url' => $_SERVER['PHP_SELF'],
  46 + 'name' => _kt('Reschedule all documents'),
  47 + );
  48 + return parent::check();
  49 + }
  50 +
  51 + function do_main() {
  52 +
  53 + //registerTypes registers the mime types and populates the needed tables.
  54 + $indexer = Indexer::get();
  55 + $indexer->registerTypes();
  56 +
  57 + $oTemplating =& KTTemplating::getSingleton();
  58 + $oTemplating->addLocation('Reschedule Documents', '/plugins/search2/reporting/templates');
  59 +
  60 +
  61 + $oTemplate =& $oTemplating->loadTemplate('rescheduledocuments');
  62 +
  63 + if ($_REQUEST['rescheduleValue'] == 'reschedule')
  64 + {
  65 + Indexer::indexAll();
  66 + $oTemplate->setData(array(
  67 + 'context' => $this,
  68 + 'rescheduleDone' => true
  69 + ));
  70 + return $oTemplate;
  71 + }
  72 +
  73 + $oTemplate->setData(array(
  74 + 'context' => $this,
  75 + 'rescheduleDone' => false
  76 +
  77 + ));
  78 + return $oTemplate;
  79 + }
  80 +}
  81 +
  82 +?>
plugins/search2/reporting/templates/extractorinfo.smarty 0 → 100644
  1 +<h2>{i18n}Extractor Information{/i18n}</h2>
  2 +<p class="descriptiveText">{i18n}This report lists the text extractors and their supported mime types.{/i18n}</p>
  3 +
  4 +{if $extractor_info}
  5 +
  6 +{foreach key=key from=$extractor_info item=extractor}
  7 +<br>
  8 +<dl class='panel_menu'><h3>{$extractor.name}{if $extractor.active == 1} ({i18n}Active{/i18n}){else} ({i18n}Inactive{/i18n}){/if}</h3><dl/>
  9 +
  10 +<table class=kt_collection>
  11 +
  12 +<thead>
  13 +<tr>
  14 +<th width="300">{i18n}Description{/i18n}</th>
  15 +<th width="400">{i18n}Mime Types{/i18n}</th>
  16 +<th>{i18n}Extensions{/i18n}</th>
  17 +</tr>
  18 +</thead>
  19 +
  20 +<tbody>
  21 +
  22 +{foreach from=$extractor.mimeTypes key=key item=mimeType}
  23 +<tr>
  24 + <td>{$mimeType.description}</td>
  25 + <td>{$key}</td>
  26 + <td>{$extractor.mimeTypes.$key.extensions}</td>
  27 +</tr>
  28 +{/foreach}
  29 +
  30 +</tbody>
  31 +
  32 +</table>
  33 +
  34 +{/foreach}
  35 +
  36 +{else}
  37 +<br>
  38 +<h3>{i18n}There are no extractors registered.{/i18n}</h3>
  39 +{/if}
plugins/search2/reporting/templates/indexerrors.smarty 0 → 100644
  1 +{literal}
  2 +<script type="text/javascript">
  3 + function doReschedule(rescheduleAction)
  4 + {
  5 + var hiddenVal = document.getElementById("rescheduleValue");
  6 + hiddenVal.value = rescheduleAction;
  7 + document.scheduleForm.submit();
  8 + }
  9 +
  10 +</script>
  11 +{/literal}
  12 +
  13 +<h2>{i18n}Document Indexing Diagnostics{/i18n}</h2>
  14 +<p class="descriptiveText">{i18n}This report will help to diagnose problems with document indexing.{/i18n}</p>
  15 +
  16 +<br>
  17 +{if $index_errors}
  18 +
  19 +<form name="scheduleForm" action="{$smarty.server.PHP_SELF}" method="POST">
  20 +<input type="hidden" name="rescheduleValue" id="rescheduleValue" value="" />
  21 +
  22 +<table class=kt_collection>
  23 +<thead>
  24 + <tr>
  25 + <th width="10"></th>
  26 + <th width="80"><nobr>{i18n}Document ID{/i18n}</th>
  27 + <th ><nobr>{i18n}Filename{/i18n}</th>
  28 + <th width="100"><nobr>{i18n}Extension{/i18n}</th>
  29 + <th width="100"><nobr>{i18n}Mime Type{/i18n}</th>
  30 + <th width="100"><nobr>{i18n}Extractor{/i18n}</th>
  31 + <th width="100"><nobr>{i18n}Index Date{/i18n}</th>
  32 + </tr>
  33 +</thead>
  34 +
  35 +<tbody>
  36 +{foreach key=key from=$index_errors item=indexError}
  37 +<tr>
  38 + <td class="centered"><input type="checkbox" name="index_error[{$indexError.document_id}]" value="1"/></td>
  39 + <td>{$indexError.document_id}</td>
  40 + <td>{$indexError.filename|truncate:40:'...'}</td>
  41 + <td>{$indexError.filetypes}</td>
  42 + <td>{$indexError.mimetypes}</td>
  43 + <td>{if $pendingDocs.extractor}{$indexError.extractor}{else}<p><font color="#FF9933">{i18n}n/a{/i18n}</font></p>{/if}</td>
  44 + <td>{$indexError.indexdate}</td>
  45 +
  46 +</tr>
  47 +<tr>
  48 + <td>&nbsp;</td>
  49 + <td colspan=4><pre>{$indexError.status_msg}</pre></td>
  50 +</tr>
  51 +
  52 +
  53 +{/foreach}
  54 +
  55 +</tbody>
  56 +
  57 +</table>
  58 +
  59 +<br>
  60 +<input type="button" name="Reschedule" value="{i18n}Reschedule{/i18n}" onclick="doReschedule('reschedule');"/>
  61 +<input type="button" name="Reschedule All" value="{i18n}Reschedule All{/i18n}" onclick="doReschedule('rescheduleall');"/>
  62 +{else}
  63 +<h3>{i18n}There are no indexing issues.{/i18n}</h3>
  64 +{/if}
  65 +</form>
0 \ No newline at end of file 66 \ No newline at end of file
plugins/search2/reporting/templates/managemimetypes.smarty 0 → 100644
  1 +<h2>{i18n}Manage Mime Types{/i18n}</h2>
  2 +<p class="descriptiveText">{i18n}This report lists all mime types and extensions that can be identified by KnowledgeTree.{/i18n}</p>
  3 +
  4 +
  5 +{if $mime_types}
  6 +
  7 +<table class=kt_collection>
  8 +
  9 +<thead>
  10 +<tr>
  11 +<th>Icon </th>
  12 +<th> Extension </th>
  13 +<th> Mime Type </th>
  14 +<th> Description </th>
  15 +<th> Extractor </th>
  16 +</tr>
  17 +</thead>
  18 +
  19 +<tbody>
  20 +{foreach from=$mime_types item=mimetype}
  21 +<tr>
  22 +<td><span class="contenttype {$mimetype.icon_path}"></span></td>
  23 +<td>{$mimetype.filetypes}</td>
  24 +<td>{$mimetype.mimetypes}</td>
  25 +<td>{if $mimetype.friendly_name}
  26 +{$mimetype.friendly_name}
  27 +{else}
  28 +<p><font color="#FF9933">no description</font></p>
  29 +{/if}</td>
  30 +<td>{if $mimetype.extractor}
  31 +{$mimetype.extractor}
  32 +{else}
  33 +<p><font color="#FF9933">n/a</font></p>
  34 +{/if}</td>
  35 +</tr>
  36 +{/foreach}
  37 +</tbody>
  38 +
  39 +</table>
  40 +
  41 +<table>
  42 +<tr><td>Number of Extensions<td>{$numExtensions}
  43 +<tr><td>Number of indexed extensions<td>{$numIndexedExtensions} ( {$indexedPercentage}% )
  44 +</table>
  45 +
  46 +
  47 +{/if}
  48 +
plugins/search2/reporting/templates/pendingdocuments.smarty 0 → 100644
  1 +<h2>{i18n}Pending Documents Indexing Queue{/i18n}</h2>
  2 +{i18n}This report lists documents that are waiting to be indexed.{/i18n}
  3 +<br><br>
  4 +{i18n}If a document is not associated with an extractor, no content will be added to the index. These documents can be identified in the list by the extractor column reflecting n/a.{/i18n}
  5 +<br><br>
  6 +
  7 +{if empty($pending_docs)}
  8 +
  9 +<b>{i18n}There are no documents in the indexing queue.{/i18n}</b>
  10 +
  11 +{else}
  12 +
  13 +
  14 +<table class=kt_collection>
  15 +
  16 +<thead>
  17 +<tr>
  18 + <th width="10"><nobr>{i18n}Document ID{/i18n}</th>
  19 + <th><nobr>{i18n}Filename{/i18n}</th>
  20 + <th width="100"><nobr>{i18n}Extension{/i18n}</th>
  21 + <th width="150"><nobr>{i18n}Mime Type{/i18n}</th>
  22 + <th width="100"><nobr>{i18n}Extractor{/i18n}</th>
  23 + <th width="100"><nobr>{i18n}Index Date{/i18n}</th>
  24 +</tr>
  25 +</thead>
  26 +
  27 +<tbody>
  28 +
  29 +{foreach key=key from=$pending_docs item=pendingDocs}
  30 +<tr>
  31 + <td><a href="/view.php?fDocumentId={$pendingDocs.document_id}">{$pendingDocs.document_id}</a></td>
  32 + <td>{$pendingDocs.filename|truncate:40:'...'}</td>
  33 + <td>{$pendingDocs.filetypes}</td>
  34 + <td>{$pendingDocs.mimetypes}</td>
  35 + <td>{if $pendingDocs.extractor}{$pendingDocs.extractor}{else}<p><font color="#FF9933">{i18n}n/a{/i18n}</font></p>{/if}</td>
  36 + <td>{$pendingDocs.indexdate}</td>
  37 +</tr>
  38 +{/foreach}
  39 +
  40 +</tbody>
  41 +
  42 +</table>
  43 +
  44 +{/if}
0 \ No newline at end of file 45 \ No newline at end of file
plugins/search2/reporting/templates/rescheduledocuments.smarty 0 → 100644
  1 +<h2>{i18n}Reschedule All Documents{/i18n}</h2>
  2 +<p class="descriptiveText">{i18n}This function allows you to re-index your entire repository.{/i18n}</p>
  3 +<p class="descriptiveText">{i18n}Please note that rescheduling all documents may take a long time, depending on the size if the repository.{/i18n}</h3>
  4 +
  5 +<form name="rescheduleAllDocs" action="{$smarty.server.PHP_SELF}" method="POST">
  6 +<br>
  7 +{if $rescheduleDone == true}
  8 +<p>Documents Rescheduled</p>
  9 +<p>You can view the schedule queue <a href=admin.php?kt_path_info=search/pendingdocuments>here</a></p>
  10 +<br>
  11 +{/if}
  12 +<input type="submit" name="Reschedule" value="{i18n}Reschedule All{/i18n}" />
  13 +<input type="hidden" name="rescheduleValue" id="rescheduleValue" value="reschedule" />
  14 +
  15 +</form>
0 \ No newline at end of file 16 \ No newline at end of file
search2/indexing/indexerCore.inc.php
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
36 * 36 *
37 */ 37 */
38 38
  39 +define('SEARCH2_INDEXER_DIR',realpath(dirname(__FILE__)) . '/');
39 require_once('indexing/extractorCore.inc.php'); 40 require_once('indexing/extractorCore.inc.php');
40 require_once(KT_DIR . '/plugins/ktcore/scheduler/schedulerUtil.php'); 41 require_once(KT_DIR . '/plugins/ktcore/scheduler/schedulerUtil.php');
41 42
@@ -492,6 +493,19 @@ abstract class Indexer @@ -492,6 +493,19 @@ abstract class Indexer
492 $default->log->debug("index: Queuing indexing of $document_id"); 493 $default->log->debug("index: Queuing indexing of $document_id");
493 } 494 }
494 495
  496 + public static function reindexQueue()
  497 + {
  498 + $sql = "UPDATE index_files SET processdate = null";
  499 + DBUtil::runQuery($sql);
  500 + }
  501 +
  502 + public static function reindexDocument($documentId)
  503 + {
  504 + $sql = "UPDATE index_files SET processdate=null, status_msg=null WHERE document_id=$documentId";
  505 + DBUtil::runQuery($sql);
  506 + }
  507 +
  508 +
495 509
496 public static function indexAll() 510 public static function indexAll()
497 { 511 {
@@ -741,6 +755,107 @@ abstract class Indexer @@ -741,6 +755,107 @@ abstract class Indexer
741 KTUtil::setSystemSetting('mimeTypesRegistered', true); 755 KTUtil::setSystemSetting('mimeTypesRegistered', true);
742 } 756 }
743 757
  758 + private function updatePendingDocumentStatus($documentId, $message, $level)
  759 + {
  760 + $this->indexingHistory .= "\n" . $level . ': ' . $message;
  761 + $message = sanitizeForSQL($this->indexingHistory);
  762 + $sql = "UPDATE index_files SET status_msg='$message' WHERE document_id=$documentId";
  763 + DBUtil::runQuery($sql);
  764 + }
  765 +
  766 + /**
  767 + *
  768 + * @param int $documentId
  769 + * @param string $message
  770 + * @param string $level This may be info, error, debug
  771 + */
  772 + private function logPendingDocumentInfoStatus($documentId, $message, $level)
  773 + {
  774 + $this->updatePendingDocumentStatus($documentId, $message, $level);
  775 + global $default;
  776 +
  777 + switch ($level)
  778 + {
  779 + case 'debug':
  780 + if ($this->debug)
  781 + {
  782 + $default->log->debug($message);
  783 + }
  784 + break;
  785 + default:
  786 + $default->log->$level($message);
  787 + }
  788 + }
  789 +
  790 +
  791 +
  792 + public function getExtractor($extractorClass)
  793 + {
  794 + $includeFile = SEARCH2_INDEXER_DIR . 'extractors/' . $extractorClass . '.inc.php';
  795 + if (!file_exists($includeFile))
  796 + {
  797 + throw new Exception("Extractor file does not exist: $includeFile");
  798 + }
  799 +
  800 + require_once($includeFile);
  801 +
  802 + if (!class_exists($extractorClass))
  803 + {
  804 + throw new Exception("Extractor '$classname' not defined in file: $includeFile");
  805 + }
  806 +
  807 + $extractor = new $extractorClass();
  808 +
  809 + if (!($extractor instanceof DocumentExtractor))
  810 + {
  811 + throw new Exception("Class $classname was expected to be of type DocumentExtractor");
  812 + }
  813 +
  814 + return $extractor;
  815 + }
  816 +
  817 + public static function getIndexingQueue($problemItemsOnly=true)
  818 + {
  819 +
  820 + if ($problemItemsOnly)
  821 + {
  822 + $sql = "SELECT
  823 + iff.document_id, iff.indexdate, mt.filetypes, mt.mimetypes, me.name as extractor, iff.what, iff.status_msg, dcv.filename
  824 + FROM
  825 + index_files iff
  826 + INNER JOIN documents d ON iff.document_id=d.id
  827 + INNER JOIN document_metadata_version dmv ON d.metadata_version_id=dmv.id
  828 + INNER JOIN document_content_version dcv ON dmv.content_version_id=dcv.id
  829 + INNER JOIN mime_types mt ON dcv.mime_id=mt.id
  830 + LEFT JOIN mime_extractors me ON mt.extractor_id=me.id
  831 + WHERE
  832 + (iff.status_msg IS NOT NULL) AND dmv.status_id=1
  833 + ORDER BY indexdate ";
  834 + }
  835 + else
  836 + {
  837 + $sql = "SELECT
  838 + iff.document_id, iff.indexdate, mt.filetypes, mt.mimetypes, me.name as extractor, iff.what, iff.status_msg, dcv.filename
  839 + FROM
  840 + index_files iff
  841 + INNER JOIN documents d ON iff.document_id=d.id
  842 + INNER JOIN document_metadata_version dmv ON d.metadata_version_id=dmv.id
  843 + INNER JOIN document_content_version dcv ON dmv.content_version_id=dcv.id
  844 + INNER JOIN mime_types mt ON dcv.mime_id=mt.id
  845 + LEFT JOIN mime_extractors me ON mt.extractor_id=me.id
  846 + WHERE
  847 + (iff.status_msg IS NULL or iff.status_msg = '') AND dmv.status_id=1
  848 + ORDER BY indexdate ";
  849 + }
  850 + $aResult = DBUtil::getResultArray($sql);
  851 +
  852 + return $aResult;
  853 + }
  854 +
  855 + public static function getPendingIndexingQueue()
  856 + {
  857 + return Indexer::getIndexingQueue(false);
  858 + }
744 859
745 /** 860 /**
746 * The main function that may be called repeatedly to index documents. 861 * The main function that may be called repeatedly to index documents.
@@ -841,11 +956,10 @@ abstract class Indexer @@ -841,11 +956,10 @@ abstract class Indexer
841 $extractorClass=$docinfo['extractor']; 956 $extractorClass=$docinfo['extractor'];
842 $indexDocument = in_array($docinfo['what'], array('A','C')); 957 $indexDocument = in_array($docinfo['what'], array('A','C'));
843 $indexDiscussion = in_array($docinfo['what'], array('A','D')); 958 $indexDiscussion = in_array($docinfo['what'], array('A','D'));
  959 + $this->indexingHistory = '';
  960 +
  961 + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Indexing docid: %d extension: '%s' mimetype: '%s' extractor: '%s'"), $docId, $extension,$mimeType,$extractorClass), 'debug');
844 962
845 - if ($this->debug)  
846 - {  
847 - if ($this->debug) $default->log->debug(sprintf(_kt("Indexing docid: %d extension: '%s' mimetype: '%s' extractor: '%s'"), $docId, $extension,$mimeType,$extractorClass));  
848 - }  
849 963
850 if (empty($extractorClass)) 964 if (empty($extractorClass))
851 { 965 {
@@ -855,13 +969,13 @@ abstract class Indexer @@ -855,13 +969,13 @@ abstract class Indexer
855 969
856 if (!$this->isExtractorEnabled($extractorClass)) 970 if (!$this->isExtractorEnabled($extractorClass))
857 { 971 {
858 - $default->log->info(sprintf(_kt("diagnose: Not indexing docid: %d because extractor '%s' is disabled."), $docId, $extractorClass)); 972 + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("diagnose: Not indexing docid: %d because extractor '%s' is disabled."), $docId, $extractorClass), 'info');
859 continue; 973 continue;
860 } 974 }
861 975
862 if ($this->debug) 976 if ($this->debug)
863 { 977 {
864 - $default->log->info(sprintf(_kt("Processing docid: %d.\n"),$docId)); 978 + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Processing docid: %d.\n"),$docId), 'info');
865 } 979 }
866 980
867 $removeFromQueue = true; 981 $removeFromQueue = true;
@@ -873,26 +987,12 @@ abstract class Indexer @@ -873,26 +987,12 @@ abstract class Indexer
873 } 987 }
874 else 988 else
875 { 989 {
876 - require_once('extractors/' . $extractorClass . '.inc.php');  
877 -  
878 - if (!class_exists($extractorClass))  
879 - {  
880 - $default->log->error(sprintf(_kt("indexDocuments: extractor '%s' does not exist."),$extractorClass));  
881 - continue;  
882 - }  
883 -  
884 - $extractor = $extractorCache[$extractorClass] = new $extractorClass();  
885 - }  
886 -  
887 - if (is_null($extractor))  
888 - {  
889 - $default->log->error(sprintf(_kt("indexDocuments: extractor '%s' not resolved - it is null."),$extractorClass));  
890 - continue; 990 + $extractor = $extractorCache[$extractorClass] = $this->getExtractor($extractorClass);
891 } 991 }
892 992
893 if (!($extractor instanceof DocumentExtractor)) 993 if (!($extractor instanceof DocumentExtractor))
894 { 994 {
895 - $default->log->error(sprintf(_kt("indexDocuments: extractor '%s' is not a document extractor class."),$extractorClass)); 995 + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("indexDocuments: extractor '%s' is not a document extractor class."),$extractorClass), 'error');
896 continue; 996 continue;
897 } 997 }
898 998
@@ -914,7 +1014,7 @@ abstract class Indexer @@ -914,7 +1014,7 @@ abstract class Indexer
914 $result = @copy($sourceFile, $intermediate); 1014 $result = @copy($sourceFile, $intermediate);
915 if ($result === false) 1015 if ($result === false)
916 { 1016 {
917 - $default->log->error(sprintf(_kt("Could not create intermediate file from document %d"),$docId)); 1017 + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Could not create intermediate file from document %d"),$docId), 'error');
918 // problem. lets try again later. probably permission related. log the issue. 1018 // problem. lets try again later. probably permission related. log the issue.
919 continue; 1019 continue;
920 } 1020 }
@@ -931,7 +1031,7 @@ abstract class Indexer @@ -931,7 +1031,7 @@ abstract class Indexer
931 $extractor->setIndexingStatus(null); 1031 $extractor->setIndexingStatus(null);
932 $extractor->setExtractionStatus(null); 1032 $extractor->setExtractionStatus(null);
933 1033
934 - if ($this->debug) $default->log->debug(sprintf(_kt("Extra Info docid: %d Source File: '%s' Target File: '%s'"),$docId,$sourceFile,$targetFile)); 1034 + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Extra Info docid: %d Source File: '%s' Target File: '%s'"),$docId,$sourceFile,$targetFile), 'debug');
935 1035
936 $this->executeHook($extractor, 'pre_extract'); 1036 $this->executeHook($extractor, 'pre_extract');
937 $this->executeHook($extractor, 'pre_extract', $mimeType); 1037 $this->executeHook($extractor, 'pre_extract', $mimeType);
@@ -952,7 +1052,8 @@ abstract class Indexer @@ -952,7 +1052,8 @@ abstract class Indexer
952 1052
953 if (!$indexStatus) 1053 if (!$indexStatus)
954 { 1054 {
955 - $default->log->error(sprintf(_kt("Problem indexing document %d - indexDocumentAndDiscussion"),$docId)); 1055 + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Problem indexing document %d - indexDocumentAndDiscussion"),$docId), 'error');
  1056 +
956 } 1057 }
957 1058
958 $extractor->setIndexingStatus($indexStatus); 1059 $extractor->setIndexingStatus($indexStatus);
@@ -961,7 +1062,7 @@ abstract class Indexer @@ -961,7 +1062,7 @@ abstract class Indexer
961 { 1062 {
962 if (!$this->filterText($targetFile)) 1063 if (!$this->filterText($targetFile))
963 { 1064 {
964 - $default->log->error(sprintf(_kt("Problem filtering document %d"),$docId)); 1065 + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Problem filtering document %d"),$docId), 'error');
965 } 1066 }
966 else 1067 else
967 { 1068 {
@@ -969,7 +1070,8 @@ abstract class Indexer @@ -969,7 +1070,8 @@ abstract class Indexer
969 1070
970 if (!$indexStatus) 1071 if (!$indexStatus)
971 { 1072 {
972 - $default->log->error(sprintf(_kt("Problem indexing document %d - indexDocument"),$docId)); 1073 + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Problem indexing document %d - indexDocument"),$docId), 'error');
  1074 + $this->logPendingDocumentInfoStatus($docId, '<output>' . $extractor->output . '</output>', 'error');
973 } 1075 }
974 1076
975 $extractor->setIndexingStatus($indexStatus); 1077 $extractor->setIndexingStatus($indexStatus);
@@ -982,7 +1084,7 @@ abstract class Indexer @@ -982,7 +1084,7 @@ abstract class Indexer
982 else 1084 else
983 { 1085 {
984 $extractor->setExtractionStatus(false); 1086 $extractor->setExtractionStatus(false);
985 - $default->log->error(sprintf(_kt("Could not extract contents from document %d"),$docId)); 1087 + $this->logPendingDocumentInfoStatus($docId, sprintf(_kt("Could not extract contents from document %d"),$docId), 'error');
986 } 1088 }
987 1089
988 $this->executeHook($extractor, 'post_extract', $mimeType); 1090 $this->executeHook($extractor, 'post_extract', $mimeType);
sql/mysql/install/structure.sql
@@ -892,6 +892,7 @@ CREATE TABLE `index_files` ( @@ -892,6 +892,7 @@ CREATE TABLE `index_files` (
892 `indexdate` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, 892 `indexdate` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
893 `processdate` datetime default NULL, 893 `processdate` datetime default NULL,
894 `what` char(1) default NULL, 894 `what` char(1) default NULL,
  895 + `status_msg` mediumtext NULL,
895 PRIMARY KEY (`document_id`), 896 PRIMARY KEY (`document_id`),
896 KEY `user_id` (`user_id`), 897 KEY `user_id` (`user_id`),
897 CONSTRAINT `index_files_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, 898 CONSTRAINT `index_files_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
sql/mysql/upgrade/3.5.2/index_file_status_message.sql 0 → 100644
  1 +alter table index_files add status_msg mediumtext;
0 \ No newline at end of file 2 \ No newline at end of file