Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use Illuminate\Console\Command;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Input\InputArgument;
- class CleanDirs extends Command {
- protected $name = 'cleandirs';
- protected $description = 'Cleans directories.';
- public function __construct()
- {
- parent::__construct();
- }
- public function fire()
- {
- $now = time();
- foreach(File::directories('public/uploads/temp') as $dir ){
- $dirtime = filemtime($dir);
- if( $now-$dirtime > 3600){
- File::deleteDirectory($dir);
- $this->info('Directory '.$dir.' was deleted');
- }
- }
- }
- protected function getArguments()
- {
- return array(
- array('example', InputArgument::OPTIONAL, 'An example argument.'),
- );
- }
- protected function getOptions()
- {
- return array(
- array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement