From 017fd680580e2d283977cb3bded65a25e2334708 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Fri, 19 Oct 2012 09:34:26 -0400 Subject: [PATCH] Changed statistics driver plugin manager to return non-shared instances; eliminated explicit cloning. --- .../VuFind/src/VuFind/Statistics/AbstractBase.php | 2 +- .../VuFind/Statistics/Driver/PluginManager.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/module/VuFind/src/VuFind/Statistics/AbstractBase.php b/module/VuFind/src/VuFind/Statistics/AbstractBase.php index db3f5b68a93..d157f456a05 100644 --- a/module/VuFind/src/VuFind/Statistics/AbstractBase.php +++ b/module/VuFind/src/VuFind/Statistics/AbstractBase.php @@ -140,7 +140,7 @@ abstract class AbstractBase implements ServiceLocatorAwareInterface // If we got this far, we want the current option! Build the driver: $loader = $this->getServiceLocator() ->get('StatisticsDriverPluginManager'); - $newDriver = clone($loader->get($setting[0])); + $newDriver = $loader->get($setting[0]); // Set the name of the data source; we use the special value // "global" to represent global writer requests (the special null diff --git a/module/VuFind/src/VuFind/Statistics/Driver/PluginManager.php b/module/VuFind/src/VuFind/Statistics/Driver/PluginManager.php index 123a583046f..853b3ddec04 100644 --- a/module/VuFind/src/VuFind/Statistics/Driver/PluginManager.php +++ b/module/VuFind/src/VuFind/Statistics/Driver/PluginManager.php @@ -38,6 +38,21 @@ namespace VuFind\Statistics\Driver; */ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager { + /** + * Constructor + * + * @param null|ConfigInterface $configuration Configuration settings (optional) + */ + public function __construct( + \Zend\ServiceManager\ConfigInterface $configuration = null + ) { + parent::__construct($configuration); + + // Stats drivers are not meant to be shared -- every time we retrieve one, + // we are building a brand new object. + $this->setShareByDefault(false); + } + /** * Return the name of the base class or interface that plug-ins must conform * to. -- GitLab