예제 #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $uri = $this->argument('uri');
     $result = \Ngxcache::purge($uri, true);
     if ($result->success) {
         $this->info('0. ' . $result->cache);
         $this->info('Cache has been hit.');
     } else {
         $this->error('0. ' . $result->cache);
         $this->error('No such cached file.');
     }
 }
예제 #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $result = \Ngxcache::items();
     if ($result->count == 0) {
         $this->comment('Cache directory is empty.');
     } else {
         foreach ($result->files as $key => $value) {
             $this->info($key . '. ' . \Ngxcache::backtrace($value));
         }
         $this->info('Caches has been hit.');
     }
 }
예제 #3
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $uri = $this->argument('uri');
     $result = \Ngxcache::purge($uri);
     if ($result->success) {
         $this->info('0. ' . $result->cache);
         if ($result->config->debug) {
             $this->info('(Debug Mode) Cache has been hit.');
         } else {
             $this->info('Cache has been removed.');
         }
     } else {
         $this->error('0. ' . $result->cache);
         $this->error('No such cached file.');
     }
 }
예제 #4
0
 /**
  * Execute the console command.
  *
  */
 public function fire()
 {
     $result = \Ngxcache::purgeall();
     if ($result->count == 0) {
         $this->comment('Cache directory is empty.');
     } else {
         if ($result->success) {
             foreach ($result->files as $key => $value) {
                 $this->info($key . '. ' . $value);
             }
             if ($result->config->debug) {
                 $this->info('(Debug Mode) Caches has been hit.');
             } else {
                 $this->info('Caches has been removed.');
             }
         } else {
             $this->error('Was not possible to empty the cache directory.');
         }
     }
 }
예제 #5
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire($overwrite = false)
 {
     $uri = $this->argument('uri');
     $result = \Ngxcache::rebuild($uri, $overwrite);
     if ($result->success) {
         $this->info('Rebuilding of the cache has been completed.');
         $this->info('0. ' . $result->cache);
     } else {
         if ($result->status == 'exist') {
             $this->error('Cache has been exist.');
             $this->error('0. ' . $result->cache);
             echo PHP_EOL;
             if ($this->confirm('Do you want to rebuild by deleting the cache ? [y/N]', false)) {
                 \Ngxcache::purge($uri);
                 $this->fire(true);
             }
         } else {
             $this->error('Writing error.');
         }
     }
 }
예제 #6
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     echo PHP_EOL;
     $this->error('Warning!');
     if ($this->confirm('Do you want to rebuild by deleting the cache of all ? [y/N]', false)) {
         echo PHP_EOL;
         $this->comment('Display port number depends on the setting of the nginx.');
         $info = \Ngxcache::items();
         foreach ($info->files as $key => $file) {
             $current = \Ngxcache::backtrace($file);
             if ($current) {
                 $this->info('cached. => ' . $current);
                 $rebuild = \Ngxcache::rebuild($current, true);
                 if ($rebuild->success) {
                     $this->info($key . '. ' . $rebuild->cache);
                 } else {
                     $this->error('Writing error.');
                 }
             } else {
                 $this->error("Source uri is unknown.");
             }
         }
     }
 }