Commit 78e85606bfe6d1a9d29f432c562452a50228bae4
1 parent
548c0edb
KTS-673
"The search algorithm needs some work" Updated. Associate mime types with extractors Committed By: Conrad Vermeulen Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7347 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
52 additions
and
44 deletions
lib/upgrades/UpgradeFunctions.inc.php
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | * License Version 1.1.2 ("License"); You may not use this file except in |
| 7 | 7 | * compliance with the License. You may obtain a copy of the License at |
| 8 | 8 | * http://www.knowledgetree.com/KPL |
| 9 | - * | |
| 9 | + * | |
| 10 | 10 | * Software distributed under the License is distributed on an "AS IS" |
| 11 | 11 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. |
| 12 | 12 | * See the License for the specific language governing rights and |
| ... | ... | @@ -17,9 +17,9 @@ |
| 17 | 17 | * (ii) the KnowledgeTree copyright notice |
| 18 | 18 | * in the same form as they appear in the distribution. See the License for |
| 19 | 19 | * requirements. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * The Original Code is: KnowledgeTree Open Source |
| 22 | - * | |
| 22 | + * | |
| 23 | 23 | * The Initial Developer of the Original Code is The Jam Warehouse Software |
| 24 | 24 | * (Pty) Ltd, trading as KnowledgeTree. |
| 25 | 25 | * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright |
| ... | ... | @@ -31,22 +31,22 @@ |
| 31 | 31 | |
| 32 | 32 | class UpgradeFunctions { |
| 33 | 33 | var $upgrades = array( |
| 34 | - "2.0.0" => array("setPermissionFolder"), | |
| 35 | - "2.0.6" => array("addTemplateMimeTypes"), | |
| 36 | - "2.0.8" => array("setPermissionObject"), | |
| 37 | - "2.99.1" => array("createFieldSets"), | |
| 38 | - "2.99.7" => array("normaliseDocuments", "applyDiscussionUpgrade"), | |
| 39 | - "2.99.8" => array("fixUnits"), | |
| 40 | - "2.99.9" => array("createLdapAuthenticationProvider", "createSecurityDeletePermissions"), | |
| 41 | - "3.0.1.3" => array('addTransactionTypes3013'), | |
| 42 | - "3.0.1.4" => array('createWorkflowPermission'), | |
| 43 | - "3.0.2" => array("fixDocumentRoleAllocation"), | |
| 44 | - "3.0.3.2" => array("createFolderDetailsPermission"), | |
| 45 | - "3.0.3.3" => array("generateWorkflowTriggers"), | |
| 46 | - "3.0.3.7" => array("rebuildAllPermissions"), | |
| 47 | - "3.1.5" => array("upgradeSavedSearches"), | |
| 48 | - "3.1.6.3" => array("cleanupGroupMembership"), | |
| 49 | - "3.5.0" => array("cleanupOldKTAdminVersionNotifier"), | |
| 34 | + '2.0.0' => array('setPermissionFolder'), | |
| 35 | + '2.0.6' => array('addTemplateMimeTypes'), | |
| 36 | + '2.0.8' => array('setPermissionObject'), | |
| 37 | + '2.99.1' => array('createFieldSets'), | |
| 38 | + '2.99.7' => array('normaliseDocuments', 'applyDiscussionUpgrade'), | |
| 39 | + '2.99.8' => array('fixUnits'), | |
| 40 | + '2.99.9' => array('createLdapAuthenticationProvider', 'createSecurityDeletePermissions'), | |
| 41 | + '3.0.1.3' => array('addTransactionTypes3013'), | |
| 42 | + '3.0.1.4' => array('createWorkflowPermission'), | |
| 43 | + '3.0.2' => array('fixDocumentRoleAllocation'), | |
| 44 | + '3.0.3.2' => array('createFolderDetailsPermission'), | |
| 45 | + '3.0.3.3' => array('generateWorkflowTriggers'), | |
| 46 | + '3.0.3.7' => array('rebuildAllPermissions'), | |
| 47 | + '3.1.5' => array('upgradeSavedSearches'), | |
| 48 | + '3.1.6.3' => array('cleanupGroupMembership'), | |
| 49 | + '3.5.0' => array('cleanupOldKTAdminVersionNotifier', 'registerExtractorMapping'), | |
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | 52 | var $descriptions = array( |
| ... | ... | @@ -67,6 +67,7 @@ class UpgradeFunctions { |
| 67 | 67 | 'upgradeSavedSearches' => 'Upgrade saved searches to use namespaces instead of integer ids', |
| 68 | 68 | 'cleanupGroupMembership' => 'Cleanup any old references to missing groups, etc.', |
| 69 | 69 | 'cleanupOldKTAdminVersionNotifier' => 'Cleanup any old files from the old KTAdminVersionNotifier', |
| 70 | + 'registerExtractorMapping' => 'Register document text extractors with the appropriate mime types' | |
| 70 | 71 | ); |
| 71 | 72 | var $phases = array( |
| 72 | 73 | "setPermissionFolder" => 1, |
| ... | ... | @@ -702,14 +703,14 @@ class UpgradeFunctions { |
| 702 | 703 | DBUtil::runQuery("UPDATE $sFolderTable SET permission_lookup_id = NULL"); |
| 703 | 704 | DBUtil::commit(); |
| 704 | 705 | } |
| 705 | - // }}} | |
| 706 | + // }}} | |
| 706 | 707 | |
| 707 | - // {{{ generateWorkflowTriggers | |
| 708 | + // {{{ generateWorkflowTriggers | |
| 708 | 709 | function generateWorkflowTriggers() { |
| 709 | 710 | |
| 710 | - require_once(KT_LIB_DIR . '/workflow/workflowutil.inc.php'); | |
| 711 | + require_once(KT_LIB_DIR . '/workflow/workflowutil.inc.php'); | |
| 711 | 712 | |
| 712 | - // get all the transitions, and add a trigger to the util with the appropriate settings. | |
| 713 | + // get all the transitions, and add a trigger to the util with the appropriate settings. | |
| 713 | 714 | $KTWFTriggerReg =& KTWorkflowTriggerRegistry::getSingleton(); |
| 714 | 715 | $aTransitions = KTWorkflowTransition::getList(); |
| 715 | 716 | foreach ($aTransitions as $oTransition) { |
| ... | ... | @@ -718,55 +719,55 @@ class UpgradeFunctions { |
| 718 | 719 | $iGuardPerm = $oTransition->getGuardPermissionId(); |
| 719 | 720 | if (!is_null($iGuardPerm)) { |
| 720 | 721 | |
| 721 | - $sNamespace = 'ktcore.workflowtriggers.permissionguard'; | |
| 722 | + $sNamespace = 'ktcore.workflowtriggers.permissionguard'; | |
| 722 | 723 | $oPerm = KTPermission::get($iGuardPerm); |
| 723 | - $oTrigger = $KTWFTriggerReg->getWorkflowTrigger($sNamespace); | |
| 724 | + $oTrigger = $KTWFTriggerReg->getWorkflowTrigger($sNamespace); | |
| 724 | 725 | $oTriggerConfig = KTWorkflowTriggerInstance::createFromArray(array( |
| 725 | 726 | 'transitionid' => KTUtil::getId($oTransition), |
| 726 | 727 | 'namespace' => $sNamespace, |
| 727 | 728 | 'config' => array('perms' => array($oPerm->getName())), |
| 728 | - )); | |
| 729 | + )); | |
| 729 | 730 | |
| 730 | 731 | } |
| 731 | 732 | // guard group |
| 732 | 733 | $iGuardGroup = $oTransition->getGuardGroupId(); |
| 733 | 734 | if (!is_null($iGuardGroup)) { |
| 734 | 735 | |
| 735 | - $sNamespace = 'ktcore.workflowtriggers.groupguard'; | |
| 736 | - $oTrigger = $KTWFTriggerReg->getWorkflowTrigger($sNamespace); | |
| 736 | + $sNamespace = 'ktcore.workflowtriggers.groupguard'; | |
| 737 | + $oTrigger = $KTWFTriggerReg->getWorkflowTrigger($sNamespace); | |
| 737 | 738 | $oTriggerConfig = KTWorkflowTriggerInstance::createFromArray(array( |
| 738 | 739 | 'transitionid' => KTUtil::getId($oTransition), |
| 739 | 740 | 'namespace' => $sNamespace, |
| 740 | 741 | 'config' => array('group_id' => $iGuardGroup), |
| 741 | - )); | |
| 742 | + )); | |
| 742 | 743 | |
| 743 | - } | |
| 744 | - // guard role | |
| 744 | + } | |
| 745 | + // guard role | |
| 745 | 746 | $iGuardRole = $oTransition->getGuardRoleId(); |
| 746 | 747 | if (!is_null($iGuardRole)) { |
| 747 | 748 | |
| 748 | - $sNamespace = 'ktcore.workflowtriggers.roleguard'; | |
| 749 | - $oTrigger = $KTWFTriggerReg->getWorkflowTrigger($sNamespace); | |
| 749 | + $sNamespace = 'ktcore.workflowtriggers.roleguard'; | |
| 750 | + $oTrigger = $KTWFTriggerReg->getWorkflowTrigger($sNamespace); | |
| 750 | 751 | $oTriggerConfig = KTWorkflowTriggerInstance::createFromArray(array( |
| 751 | 752 | 'transitionid' => KTUtil::getId($oTransition), |
| 752 | 753 | 'namespace' => $sNamespace, |
| 753 | 754 | 'config' => array('role_id' => $iGuardRole), |
| 754 | - )); | |
| 755 | + )); | |
| 755 | 756 | |
| 756 | 757 | } |
| 757 | 758 | // guard condition |
| 758 | 759 | $iGuardCondition = $oTransition->getGuardConditionId(); |
| 759 | 760 | if (!is_null($iGuardCondition)) { |
| 760 | 761 | |
| 761 | - $sNamespace = 'ktcore.workflowtriggers.conditionguard'; | |
| 762 | - $oTrigger = $KTWFTriggerReg->getWorkflowTrigger($sNamespace); | |
| 762 | + $sNamespace = 'ktcore.workflowtriggers.conditionguard'; | |
| 763 | + $oTrigger = $KTWFTriggerReg->getWorkflowTrigger($sNamespace); | |
| 763 | 764 | $oTriggerConfig = KTWorkflowTriggerInstance::createFromArray(array( |
| 764 | 765 | 'transitionid' => KTUtil::getId($oTransition), |
| 765 | 766 | 'namespace' => $sNamespace, |
| 766 | 767 | 'config' => array('condition_id' => $iGuardCondition), |
| 767 | - )); | |
| 768 | + )); | |
| 768 | 769 | |
| 769 | - } | |
| 770 | + } | |
| 770 | 771 | } |
| 771 | 772 | |
| 772 | 773 | } |
| ... | ... | @@ -856,13 +857,13 @@ class UpgradeFunctions { |
| 856 | 857 | return $res; |
| 857 | 858 | } else { |
| 858 | 859 | $bad_group_links = kt_array_merge($bad_group_links, $res); |
| 859 | - } | |
| 860 | + } | |
| 860 | 861 | |
| 861 | 862 | foreach ($bad_group_links as $link_id) { |
| 862 | 863 | $res = DBUtil::runQuery(array("DELETE FROM groups_groups_link WHERE id = ?", $link_id)); |
| 863 | 864 | if (PEAR::isError($res)) { |
| 864 | 865 | return $res; |
| 865 | - } | |
| 866 | + } | |
| 866 | 867 | } |
| 867 | 868 | |
| 868 | 869 | $res = DBUtil::getResultArrayKey(array($group_query, null), 'link_id'); |
| ... | ... | @@ -875,7 +876,7 @@ class UpgradeFunctions { |
| 875 | 876 | $res = DBUtil::getResultArrayKey(array($user_query, null), 'link_id'); |
| 876 | 877 | if (PEAR::isError($res)) { |
| 877 | 878 | return $res; |
| 878 | - } else { | |
| 879 | + } else { | |
| 879 | 880 | $bad_user_links = kt_array_merge($bad_user_links, $res); |
| 880 | 881 | } |
| 881 | 882 | |
| ... | ... | @@ -883,12 +884,12 @@ class UpgradeFunctions { |
| 883 | 884 | $res = DBUtil::runQuery(array("DELETE FROM users_groups_link WHERE id = ?", $link_id)); |
| 884 | 885 | if (PEAR::isError($res)) { |
| 885 | 886 | return $res; |
| 886 | - } | |
| 887 | + } | |
| 887 | 888 | } |
| 888 | 889 | |
| 889 | 890 | return true; |
| 890 | 891 | |
| 891 | - } | |
| 892 | + } | |
| 892 | 893 | // }}} |
| 893 | 894 | |
| 894 | 895 | // {{{ cleanupOldKTAdminVersionNotifier |
| ... | ... | @@ -899,8 +900,15 @@ class UpgradeFunctions { |
| 899 | 900 | if(file_exists($oldFile)) return unlink($oldFile); |
| 900 | 901 | |
| 901 | 902 | return true; |
| 902 | - } | |
| 903 | + } | |
| 903 | 904 | // }}} |
| 905 | + | |
| 906 | + function registerExtractorMapping() | |
| 907 | + { | |
| 908 | + $indexer = Indexer::get(); | |
| 909 | + $indexer->registerTypes(); | |
| 910 | + } | |
| 911 | + | |
| 904 | 912 | } |
| 905 | 913 | |
| 906 | 914 | ?> | ... | ... |