diff --git a/src/Basset/Asset.php b/src/Basset/Asset.php index 18a21d2..78a4bb6 100644 --- a/src/Basset/Asset.php +++ b/src/Basset/Asset.php @@ -6,6 +6,7 @@ use Basset\Factory\FactoryManager; use Assetic\Filter\FilterInterface; use Illuminate\Filesystem\Filesystem; +use Illuminate\Support\Facades\Config; class Asset extends Filterable { @@ -296,9 +297,11 @@ protected function detectGroupFromContentType() $this->getLogger()->warning('Attempting to determine asset group using cURL. This may have a considerable effect on application speed.'); $handler = curl_init($this->absolutePath); - + + $follow_location = Config::get('basset::follow_location', true); + curl_setopt($handler, CURLOPT_RETURNTRANSFER, true); - curl_setopt($handler, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($handler, CURLOPT_FOLLOWLOCATION, $follow_location); curl_setopt($handler, CURLOPT_HEADER, true); curl_setopt($handler, CURLOPT_NOBODY, true); curl_setopt($handler, CURLOPT_SSL_VERIFYPEER, false); @@ -379,7 +382,7 @@ public function isRaw() */ public function getContent() { - return $this->files->getRemote($this->absolutePath); + return file_get_contents($this->absolutePath); } /** @@ -415,4 +418,4 @@ public function prepareFilters($production = false) return $filters->filter(function($filter) { return $filter instanceof FilterInterface; }); } -} \ No newline at end of file +} diff --git a/src/config/config.php b/src/config/config.php index c8b8373..888c134 100644 --- a/src/config/config.php +++ b/src/config/config.php @@ -91,6 +91,24 @@ 'build_path' => 'builds', + /* + |-------------------------------------------------------------------------- + | Open Base Dir Restrictions + |-------------------------------------------------------------------------- + | + | Some hosts run with open base directory restrictions which prevents certain + | PHP functions from working. Basset relies on Curl's CURLOPT_FOLLOWLOCATION + | to follow location headers when assets don't have recognizable extensions. + | This configuration option lets the developer disable the code that implements + | this known restriction. + | + | Note: that disabling this option could cause redirects on remote assets to + | not be loaded correctly. + | + */ + + 'follow_location' => true, + /* |-------------------------------------------------------------------------- | Debug