Skip to content

Commit 494a873

Browse files
committed
Fix extensions checking
1 parent 193aa48 commit 494a873

7 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/Admin.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ class Admin {
3030
*/
3131
public function __construct(?Template $template = null) {
3232
foreach (Config::get('dashboards') as $class) {
33-
$dashboard = new $class($template);
34-
35-
if ($dashboard instanceof DashboardInterface && $dashboard->check()) {
33+
if (is_subclass_of($class, DashboardInterface::class) && $class::check()) {
34+
$dashboard = new $class($template);
3635
$info = $dashboard->getDashboardInfo();
3736
$this->dashboards[$info['key']] = $dashboard;
3837
}

src/Dashboards/APCu/APCuDashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(Template $template) {
3030
*
3131
* @return bool
3232
*/
33-
public function check(): bool {
33+
public static function check(): bool {
3434
return extension_loaded('apcu');
3535
}
3636

src/Dashboards/DashboardInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface DashboardInterface {
1818
*
1919
* @return bool
2020
*/
21-
public function check(): bool;
21+
public static function check(): bool;
2222

2323
/**
2424
* Get dashboard info.

src/Dashboards/Memcached/MemcachedDashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(Template $template) {
3838
*
3939
* @return bool
4040
*/
41-
public function check(): bool {
41+
public static function check(): bool {
4242
return extension_loaded('memcache') || extension_loaded('memcached');
4343
}
4444

src/Dashboards/OPCache/OPCacheDashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(Template $template) {
3131
*
3232
* @return bool
3333
*/
34-
public function check(): bool {
34+
public static function check(): bool {
3535
return extension_loaded('Zend OPcache');
3636
}
3737

src/Dashboards/Redis/RedisDashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(Template $template) {
4343
*
4444
* @return bool
4545
*/
46-
public function check(): bool {
46+
public static function check(): bool {
4747
return extension_loaded('redis');
4848
}
4949

src/Dashboards/Server/ServerDashboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(Template $template) {
3030
*
3131
* @return bool
3232
*/
33-
public function check(): bool {
33+
public static function check(): bool {
3434
return true; // No extension required, just return true.
3535
}
3636

0 commit comments

Comments
 (0)