memcached port and host can be configured

This commit is contained in:
Uwe Steinmann 2025-10-02 09:17:42 +02:00
parent 8b80df9519
commit 81fc17a812
4 changed files with 13 additions and 1 deletions

View File

@ -146,6 +146,10 @@ class Settings { /* {{{ */
var $_showSingleSearchHit = true; var $_showSingleSearchHit = true;
// enable/disable use of memcached // enable/disable use of memcached
var $_enableMemcached = false; var $_enableMemcached = false;
// memcached host
var $_memcachedHost = 'localhost';
// memcached port
var $_memcachedPort = '11211';
// contentOffsetDirTo // contentOffsetDirTo
var $_contentOffsetDir = "1048576"; var $_contentOffsetDir = "1048576";
// Maximum number of sub-directories per parent directory // Maximum number of sub-directories per parent directory
@ -653,6 +657,8 @@ class Settings { /* {{{ */
$this->_maxUploadSize = strval($tab["maxUploadSize"]); $this->_maxUploadSize = strval($tab["maxUploadSize"]);
$this->_enableXsendfile = Settings::boolVal($tab["enableXsendfile"]); $this->_enableXsendfile = Settings::boolVal($tab["enableXsendfile"]);
$this->_enableMemcached = Settings::boolVal($tab["enableMemcached"]); $this->_enableMemcached = Settings::boolVal($tab["enableMemcached"]);
$this->_memcachedHost = strval($tab["memcachedHost"]);
$this->_memcachedPort = strval($tab["memcachedPort"]);
} }
// XML Path: /configuration/system/authentication // XML Path: /configuration/system/authentication
@ -1055,6 +1061,8 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "maxUploadSize", $this->_maxUploadSize); $this->setXMLAttributValue($node, "maxUploadSize", $this->_maxUploadSize);
$this->setXMLAttributValue($node, "enableXsendfile", $this->_enableXsendfile); $this->setXMLAttributValue($node, "enableXsendfile", $this->_enableXsendfile);
$this->setXMLAttributValue($node, "enableMemcached", $this->_enableMemcached); $this->setXMLAttributValue($node, "enableMemcached", $this->_enableMemcached);
$this->setXMLAttributValue($node, "memcachedHost", $this->_memcachedHost);
$this->setXMLAttributValue($node, "memcachedPort", $this->_memcachedPort);
// XML Path: /configuration/system/authentication // XML Path: /configuration/system/authentication
$node = $this->getXMLNode($xml, '/configuration/system', 'authentication'); $node = $this->getXMLNode($xml, '/configuration/system', 'authentication');

View File

@ -59,7 +59,7 @@ $dms = new SeedDMS_Core_DMS($db, $storage ? $storage : $settings->_contentDir.$s
if($settings->_enableMemcached && extension_loaded('memcached')) { if($settings->_enableMemcached && extension_loaded('memcached')) {
$memcache = new Memcached('seeddms'); $memcache = new Memcached('seeddms');
$memcache->addServers(array( $memcache->addServers(array(
array('localhost',11211), array($settings->_memcachedHost ?? 'localhost', $settings->_memcachedPort ?? 11211),
)); ));
$dms->setMemcache($memcache); $dms->setMemcache($memcache);
} }

View File

@ -189,6 +189,8 @@ if ($action == "saveSettings")
setStrValue("maxUploadSize"); // TODO: check if valid value, e.g. 1M or 5K setStrValue("maxUploadSize"); // TODO: check if valid value, e.g. 1M or 5K
setBoolValue("enableXsendfile"); setBoolValue("enableXsendfile");
setBoolValue("enableMemcached"); setBoolValue("enableMemcached");
setStrValue("memcachedHost");
setStrValue("memcachedPort");
// SETTINGS - SYSTEM - AUTHENTICATION // SETTINGS - SYSTEM - AUTHENTICATION
setBoolValue("enableGuestLogin"); setBoolValue("enableGuestLogin");

View File

@ -755,6 +755,8 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
<?php $this->showConfigText('settings_maxUploadSize', 'maxUploadSize'); ?> <?php $this->showConfigText('settings_maxUploadSize', 'maxUploadSize'); ?>
<?php $this->showConfigCheckbox('settings_enableXsendfile', 'enableXsendfile'); ?> <?php $this->showConfigCheckbox('settings_enableXsendfile', 'enableXsendfile'); ?>
<?php $this->showConfigCheckbox('settings_enableMemcached', 'enableMemcached'); ?> <?php $this->showConfigCheckbox('settings_enableMemcached', 'enableMemcached'); ?>
<?php $this->showConfigText('settings_memcachedHost', 'memcachedHost', '', 'localhost'); ?>
<?php $this->showConfigText('settings_memcachedPort', 'memcachedPort', '', '11211'); ?>
<!-- <!--
-- SETTINGS - SYSTEM - AUTHENTICATION -- SETTINGS - SYSTEM - AUTHENTICATION
--> -->