mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/16223] Use constructor arguments instead of func_get_args()
PHPBB3-16223
This commit is contained in:
parent
bc045fd19b
commit
380b7d0a98
2 changed files with 5 additions and 10 deletions
13
phpBB/phpbb/cache/driver/memcached.php
vendored
13
phpBB/phpbb/cache/driver/memcached.php
vendored
|
@ -50,20 +50,15 @@ class memcached extends \phpbb\cache\driver\memory
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memcached constructor
|
* Memcached constructor
|
||||||
|
*
|
||||||
|
* @param string $memcached_servers Memcached servers string (optional)
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct($memcached_servers = '')
|
||||||
{
|
{
|
||||||
// Call the parent constructor
|
// Call the parent constructor
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$memcached_servers = PHPBB_ACM_MEMCACHED;
|
$memcached_servers = $memcached_servers ?: PHPBB_ACM_MEMCACHED;
|
||||||
|
|
||||||
// Allow overwriting PHPBB_ACM_MEMCACHED via constructor arguments
|
|
||||||
$args = func_get_args();
|
|
||||||
if (count($args) >= 2)
|
|
||||||
{
|
|
||||||
$memcached_servers = $args[0] . '/' . $args[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->memcached = new \Memcached();
|
$this->memcached = new \Memcached();
|
||||||
$this->memcached->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
|
$this->memcached->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
|
||||||
|
|
2
tests/cache/memcached_test.php
vendored
2
tests/cache/memcached_test.php
vendored
|
@ -59,7 +59,7 @@ class phpbb_cache_memcached_driver_test extends \phpbb_cache_common_test_case
|
||||||
|
|
||||||
$phpbb_container = new phpbb_mock_container_builder();
|
$phpbb_container = new phpbb_mock_container_builder();
|
||||||
$phpbb_container->setParameter('core.cache_dir', $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/');
|
$phpbb_container->setParameter('core.cache_dir', $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/');
|
||||||
$this->driver = new \phpbb\cache\driver\memcached(self::$config['host'], self::$config['port']);
|
$this->driver = new \phpbb\cache\driver\memcached(self::$config['host'] . '/' . self::$config['port']);
|
||||||
$this->driver->purge();
|
$this->driver->purge();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue