diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index d3860fbd3..4016f8245 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -146,6 +146,10 @@ class Settings { /* {{{ */ var $_showSingleSearchHit = true; // enable/disable use of memcached var $_enableMemcached = false; + // memcached host + var $_memcachedHost = 'localhost'; + // memcached port + var $_memcachedPort = '11211'; // contentOffsetDirTo var $_contentOffsetDir = "1048576"; // Maximum number of sub-directories per parent directory @@ -653,6 +657,8 @@ class Settings { /* {{{ */ $this->_maxUploadSize = strval($tab["maxUploadSize"]); $this->_enableXsendfile = Settings::boolVal($tab["enableXsendfile"]); $this->_enableMemcached = Settings::boolVal($tab["enableMemcached"]); + $this->_memcachedHost = strval($tab["memcachedHost"]); + $this->_memcachedPort = strval($tab["memcachedPort"]); } // XML Path: /configuration/system/authentication @@ -1055,6 +1061,8 @@ class Settings { /* {{{ */ $this->setXMLAttributValue($node, "maxUploadSize", $this->_maxUploadSize); $this->setXMLAttributValue($node, "enableXsendfile", $this->_enableXsendfile); $this->setXMLAttributValue($node, "enableMemcached", $this->_enableMemcached); + $this->setXMLAttributValue($node, "memcachedHost", $this->_memcachedHost); + $this->setXMLAttributValue($node, "memcachedPort", $this->_memcachedPort); // XML Path: /configuration/system/authentication $node = $this->getXMLNode($xml, '/configuration/system', 'authentication'); diff --git a/inc/inc.DBInit.php b/inc/inc.DBInit.php index 5c5f41bba..6220261da 100644 --- a/inc/inc.DBInit.php +++ b/inc/inc.DBInit.php @@ -59,7 +59,7 @@ $dms = new SeedDMS_Core_DMS($db, $storage ? $storage : $settings->_contentDir.$s if($settings->_enableMemcached && extension_loaded('memcached')) { $memcache = new Memcached('seeddms'); $memcache->addServers(array( - array('localhost',11211), + array($settings->_memcachedHost ?? 'localhost', $settings->_memcachedPort ?? 11211), )); $dms->setMemcache($memcache); } diff --git a/op/op.Settings.php b/op/op.Settings.php index a2661b858..9bdf58051 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -189,6 +189,8 @@ if ($action == "saveSettings") setStrValue("maxUploadSize"); // TODO: check if valid value, e.g. 1M or 5K setBoolValue("enableXsendfile"); setBoolValue("enableMemcached"); + setStrValue("memcachedHost"); + setStrValue("memcachedPort"); // SETTINGS - SYSTEM - AUTHENTICATION setBoolValue("enableGuestLogin"); diff --git a/views/bootstrap/class.Settings.php b/views/bootstrap/class.Settings.php index af73f2ef4..6e46f57de 100644 --- a/views/bootstrap/class.Settings.php +++ b/views/bootstrap/class.Settings.php @@ -755,6 +755,8 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk)) showConfigText('settings_maxUploadSize', 'maxUploadSize'); ?> showConfigCheckbox('settings_enableXsendfile', 'enableXsendfile'); ?> showConfigCheckbox('settings_enableMemcached', 'enableMemcached'); ?> +showConfigText('settings_memcachedHost', 'memcachedHost', '', 'localhost'); ?> +showConfigText('settings_memcachedPort', 'memcachedPort', '', '11211'); ?>