generated from yiisoft/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add opcache inspector controller (#147)
* Add opcache page * Check if opcache is enabled * Skip optional dependency * Fix return value * Fix return value * Skip optional dependency * Check if class exists * Suppress psalm * Fix psalm
- Loading branch information
Showing
6 changed files
with
71 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Yii\Debug\Api\Inspector\Controller; | ||
|
||
use Psr\Http\Message\ResponseInterface; | ||
use Yiisoft\DataResponse\DataResponseFactoryInterface; | ||
use Yiisoft\Http\Status; | ||
|
||
final class OpcacheController | ||
{ | ||
public function __construct( | ||
private DataResponseFactoryInterface $responseFactory, | ||
) { | ||
} | ||
|
||
public function index(): ResponseInterface | ||
{ | ||
if (!\function_exists('opcache_get_status') || ($status = \opcache_get_status(true)) === false) { | ||
return $this->responseFactory->createResponse([ | ||
'message' => 'OPcache is not installed or configured', | ||
], Status::UNPROCESSABLE_ENTITY); | ||
} | ||
|
||
return $this->responseFactory->createResponse([ | ||
'status' => $status, | ||
'configuration' => \opcache_get_configuration(), | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters