/** * 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.'); } } }
/** * 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."); } } } }