Commit cb3e2915e64fc61ad62256abdfd52682fbc34a9d

Authored by Megan
1 parent 1513f546

Added debug logging when registering plugins. Added an order by friendly_name fo…

…r viewing the list in manage plugins.

Committed by: Megan Watson
Reviewed by: Kevin Cyster
lib/plugins/plugin.inc.php
@@ -713,6 +713,8 @@ class KTPlugin { @@ -713,6 +713,8 @@ class KTPlugin {
713 $oEntity = KTPluginEntity::getByNamespace($this->sNamespace); 713 $oEntity = KTPluginEntity::getByNamespace($this->sNamespace);
714 $friendly_name = ''; 714 $friendly_name = '';
715 $iOrder = $this->iOrder; 715 $iOrder = $this->iOrder;
  716 + global $default;
  717 +
716 if (!empty($this->sFriendlyName)) { $friendly_name = $this->sFriendlyName; } 718 if (!empty($this->sFriendlyName)) { $friendly_name = $this->sFriendlyName; }
717 if (!PEAR::isError($oEntity)) { 719 if (!PEAR::isError($oEntity)) {
718 720
@@ -724,6 +726,8 @@ class KTPlugin { @@ -724,6 +726,8 @@ class KTPlugin {
724 $iEndVersion = $this->upgradePlugin($oEntity->getVersion()+1, $this->iVersion); 726 $iEndVersion = $this->upgradePlugin($oEntity->getVersion()+1, $this->iVersion);
725 727
726 if ($iEndVersion != $this->iVersion) { 728 if ($iEndVersion != $this->iVersion) {
  729 + $default->log->error("Plugin register: {$friendly_name}, namespace: {$this->sNamespace} failed to upgrade properly. Original version: {$oEntity->getVersion()}, upgrading to version {$this->iVersion}, current version {$iEndVersion}");
  730 +
727 // we obviously failed. 731 // we obviously failed.
728 $oEntity->updateFromArray(array( 732 $oEntity->updateFromArray(array(
729 'path' => $this->stripKtDir($this->sFilename), 733 'path' => $this->stripKtDir($this->sFilename),
@@ -735,6 +739,8 @@ class KTPlugin { @@ -735,6 +739,8 @@ class KTPlugin {
735 // FIXME we -really- need to raise an error here, somehow. 739 // FIXME we -really- need to raise an error here, somehow.
736 740
737 } else { 741 } else {
  742 + $default->log->debug("Plugin register: {$friendly_name}, namespace: {$this->sNamespace} upgraded. Original version: {$oEntity->getVersion()}, upgrading to version {$this->iVersion}, current version {$iEndVersion}");
  743 +
738 $oEntity->updateFromArray(array( 744 $oEntity->updateFromArray(array(
739 'path' => $this->stripKtDir($this->sFilename), 745 'path' => $this->stripKtDir($this->sFilename),
740 'version' => $this->iVersion, 746 'version' => $this->iVersion,
@@ -750,6 +756,7 @@ class KTPlugin { @@ -750,6 +756,7 @@ class KTPlugin {
750 return $oEntity; 756 return $oEntity;
751 } 757 }
752 if(PEAR::isError($oEntity) && !is_a($oEntity, 'KTEntityNoObjects')){ 758 if(PEAR::isError($oEntity) && !is_a($oEntity, 'KTEntityNoObjects')){
  759 + $default->log->error("Plugin register: the plugin {$friendly_name}, namespace: {$this->sNamespace} returned an error: ".$oEntity->getMessage());
753 return $oEntity; 760 return $oEntity;
754 } 761 }
755 762
@@ -759,6 +766,8 @@ class KTPlugin { @@ -759,6 +766,8 @@ class KTPlugin {
759 $disabled = 0; 766 $disabled = 0;
760 } 767 }
761 768
  769 + $default->log->debug("Plugin register: creating {$friendly_name}, namespace: {$this->sNamespace}");
  770 +
762 $iEndVersion = $this->upgradePlugin(0, $this->iVersion); 771 $iEndVersion = $this->upgradePlugin(0, $this->iVersion);
763 $oEntity = KTPluginEntity::createFromArray(array( 772 $oEntity = KTPluginEntity::createFromArray(array(
764 'namespace' => $this->sNamespace, 773 'namespace' => $this->sNamespace,
@@ -771,6 +780,7 @@ class KTPlugin { @@ -771,6 +780,7 @@ class KTPlugin {
771 )); 780 ));
772 781
773 if (PEAR::isError($oEntity)) { 782 if (PEAR::isError($oEntity)) {
  783 + $default->log->error("Plugin register: the plugin, {$friendly_name}, namespace: {$this->sNamespace} returned an error on creation: ".$oEntity->getMessage());
774 return $oEntity; 784 return $oEntity;
775 } 785 }
776 786
lib/plugins/pluginentity.inc.php
@@ -6,31 +6,31 @@ @@ -6,31 +6,31 @@
6 * Document Management Made Simple 6 * Document Management Made Simple
7 * Copyright (C) 2008, 2009 KnowledgeTree Inc. 7 * Copyright (C) 2008, 2009 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 *
@@ -111,7 +111,7 @@ class KTPluginEntity extends KTEntity { @@ -111,7 +111,7 @@ class KTPluginEntity extends KTEntity {
111 111
112 // STATIC 112 // STATIC
113 function &getAvailable() { 113 function &getAvailable() {
114 - $aOptions = array('multi' => true); 114 + $aOptions = array('multi' => true, 'orderby' => 'friendly_name');
115 return KTEntityUtil::getBy('KTPluginEntity', 'unavailable', false, $aOptions); 115 return KTEntityUtil::getBy('KTPluginEntity', 'unavailable', false, $aOptions);
116 } 116 }
117 117