Skip to content

Commit

Permalink
add OpcacheClearCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
summerblue committed Mar 3, 2015
1 parent a58c0ce commit a629513
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
53 changes: 53 additions & 0 deletions app/commands/OpcacheClearCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;

class OpcacheClearCommand extends Command {

/**
* The console command name.
*
* @var string
*/
protected $name = 'opcache:clear';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Clear PHP Opcode Cache.';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
if (function_exists('opcache_reset'))
{
opcache_reset();
$this->info("Done Clear PHP Opcode Cache, have a good day.");
}
else
{
$this->info("You haven't install PHP Opcode Cache yet, no need to run this command!");
}



}
}
1 change: 1 addition & 0 deletions app/start/artisan.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

// Backing up database
Artisan::add(new DatabaseBackupCommand);
Artisan::add(new OpcacheClearCommand);

0 comments on commit a629513

Please sign in to comment.