@@ -11,8 +11,9 @@ discard block |
||
| 11 | 11 | * @version 2.1 Beta 3 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if (!defined('SMF')) |
|
| 14 | +if (!defined('SMF')) { |
|
| 15 | 15 | die('Hacking attempt...'); |
| 16 | +} |
|
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * Our Cache API class |
@@ -29,8 +30,9 @@ discard block |
||
| 29 | 30 | |
| 30 | 31 | $supported = function_exists('apcu_fetch') && function_exists('apcu_store'); |
| 31 | 32 | |
| 32 | - if ($test) |
|
| 33 | - return $supported; |
|
| 33 | + if ($test) { |
|
| 34 | + return $supported; |
|
| 35 | + } |
|
| 34 | 36 | return parent::isSupported() && $supported; |
| 35 | 37 | } |
| 36 | 38 | |
@@ -52,10 +54,11 @@ discard block |
||
| 52 | 54 | $key = $this->prefix . strtr($key, ':/', '-_'); |
| 53 | 55 | |
| 54 | 56 | // An extended key is needed to counteract a bug in APC. |
| 55 | - if ($value === null) |
|
| 56 | - return apcu_delete($key . 'smf'); |
|
| 57 | - else |
|
| 58 | - return apcu_store($key . 'smf', $value, $ttl); |
|
| 57 | + if ($value === null) { |
|
| 58 | + return apcu_delete($key . 'smf'); |
|
| 59 | + } else { |
|
| 60 | + return apcu_store($key . 'smf', $value, $ttl); |
|
| 61 | + } |
|
| 59 | 62 | } |
| 60 | 63 | |
| 61 | 64 | /** |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | $currentServers = $this->memcached->getServerList(); |
| 55 | 55 | foreach ($servers as $server) |
| 56 | 56 | { |
| 57 | - if (strpos($server,'/') !== false) |
|
| 57 | + if (strpos($server, '/') !== false) |
|
| 58 | 58 | $tempServer = array($server, 0); |
| 59 | 59 | else |
| 60 | 60 | { |
@@ -11,8 +11,9 @@ discard block |
||
| 11 | 11 | * @version 2.1 Beta 3 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if (!defined('SMF')) |
|
| 14 | +if (!defined('SMF')) { |
|
| 15 | 15 | die('Hacking attempt...'); |
| 16 | +} |
|
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * Our Cache API class |
@@ -34,8 +35,9 @@ discard block |
||
| 34 | 35 | |
| 35 | 36 | $supported = class_exists('memcached'); |
| 36 | 37 | |
| 37 | - if ($test) |
|
| 38 | - return $supported; |
|
| 38 | + if ($test) { |
|
| 39 | + return $supported; |
|
| 40 | + } |
|
| 39 | 41 | return parent::isSupported() && $supported && !empty($cache_memcached); |
| 40 | 42 | } |
| 41 | 43 | |
@@ -54,9 +56,9 @@ discard block |
||
| 54 | 56 | $currentServers = $this->memcached->getServerList(); |
| 55 | 57 | foreach ($servers as $server) |
| 56 | 58 | { |
| 57 | - if (strpos($server,'/') !== false) |
|
| 58 | - $tempServer = array($server, 0); |
|
| 59 | - else |
|
| 59 | + if (strpos($server,'/') !== false) { |
|
| 60 | + $tempServer = array($server, 0); |
|
| 61 | + } else |
|
| 60 | 62 | { |
| 61 | 63 | $server = explode(':', $server); |
| 62 | 64 | $tempServer = array($server[0], isset($server[1]) ? $server[1] : 11211); |
@@ -74,8 +76,9 @@ discard block |
||
| 74 | 76 | } |
| 75 | 77 | |
| 76 | 78 | // Found it? |
| 77 | - if (empty($foundServer)) |
|
| 78 | - $this->memcached->addServer($tempServer[0], $tempServer[1]); |
|
| 79 | + if (empty($foundServer)) { |
|
| 80 | + $this->memcached->addServer($tempServer[0], $tempServer[1]); |
|
| 81 | + } |
|
| 79 | 82 | } |
| 80 | 83 | |
| 81 | 84 | // Best guess is this worked. |
@@ -92,8 +95,9 @@ discard block |
||
| 92 | 95 | $value = $this->memcached->get($key); |
| 93 | 96 | |
| 94 | 97 | // $value should return either data or false (from failure, key not found or empty array). |
| 95 | - if ($value === false) |
|
| 96 | - return null; |
|
| 98 | + if ($value === false) { |
|
| 99 | + return null; |
|
| 100 | + } |
|
| 97 | 101 | return $value; |
| 98 | 102 | } |
| 99 | 103 | |
@@ -136,8 +140,9 @@ discard block |
||
| 136 | 140 | $config_vars[] = $txt['cache_memcache_settings']; |
| 137 | 141 | $config_vars[] = array('cache_memcached', $txt['cache_memcache_servers'], 'file', 'text', 0, 'cache_memcached', 'postinput' => '<br /><div class="smalltext"><em>' . $txt['cache_memcache_servers_subtext'] . '</em></div>'); |
| 138 | 142 | |
| 139 | - if (!isset($context['settings_post_javascript'])) |
|
| 140 | - $context['settings_post_javascript'] = ''; |
|
| 143 | + if (!isset($context['settings_post_javascript'])) { |
|
| 144 | + $context['settings_post_javascript'] = ''; |
|
| 145 | + } |
|
| 141 | 146 | |
| 142 | 147 | $context['settings_post_javascript'] .= ' |
| 143 | 148 | $("#cache_accelerator").change(function (e) { |