diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/DBStats/API.php | 13 | ||||
-rw-r--r-- | plugins/Dashboard/API.php | 4 | ||||
-rw-r--r-- | plugins/Insights/API.php | 6 | ||||
-rw-r--r-- | plugins/UsersManager/API.php | 6 |
4 files changed, 9 insertions, 20 deletions
diff --git a/plugins/DBStats/API.php b/plugins/DBStats/API.php index 30def6cf79..47417dbc35 100644 --- a/plugins/DBStats/API.php +++ b/plugins/DBStats/API.php @@ -13,12 +13,6 @@ use Piwik\DataTable; use Piwik\Piwik; /** - * - * @see plugins/DBStats/MySQLMetadataProvider.php - */ -require_once PIWIK_INCLUDE_PATH . '/plugins/DBStats/MySQLMetadataProvider.php'; - -/** * DBStats API is used to request the overall status of the Mysql tables in use by Piwik. * @hideExceptForSuperUser * @method static \Piwik\Plugins\DBStats\API getInstance() @@ -30,12 +24,9 @@ class API extends \Piwik\Plugin\API */ private $metadataProvider; - /** - * Constructor. - */ - protected function __construct() + public function __construct(MySQLMetadataProvider $metadataProvider) { - $this->metadataProvider = new MySQLMetadataProvider(); + $this->metadataProvider = $metadataProvider; } /** diff --git a/plugins/Dashboard/API.php b/plugins/Dashboard/API.php index d8994c229e..f4637e862a 100644 --- a/plugins/Dashboard/API.php +++ b/plugins/Dashboard/API.php @@ -19,9 +19,9 @@ class API extends \Piwik\Plugin\API { private $dashboard = null; - protected function __construct() + public function __construct(Dashboard $dashboard) { - $this->dashboard = new Dashboard(); + $this->dashboard = $dashboard; } /** diff --git a/plugins/Insights/API.php b/plugins/Insights/API.php index 20cb649649..4b3228ffc2 100644 --- a/plugins/Insights/API.php +++ b/plugins/Insights/API.php @@ -39,11 +39,9 @@ class API extends \Piwik\Plugin\API */ private $model; - protected function __construct() + public function __construct(Model $model) { - parent::__construct(); - - $this->model = new Model(); + $this->model = $model; } private function getOverviewReports() diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php index b1c7c227e3..ccb4dac126 100644 --- a/plugins/UsersManager/API.php +++ b/plugins/UsersManager/API.php @@ -45,9 +45,9 @@ class API extends \Piwik\Plugin\API private static $instance = null; - protected function __construct() + public function __construct(Model $model) { - $this->model = new Model(); + $this->model = $model; } /** @@ -71,7 +71,7 @@ class API extends \Piwik\Plugin\API self::$instance = $instance; } catch (Exception $e) { - self::$instance = new self; + self::$instance = StaticContainer::get('Piwik\Plugins\UsersManager\API'); StaticContainer::getContainer()->set('UsersManager_API', self::$instance); } |