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 685 function register() {
686 686 $oEntity = KTPluginEntity::getByNamespace($this->sNamespace);
687 687 $friendly_name = '';
  688 + $iOrder = $this->iOrder;
688 689 if (!empty($this->sFriendlyName)) { $friendly_name = $this->sFriendlyName; }
689 690 if (!PEAR::isError($oEntity)) {
690 691  
... ... @@ -695,33 +696,38 @@ class KTPlugin {
695 696 // remember to -start- the upgrade from the "next" version
696 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 702 'path' => $this->stripKtDir($this->sFilename),
702 703 'version' => $iEndVersion, // as far as we got.
703 704 'disabled' => true,
704 705 'unavailable' => false,
705 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 712 'path' => $this->stripKtDir($this->sFilename),
712 713 'version' => $this->iVersion,
713 714 'unavailable' => false,
714 715 'friendlyname' => $friendly_name,
715   - ));
  716 + 'orderby' => $iOrder,
  717 + ));
716 718  
717   - }
  719 + }
718 720 }
719 721 /* ** Quick fix for optimisation. Reread must run plugin setup. ** */
720 722 $this->setup();
721 723 return $oEntity;
722 724 }
723 725 $disabled = 1;
724   - if ($this->bAlwaysInclude || $this->autoRegister) { $disabled = 0; }
  726 +
  727 + if ($this->bAlwaysInclude || $this->autoRegister) {
  728 + $disabled = 0;
  729 + }
  730 +
725 731 $iEndVersion = $this->upgradePlugin(0, $this->iVersion);
726 732 $oEntity = KTPluginEntity::createFromArray(array(
727 733 'namespace' => $this->sNamespace,
... ... @@ -730,7 +736,9 @@ class KTPlugin {
730 736 'disabled' => $disabled,
731 737 'unavailable' => false,
732 738 'friendlyname' => $friendly_name,
733   - ));
  739 + 'orderby' => $iOrder,
  740 + ));
  741 +
734 742 if (PEAR::isError($oEntity)) {
735 743 return $oEntity;
736 744 }
... ...