Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Speed up second registry startup by cloning detectedPlugins from empt…
Browse files Browse the repository at this point in the history
…y instance.
  • Loading branch information
cdujeu committed Jun 17, 2016
1 parent 362f7f8 commit 1e6cc40
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion core/src/core/src/pydio/Core/PluginFramework/PluginsService.php
Expand Up @@ -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");
Expand Down Expand Up @@ -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 */
/*********************************/
Expand Down

0 comments on commit 1e6cc40

Please sign in to comment.