@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | * Calculate the security key |
| 41 | 41 | */ |
| 42 | 42 | { |
| 43 | - $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : ''; |
|
| 43 | + $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : ''; |
|
| 44 | 44 | if (!$securityKey || $securityKey === 'auto') { |
| 45 | - if (isset($_SERVER[ 'HTTP_HOST' ])) { |
|
| 46 | - $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ]))); |
|
| 45 | + if (isset($_SERVER['HTTP_HOST'])) { |
|
| 46 | + $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST']))); |
|
| 47 | 47 | } else { |
| 48 | 48 | $securityKey = ($this->isPHPModule() ? 'web' : 'cli'); |
| 49 | 49 | } |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | * with the security key and the driver name |
| 59 | 59 | */ |
| 60 | 60 | $tmp_dir = rtrim($tmp_dir, '/') . DIRECTORY_SEPARATOR; |
| 61 | - if (empty($this->config[ 'path' ]) || !is_string($this->config[ 'path' ])) { |
|
| 61 | + if (empty($this->config['path']) || !is_string($this->config['path'])) { |
|
| 62 | 62 | $path = $tmp_dir; |
| 63 | 63 | } else { |
| 64 | - $path = rtrim($this->config[ 'path' ], '/') . DIRECTORY_SEPARATOR; |
|
| 64 | + $path = rtrim($this->config['path'], '/') . DIRECTORY_SEPARATOR; |
|
| 65 | 65 | } |
| 66 | 66 | $path_suffix = $securityKey . DIRECTORY_SEPARATOR . $this->getDriverName(); |
| 67 | 67 | $full_path = Directory::getAbsolutePath($path . $path_suffix); |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | * return the temp dir |
| 75 | 75 | */ |
| 76 | 76 | if ($readonly === true) { |
| 77 | - if(!@file_exists($full_path) || !@is_writable($full_path)){ |
|
| 77 | + if (!@file_exists($full_path) || !@is_writable($full_path)) { |
|
| 78 | 78 | return $full_path_tmp; |
| 79 | 79 | } |
| 80 | 80 | return $full_path; |
| 81 | - }else{ |
|
| 82 | - if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) { |
|
| 81 | + } else { |
|
| 82 | + if (!isset($this->tmp[$full_path_hash]) || (!@file_exists($full_path) || !@is_writable($full_path))) { |
|
| 83 | 83 | if (!@file_exists($full_path)) { |
| 84 | 84 | @mkdir($full_path, $this->setChmodAuto(), true); |
| 85 | 85 | } elseif (!@is_writable($full_path)) { |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - $this->tmp[ $full_path_hash ] = $full_path; |
|
| 103 | - $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false); |
|
| 102 | + $this->tmp[$full_path_hash] = $full_path; |
|
| 103 | + $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false); |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | return realpath($full_path); |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function setChmodAuto() |
| 176 | 176 | { |
| 177 | - if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) { |
|
| 177 | + if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) { |
|
| 178 | 178 | return 0777; |
| 179 | 179 | } else { |
| 180 | - return $this->config[ 'default_chmod' ]; |
|
| 180 | + return $this->config['default_chmod']; |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | if ($create === true) { |
| 208 | 208 | if (!is_writable($path)) { |
| 209 | 209 | try { |
| 210 | - if(!chmod($path, 0777)){ |
|
| 210 | + if (!chmod($path, 0777)) { |
|
| 211 | 211 | throw new phpFastCacheDriverException('Chmod failed on : ' . $path); |
| 212 | 212 | } |
| 213 | 213 | } catch (phpFastCacheDriverException $e) { |
@@ -78,11 +78,11 @@ |
||
| 78 | 78 | return $full_path_tmp; |
| 79 | 79 | } |
| 80 | 80 | return $full_path; |
| 81 | - }else{ |
|
| 81 | + } else{ |
|
| 82 | 82 | if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) { |
| 83 | 83 | if (!@file_exists($full_path)) { |
| 84 | 84 | @mkdir($full_path, $this->setChmodAuto(), true); |
| 85 | - }elseif (!@is_writable($full_path)) { |
|
| 85 | + } elseif (!@is_writable($full_path)) { |
|
| 86 | 86 | if (!@chmod($full_path, $this->setChmodAuto())) |
| 87 | 87 | { |
| 88 | 88 | /** |