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 713 $oEntity = KTPluginEntity::getByNamespace($this->sNamespace);
714 714 $friendly_name = '';
715 715 $iOrder = $this->iOrder;
  716 + global $default;
  717 +
716 718 if (!empty($this->sFriendlyName)) { $friendly_name = $this->sFriendlyName; }
717 719 if (!PEAR::isError($oEntity)) {
718 720  
... ... @@ -724,6 +726,8 @@ class KTPlugin {
724 726 $iEndVersion = $this->upgradePlugin($oEntity->getVersion()+1, $this->iVersion);
725 727  
726 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 731 // we obviously failed.
728 732 $oEntity->updateFromArray(array(
729 733 'path' => $this->stripKtDir($this->sFilename),
... ... @@ -735,6 +739,8 @@ class KTPlugin {
735 739 // FIXME we -really- need to raise an error here, somehow.
736 740  
737 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 744 $oEntity->updateFromArray(array(
739 745 'path' => $this->stripKtDir($this->sFilename),
740 746 'version' => $this->iVersion,
... ... @@ -750,6 +756,7 @@ class KTPlugin {
750 756 return $oEntity;
751 757 }
752 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 760 return $oEntity;
754 761 }
755 762  
... ... @@ -759,6 +766,8 @@ class KTPlugin {
759 766 $disabled = 0;
760 767 }
761 768  
  769 + $default->log->debug("Plugin register: creating {$friendly_name}, namespace: {$this->sNamespace}");
  770 +
762 771 $iEndVersion = $this->upgradePlugin(0, $this->iVersion);
763 772 $oEntity = KTPluginEntity::createFromArray(array(
764 773 'namespace' => $this->sNamespace,
... ... @@ -771,6 +780,7 @@ class KTPlugin {
771 780 ));
772 781  
773 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 784 return $oEntity;
775 785 }
776 786  
... ...
lib/plugins/pluginentity.inc.php
... ... @@ -6,31 +6,31 @@
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
8 8 * Portions copyright The Jam Warehouse Software (Pty) Limited
9   - *
  9 + *
10 10 * This program is free software; you can redistribute it and/or modify it under
11 11 * the terms of the GNU General Public License version 3 as published by the
12 12 * Free Software Foundation.
13   - *
  13 + *
14 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 17 * details.
18   - *
  18 + *
19 19 * You should have received a copy of the GNU General Public License
20 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 23 * California 94120-7775, or email info@knowledgetree.com.
24   - *
  24 + *
25 25 * The interactive user interfaces in modified source and object code versions
26 26 * of this program must display Appropriate Legal Notices, as required under
27 27 * Section 5 of the GNU General Public License version 3.
28   - *
  28 + *
29 29 * In accordance with Section 7(b) of the GNU General Public License version 3,
30 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 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 34 * copyright notice.
35 35 * Contributor( s): ______________________________________
36 36 *
... ... @@ -111,7 +111,7 @@ class KTPluginEntity extends KTEntity {
111 111  
112 112 // STATIC
113 113 function &getAvailable() {
114   - $aOptions = array('multi' => true);
  114 + $aOptions = array('multi' => true, 'orderby' => 'friendly_name');
115 115 return KTEntityUtil::getBy('KTPluginEntity', 'unavailable', false, $aOptions);
116 116 }
117 117  
... ...