Commit 330fdac70b36d686aa72adb6ed28dc738a62bf41

Authored by kevin_fourie
1 parent a39e8c53

Merged in from STABLE trunk...

KTS-3625
"Fatal PEAR_error when clicking the 'Update' for the plugins after 346OSS to 353 OSS upgrade."
Fixed. Added check on tagcloud plugin before calling getDisabled()

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.3-Release-Branch@9179 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 31 additions and 31 deletions
plugins/ktcore/admin/plugins.php
@@ -6,31 +6,31 @@ @@ -6,31 +6,31 @@
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2008 KnowledgeTree Inc. 7 * Copyright (C) 2008 KnowledgeTree Inc.
8 * Portions copyright The Jam Warehouse Software (Pty) Limited 8 * Portions copyright The Jam Warehouse Software (Pty) Limited
9 - * 9 + *
10 * This program is free software; you can redistribute it and/or modify it under 10 * This program is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU General Public License version 3 as published by the 11 * the terms of the GNU General Public License version 3 as published by the
12 * Free Software Foundation. 12 * Free Software Foundation.
13 - * 13 + *
14 * This program is distributed in the hope that it will be useful, but WITHOUT 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * details. 17 * details.
18 - * 18 + *
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 - *  
22 - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, 21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23 * California 94120-7775, or email info@knowledgetree.com. 23 * California 94120-7775, or email info@knowledgetree.com.
24 - * 24 + *
25 * The interactive user interfaces in modified source and object code versions 25 * The interactive user interfaces in modified source and object code versions
26 * of this program must display Appropriate Legal Notices, as required under 26 * of this program must display Appropriate Legal Notices, as required under
27 * Section 5 of the GNU General Public License version 3. 27 * Section 5 of the GNU General Public License version 3.
28 - * 28 + *
29 * In accordance with Section 7(b) of the GNU General Public License version 3, 29 * In accordance with Section 7(b) of the GNU General Public License version 3,
30 * these Appropriate Legal Notices must retain the display of the "Powered by 30 * these Appropriate Legal Notices must retain the display of the "Powered by
31 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33 - * must display the words "Powered by KnowledgeTree" and retain the original 33 + * must display the words "Powered by KnowledgeTree" and retain the original
34 * copyright notice. 34 * copyright notice.
35 * Contributor( s): ______________________________________ 35 * Contributor( s): ______________________________________
36 * 36 *
@@ -121,31 +121,31 @@ class KTPluginDispatcher extends KTAdminDispatcher { @@ -121,31 +121,31 @@ class KTPluginDispatcher extends KTAdminDispatcher {
121 } 121 }
122 KTPluginEntity::clearAllCaches(); 122 KTPluginEntity::clearAllCaches();
123 123
  124 + // FIXME!!! Plugin manager needs to be updated to deal with this situation. This code should be in the plugin.
124 //enabling or disabling Tag fieldset depending on whether tag cloud plugin is enabled or disabled. 125 //enabling or disabling Tag fieldset depending on whether tag cloud plugin is enabled or disabled.
125 //Get tag cloud object 126 //Get tag cloud object
126 $oTagClouPlugin = KTPluginEntity::getByNamespace('ktcore.tagcloud.plugin'); 127 $oTagClouPlugin = KTPluginEntity::getByNamespace('ktcore.tagcloud.plugin');
127 - if($oTagClouPlugin->getDisabled() == '1')  
128 - {  
129 - //disable tag fieldset  
130 - $aFV = array(  
131 - 'disabled' => true,  
132 - );  
133 - $aWFV = array(  
134 - 'namespace' => 'tagcloud'  
135 - );  
136 - $res = DBUtil::whereUpdate('fieldsets', $aFV, $aWFV);  
137 - }  
138 - //if Tag Cloud plugin disabled  
139 - if($oTagClouPlugin->getDisabled() == '0')  
140 - {  
141 - //enable tag fieldset  
142 - $aFV = array(  
143 - 'disabled' => false,  
144 - );  
145 - $aWFV = array(  
146 - 'namespace' => 'tagcloud'  
147 - );  
148 - $res = DBUtil::whereUpdate('fieldsets', $aFV, $aWFV); 128 + if(!PEAR::isError($oTagClouPlugin) && !is_a($oTagClouPlugin, 'KTEntityNoObjects') && !is_null($oTagClouPlugin)){
  129 + if($oTagClouPlugin->getDisabled() == '1')
  130 + {
  131 + //disable tag fieldset
  132 + $aFV = array(
  133 + 'disabled' => true,
  134 + );
  135 + $aWFV = array(
  136 + 'namespace' => 'tagcloud'
  137 + );
  138 + $res = DBUtil::whereUpdate('fieldsets', $aFV, $aWFV);
  139 + } else {
  140 + //enable tag fieldset
  141 + $aFV = array(
  142 + 'disabled' => false,
  143 + );
  144 + $aWFV = array(
  145 + 'namespace' => 'tagcloud'
  146 + );
  147 + $res = DBUtil::whereUpdate('fieldsets', $aFV, $aWFV);
  148 + }
149 } 149 }
150 150
151 $this->successRedirectToMain(_kt('Plugins updated')); 151 $this->successRedirectToMain(_kt('Plugins updated'));