public function bcap() { $this->output('Generating bcap file...' . PHP_EOL); $path = \Clips\cache_filename(BCAP_FILENAME); $b = new \phpbrowscap\Browscap(dirname($path)); $b->localFile = $path; $b->lowercase = true; $b->getBrowser(); $this->output("Done!"); }
/** * The command to download browser caps file */ public function bcap() { $this->output("Downloading browser caps file from " . BCAP_URL . PHP_EOL); $path = \Clips\cache_filename(BCAP_FILENAME); if ($path) { $file = $this->downloadmanager->download(BCAP_URL); // Write the file file_put_contents($path, $file); // We already have the browscap cache $b = new \phpbrowscap\Browscap(dirname($path)); $b->localFile = $path; $b->lowercase = true; $this->output("Generating the browser cap cache file.\n"); $b->getBrowser(); $this->output("Done!"); } else { $this->error('Can\'t download browser cap file, since there is no cache directory to download!'); } }