Skip to content

Commit

Permalink
opcache status
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-ivona committed Dec 15, 2023
1 parent c61873d commit 3a0bc55
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
45 changes: 45 additions & 0 deletions app/Recipes/Laravel/Commands/OpcacheStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php


namespace App\Recipes\Laravel\Commands;


use App\Exceptions\DockerServiceNotFoundException;
use App\Services\DockerService;
use App\Services\TerminalService;
use Illuminate\Contracts\Container\BindingResolutionException;
use LaravelZero\Framework\Commands\Command;

class OpcacheStatus extends Command{
protected $signature = 'opcache:status
{--scripts} : show scripts cache status';

protected $description = 'Show OpCache status';

/**
* @param DockerService $docker_service
* @param TerminalService $terminal
* @return int
* @throws DockerServiceNotFoundException
* @throws BindingResolutionException
*/
public function handle(DockerService $docker_service, TerminalService $terminal){

$terminal->init($this->output);


if($this->option('scripts')){
return $docker_service->service('php')->execute($terminal, [
"php",
"/usr/bin/cachetool.phar",
"opcache:status:scripts",
]);
}

return $docker_service->service('php')->execute($terminal, [
"php",
"/usr/bin/cachetool.phar",
"opcache:status",
]);
}
}
2 changes: 2 additions & 0 deletions app/Recipes/Laravel/LaravelRecipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use App\Recipes\Laravel\Commands\Migrate;
use App\Recipes\Laravel\Commands\Deploy;
use App\Recipes\Laravel\Commands\OpcacheReset;
use App\Recipes\Laravel\Commands\OpcacheStatus;
use App\Recipes\Laravel\Commands\Pest;
use App\Recipes\Laravel\Commands\PestCoverage;
use App\Recipes\Laravel\Commands\PhpCs;
Expand Down Expand Up @@ -205,6 +206,7 @@ protected function recipe_commands(): array

if (env('ENABLE_OPCACHE')) {
$commands[] = OpcacheReset::class;
$commands[] = OpcacheStatus::class;
}

return $commands;
Expand Down

0 comments on commit 3a0bc55

Please sign in to comment.