Commit 98a31d10ef589a85155181576f5d3587d09fbf59
1 parent
1a2abfaa
Merged in from trunk...
KTS-3335 "KTPluginRegistry MUST respect the plugins order when registering plugins" Fixed. Plugins are now registered in the order they're loaded. Put the registration into a transaction. Committed by: Megan Watson Reviewed by: Jonathan Byrne git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.2c-Release-Branch@8521 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
15 additions
and
5 deletions
lib/plugins/pluginregistry.inc.php
| @@ -85,9 +85,16 @@ class KTPluginRegistry { | @@ -85,9 +85,16 @@ class KTPluginRegistry { | ||
| 85 | function &getPlugins() { | 85 | function &getPlugins() { |
| 86 | $aRet = array(); | 86 | $aRet = array(); |
| 87 | foreach (array_keys($this->_aPluginDetails) as $sPluginName) { | 87 | foreach (array_keys($this->_aPluginDetails) as $sPluginName) { |
| 88 | - $aRet[] =& $this->getPlugin($sPluginName); | 88 | + $oPlugin =& $this->getPlugin($sPluginName); |
| 89 | + $aRet[(int)$oPlugin->iOrder][] =& $oPlugin; | ||
| 89 | } | 90 | } |
| 90 | - return $aRet; | 91 | + ksort($aRet); |
| 92 | + $aRes = array(); | ||
| 93 | + foreach($aRet as $iOrder => $aPlugins) { | ||
| 94 | + foreach(array_keys($aPlugins) as $iPlugin) { | ||
| 95 | + $aRes[] =& $aRet[$iOrder][$iPlugin]; | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + return $aRes; | ||
| 91 | } | 99 | } |
| 92 | -} | ||
| 93 | - | 100 | +} |
| 94 | \ No newline at end of file | 101 | \ No newline at end of file |
lib/plugins/pluginutil.inc.php
| @@ -180,7 +180,9 @@ class KTPluginUtil { | @@ -180,7 +180,9 @@ class KTPluginUtil { | ||
| 180 | 180 | ||
| 181 | // Check that there are plugins and if not, register them | 181 | // Check that there are plugins and if not, register them |
| 182 | if (empty($aPluginHelpers)) { | 182 | if (empty($aPluginHelpers)) { |
| 183 | + DBUtil::startTransaction(); | ||
| 183 | KTPluginUtil::registerPlugins(); | 184 | KTPluginUtil::registerPlugins(); |
| 185 | + DBUtil::commit(); | ||
| 184 | 186 | ||
| 185 | $query = "SELECT h.classname, h.pathname, h.plugin FROM plugin_helper h | 187 | $query = "SELECT h.classname, h.pathname, h.plugin FROM plugin_helper h |
| 186 | INNER JOIN plugins p ON (p.namespace = h.plugin) | 188 | INNER JOIN plugins p ON (p.namespace = h.plugin) |
| @@ -483,7 +485,8 @@ class KTPluginUtil { | @@ -483,7 +485,8 @@ class KTPluginUtil { | ||
| 483 | } | 485 | } |
| 484 | } | 486 | } |
| 485 | $oRegistry =& KTPluginRegistry::getSingleton(); | 487 | $oRegistry =& KTPluginRegistry::getSingleton(); |
| 486 | - foreach ($oRegistry->getPlugins() as $oPlugin) { | 488 | + $aRegistryList = $oRegistry->getPlugins(); |
| 489 | + foreach ($aRegistryList as $oPlugin) { | ||
| 487 | $res = $oPlugin->register(); | 490 | $res = $oPlugin->register(); |
| 488 | if (PEAR::isError($res)) { | 491 | if (PEAR::isError($res)) { |
| 489 | var_dump($res); | 492 | var_dump($res); |