Permalink
Browse files

Speed up second registry startup by cloning detectedPlugins from empt…

…y instance.
  • Loading branch information...
1 parent 362f7f8 commit 1e6cc4086a8d0a63f36b9803f5d23c4fcf9de1d8 @cdujeu cdujeu committed Jun 17, 2016
Showing with 17 additions and 1 deletion.
  1. +17 −1 core/src/core/src/pydio/Core/PluginFramework/PluginsService.php
@@ -186,7 +186,8 @@ public static function getInstance($ctx = null)
self::$instances[$identifier] = $pServ = new $c($ctx);
if(!$ctx->isEmpty()) {
$emptyInstance = self::getInstance(Context::contextWithObjects(null, null));
- $pServ->getDetectedPlugins();
+ //$pServ->getDetectedPlugins();
+ $pServ->cloneDetectedPluginsFromCoreInstance($emptyInstance);
$pServ->copyCorePluginFromService($emptyInstance, "conf");
$pServ->copyCorePluginFromService($emptyInstance, "cache");
$pServ->copyCorePluginFromService($emptyInstance, "auth");
@@ -789,6 +790,21 @@ public function getDetectedPlugins($confPlugin = null, $cachePlugin = null)
return $this->detectedPlugins;
}
+ /**
+ * @param $emptyInstance PluginsService
+ */
+ public function cloneDetectedPluginsFromCoreInstance($emptyInstance){
+ $detected = $emptyInstance->getDetectedPlugins();
+ $this->detectedPlugins = [];
+ $this->streamWrapperPlugins = $emptyInstance->streamWrapperPlugins;
+ foreach($detected as $type => $plugins){
+ $this->detectedPlugins[$type] = [];
+ foreach($plugins as $name => $plugin){
+ $this->detectedPlugins[$type][$name] = clone $plugin;
+ }
+ }
+ }
+
/*********************************/
/* PUBLIC: WRAPPERS METHODS */
/*********************************/

0 comments on commit 1e6cc40

Please sign in to comment.