Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache by direct url without php #26

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/actions/GlideAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class GlideAction extends Action
*/
public function run($path)
{
unset($_GET['path']);
$server = $this->getServer();

if (!$server->sourceFileExists($path)) {
Expand Down
20 changes: 14 additions & 6 deletions src/components/Glide.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ class Glide extends Component
* @var string
*/
public $cachePathPrefix;
/**
* @var bool
*/
public $groupCacheInFolders = true;
/**
* Whether to cache with file extensions.
* @var bool
*/
public $cacheWithFileExtensions = false;
/**
* @var string
*/
Expand All @@ -88,10 +97,6 @@ class Glide extends Component
* @var string
*/
public $urlManager = 'urlManager';
/**
* @var bool
*/
public $groupCacheInFolders = true;
/**
* @var ResponseFactoryInterface|null
*/
Expand Down Expand Up @@ -184,6 +189,7 @@ public function getServer()
$server->setSourcePathPrefix($this->sourcePathPrefix);
$server->setCachePathPrefix($this->cachePathPrefix);
$server->setGroupCacheInFolders($this->groupCacheInFolders);
$server->setCacheWithFileExtensions($this->cacheWithFileExtensions);
$server->setDefaults($this->defaults);
$server->setPresets($this->presets);
$server->setBaseUrl($this->baseUrl);
Expand Down Expand Up @@ -304,8 +310,11 @@ public function setWatermarks(FilesystemInterface $watermarks)
*/
public function createSignedUrl(array $params, $scheme = false)
{
$route = ArrayHelper::getValue($params, 0);
$path = ArrayHelper::remove($params, 'path');
$route = ArrayHelper::remove($params, 0);
$params['path'] = $this->getServer()->getCachePath($path, $params);
if ($this->getUrlManager()->enablePrettyUrl) {
$params[0]=$route;
$showScriptName = $this->getUrlManager()->showScriptName;
if ($showScriptName) {
$this->getUrlManager()->showScriptName = false;
Expand All @@ -317,7 +326,6 @@ public function createSignedUrl(array $params, $scheme = false)
$urlParams = (array) (new QueryParser)->parse($uri->getQuery());
} else {
$path = '/index.php';
$route = array_shift($params);
$urlParams = $params;
$urlParams['r'] = $route;
}
Expand Down