From: <gem...@li...> - 2011-11-04 14:01:24
|
Revision: 185 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=185&view=rev Author: mennodekker Date: 2011-11-04 14:01:18 +0000 (Fri, 04 Nov 2011) Log Message: ----------- Minor fixes for #34 Modified Paths: -------------- trunk/library/classes/Gems/UpgradesAbstract.php Modified: trunk/library/classes/Gems/UpgradesAbstract.php =================================================================== --- trunk/library/classes/Gems/UpgradesAbstract.php 2011-11-04 12:49:12 UTC (rev 184) +++ trunk/library/classes/Gems/UpgradesAbstract.php 2011-11-04 14:01:18 UTC (rev 185) @@ -145,7 +145,7 @@ public function execute($context, $to = null, $from = null) { if(is_null($to)) { - $to = count($this->_upgradeStack[$context]); + $to = $this->getMaxLevel($context); } if(is_null($from)) { $from = $this->getLevel($context); @@ -214,7 +214,24 @@ return $this->_messages; } - public function getUpgrades($requestedContext = null) + /** + * Retrieve the upgrades for a certain context, will return an empty array when nothing present. + * + * @param string $context + * @return array + */ + public function getUpgrades($context = null) { + if (! $context) { + $context = $this->getContext(); + } + + if (isset($this->_upgradeStack[$context])) { + return $this->_upgradeStack[$context]; + } + return array(); + } + + public function getUpgradesInfo($requestedContext = null) { $result = array(); foreach($this->_upgradeStack as $context => $content) { @@ -237,7 +254,7 @@ public function register($callback, $index = null, $context = null) { if (is_string($callback)) { - $callback = array($this, $callback); + $callback = array(get_class($this), $callback); } if (is_callable($callback)) { if (! $context) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |