Commit 88d6505cf12cff2b71fb38f9e0eeff3dd5373612

Authored by kevin_fourie
1 parent 42812154

Merged in from DEV trunk...

KTC-396
"On registering plugins the order should be registered"
Fixed. Added the order into the createFromArray().

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8140 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 19 additions and 11 deletions
lib/plugins/plugin.inc.php
@@ -685,6 +685,7 @@ class KTPlugin { @@ -685,6 +685,7 @@ class KTPlugin {
685 function register() { 685 function register() {
686 $oEntity = KTPluginEntity::getByNamespace($this->sNamespace); 686 $oEntity = KTPluginEntity::getByNamespace($this->sNamespace);
687 $friendly_name = ''; 687 $friendly_name = '';
  688 + $iOrder = $this->iOrder;
688 if (!empty($this->sFriendlyName)) { $friendly_name = $this->sFriendlyName; } 689 if (!empty($this->sFriendlyName)) { $friendly_name = $this->sFriendlyName; }
689 if (!PEAR::isError($oEntity)) { 690 if (!PEAR::isError($oEntity)) {
690 691
@@ -695,33 +696,38 @@ class KTPlugin { @@ -695,33 +696,38 @@ class KTPlugin {
695 // remember to -start- the upgrade from the "next" version 696 // remember to -start- the upgrade from the "next" version
696 $iEndVersion = $this->upgradePlugin($oEntity->getVersion()+1, $this->iVersion); 697 $iEndVersion = $this->upgradePlugin($oEntity->getVersion()+1, $this->iVersion);
697 698
698 - if ($iEndVersion != $this->iVersion) {  
699 - // we obviously failed.  
700 - $oEntity->updateFromArray(array( 699 + if ($iEndVersion != $this->iVersion) {
  700 + // we obviously failed.
  701 + $oEntity->updateFromArray(array(
701 'path' => $this->stripKtDir($this->sFilename), 702 'path' => $this->stripKtDir($this->sFilename),
702 'version' => $iEndVersion, // as far as we got. 703 'version' => $iEndVersion, // as far as we got.
703 'disabled' => true, 704 'disabled' => true,
704 'unavailable' => false, 705 'unavailable' => false,
705 'friendlyname' => $friendly_name, 706 'friendlyname' => $friendly_name,
706 - ));  
707 - // FIXME we -really- need to raise an error here, somehow. 707 + ));
  708 + // FIXME we -really- need to raise an error here, somehow.
708 709
709 - } else {  
710 - $oEntity->updateFromArray(array( 710 + } else {
  711 + $oEntity->updateFromArray(array(
711 'path' => $this->stripKtDir($this->sFilename), 712 'path' => $this->stripKtDir($this->sFilename),
712 'version' => $this->iVersion, 713 'version' => $this->iVersion,
713 'unavailable' => false, 714 'unavailable' => false,
714 'friendlyname' => $friendly_name, 715 'friendlyname' => $friendly_name,
715 - )); 716 + 'orderby' => $iOrder,
  717 + ));
716 718
717 - } 719 + }
718 } 720 }
719 /* ** Quick fix for optimisation. Reread must run plugin setup. ** */ 721 /* ** Quick fix for optimisation. Reread must run plugin setup. ** */
720 $this->setup(); 722 $this->setup();
721 return $oEntity; 723 return $oEntity;
722 } 724 }
723 $disabled = 1; 725 $disabled = 1;
724 - if ($this->bAlwaysInclude || $this->autoRegister) { $disabled = 0; } 726 +
  727 + if ($this->bAlwaysInclude || $this->autoRegister) {
  728 + $disabled = 0;
  729 + }
  730 +
725 $iEndVersion = $this->upgradePlugin(0, $this->iVersion); 731 $iEndVersion = $this->upgradePlugin(0, $this->iVersion);
726 $oEntity = KTPluginEntity::createFromArray(array( 732 $oEntity = KTPluginEntity::createFromArray(array(
727 'namespace' => $this->sNamespace, 733 'namespace' => $this->sNamespace,
@@ -730,7 +736,9 @@ class KTPlugin { @@ -730,7 +736,9 @@ class KTPlugin {
730 'disabled' => $disabled, 736 'disabled' => $disabled,
731 'unavailable' => false, 737 'unavailable' => false,
732 'friendlyname' => $friendly_name, 738 'friendlyname' => $friendly_name,
733 - )); 739 + 'orderby' => $iOrder,
  740 + ));
  741 +
734 if (PEAR::isError($oEntity)) { 742 if (PEAR::isError($oEntity)) {
735 return $oEntity; 743 return $oEntity;
736 } 744 }