Skip to content
Snippets Groups Projects
Commit 8b941a80 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by David Siegfried
Browse files

cache administration: prepopulate memcached settings and fix message upon...

Closes #1536 and #1124

Merge request studip/studip!962
parent b855a45f
No related branches found
No related tags found
No related merge requests found
...@@ -112,8 +112,6 @@ class Admin_CacheController extends AuthenticatedController ...@@ -112,8 +112,6 @@ class Admin_CacheController extends AuthenticatedController
if (Config::get()->store('SYSTEMCACHE', $settings)) { if (Config::get()->store('SYSTEMCACHE', $settings)) {
PageLayout::postSuccess(_('Die Einstellungen wurden gespeichert.')); PageLayout::postSuccess(_('Die Einstellungen wurden gespeichert.'));
StudipCacheFactory::unconfigure(); StudipCacheFactory::unconfigure();
} else {
PageLayout::postError(_('Die Einstellungen konnten nicht gespeichert werden.'));
} }
$this->relocate('admin/cache/settings'); $this->relocate('admin/cache/settings');
......
...@@ -46,7 +46,7 @@ class StudipMemcachedCache implements StudipSystemCache ...@@ -46,7 +46,7 @@ class StudipMemcachedCache implements StudipSystemCache
if (count($this->memcache->getServerList()) === 0) { if (count($this->memcache->getServerList()) === 0) {
foreach ($servers as $server) { foreach ($servers as $server) {
$status = $this->memcache->addServer($server['hostname'], $server['port']); $status = $this->memcache->addServer($server['hostname'], (int) $server['port']);
if (!$status) { if (!$status) {
throw new Exception("Could not add server: {$server['hostname']} @ port {$server['port']}"); throw new Exception("Could not add server: {$server['hostname']} @ port {$server['port']}");
......
...@@ -46,13 +46,17 @@ export default { ...@@ -46,13 +46,17 @@ export default {
}, },
methods: { methods: {
addServer () { addServer () {
this.serverConfig.push({ server: '', port: null }) this.serverConfig.push({ hostname: 'localhost', port: 11211 })
}, },
removeServer (event, index) { removeServer (event, index) {
this.serverConfig.splice(index, 1) this.serverConfig.splice(index, 1)
}, },
isValid () { isValid () {
return this.serverConfig.length > 0; return this.serverConfig.length > 0
&& this.serverConfig.every(server => {
return server.hostname.length > 0
&& server.port > 0;
});
} }
}, },
watch: { watch: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment