Skip to content

Commit

Permalink
fix: try to load all the classes we need if query monitor is active
Browse files Browse the repository at this point in the history
  • Loading branch information
carlalexander committed Sep 18, 2021
1 parent 30861a9 commit 78ffa11
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/Configuration/QueryMonitorConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public function modify(Container $container)

if ($isActive) {
require_once WP_CONTENT_DIR.'/plugins/query-monitor/classes/Collector.php';
require_once WP_CONTENT_DIR.'/plugins/query-monitor/classes/Collectors.php';
require_once WP_CONTENT_DIR.'/plugins/query-monitor/output/Html.php';
}

return $isActive;
Expand Down
8 changes: 0 additions & 8 deletions src/Subscriber/QueryMonitorSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ public static function getSubscribedEvents(): array
*/
public function addCollectors()
{
if (!is_plugin_active('query-monitor/query-monitor.php') || !class_exists(\QM_Collector::class)) {
return;
}

foreach ($this->collectors as $collector) {
\QM_Collectors::add($collector);
}
Expand All @@ -83,10 +79,6 @@ public function addCollectors()
*/
public function addPanels(array $panels, \QM_Collectors $collectors): array
{
if (!class_exists(\QM_Output_Html::class)) {
return $panels;
}

$this->panels = array_map(function (string $panel) use ($collectors) {
return $panel::createFromCollectors($collectors, $this->viewsDirectory);
}, $this->panels);
Expand Down

0 comments on commit 78ffa11

Please sign in to comment.