Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
idmarinas committed Mar 8, 2024
1 parent 4c4c453 commit fe8f048
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/Command/OpcacheClearCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/**
* This file is part of Bundle "IdmCommonBundle".
*
* @see https://github.com/idmarinas/common-bundle/
*
* @license https://github.com/idmarinas/common-bundle/blob/master/LICENSE.txt
*
* @since 2.2.0
*/

namespace Idm\Bundle\Common\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

#[AsCommand(
name: 'idm:opcache:reset',
description: 'Reset OPCache',
)]
class OpcacheClearCommand extends Command
{
protected static $defaultName = 'idm:opcache:reset';

protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

if (opcache_reset()) {
$io->success('OPcache has been reset.');
} else {
$io->error('Failed to reset OPcache.');
}

return Command::SUCCESS;
}
}

0 comments on commit fe8f048

Please sign in to comment.