Skip to content

Instantly share code, notes, and snippets.

@alpharder
Last active August 29, 2015 14:27
Show Gist options
  • Save alpharder/9aeefc37169627ff9ccf to your computer and use it in GitHub Desktop.
Save alpharder/9aeefc37169627ff9ccf to your computer and use it in GitHub Desktop.
diff --git a/app/Tygh/Backend/Storage/File.php b/app/Tygh/Backend/Storage/File.php
index 70d4a0d..be3910f 100644
--- a/app/Tygh/Backend/Storage/File.php
+++ b/app/Tygh/Backend/Storage/File.php
@@ -124,7 +124,9 @@ class File extends ABackend
return $file;
}
- if ($this->getOption('cdn') && Cdn::instance()->getOption('is_enabled')) {
+ $is_cdn = ($this->getOption('cdn') && Cdn::instance()->getOption('is_enabled'));
+
+ if ($is_cdn) {
if ($protocol == 'http') {
$prefix = 'http:';
} elseif ($protocol == 'https') {
@@ -149,9 +151,11 @@ class File extends ABackend
}
}
- $real_file = $this->getAbsolutePath($file);
- if (is_file($real_file)) { // add timestamp to files only, skip dirs
- $file .= '?t=' . filemtime($real_file);
+ if ($is_cdn) {
+ $real_file = $this->getAbsolutePath($file);
+ if (is_file($real_file)) { // add timestamp to files only, skip dirs
+ $file .= '?t=' . filemtime($real_file);
+ }
}
$path = str_replace(Registry::get('config.dir.root'), '', $this->prefix($file));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment