mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-04 05:25:01 +02:00
[ticket/11768] Removed the cached renderer
We don't need to cache an instance of the renderer, we can just instantiate it every time we need one. PHPBB3-11768
This commit is contained in:
parent
6cb3fb6140
commit
d37f2d10f0
@ -314,13 +314,8 @@ class factory implements \phpbb\textformatter\cache
|
||||
// Cache the parser as-is
|
||||
$this->cache->put($this->cache_key_parser, $parser);
|
||||
|
||||
// We need to cache the name of the renderer's generated class so that we can load the class
|
||||
// before the renderer is unserialized. That's why we save them together, with the renderer
|
||||
// in serialized form
|
||||
$renderer_data = array(
|
||||
'class' => get_class($renderer),
|
||||
'renderer' => serialize($renderer)
|
||||
);
|
||||
// We need to cache the name of the renderer's generated class
|
||||
$renderer_data = array('class' => get_class($renderer));
|
||||
if (isset($censor))
|
||||
{
|
||||
$renderer_data['censor'] = $censor;
|
||||
|
@ -77,7 +77,7 @@ class renderer extends \phpbb\textformatter\renderer
|
||||
|
||||
if (class_exists($class, false))
|
||||
{
|
||||
$renderer = unserialize($renderer_data['renderer']);
|
||||
$renderer = new $class;
|
||||
}
|
||||
|
||||
if (isset($renderer_data['censor']))
|
||||
|
@ -94,7 +94,6 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
|
||||
$renderer_data = $this->cache->get('_foo_renderer');
|
||||
$this->assertEquals($parser, $this->cache->get('_foo_parser'), 'The parser was not cached');
|
||||
$this->assertEquals(get_class($renderer), $renderer_data['class']);
|
||||
$this->assertEquals(serialize($renderer), $renderer_data['renderer']);
|
||||
$this->assertInstanceOf('s9e\\TextFormatter\\Plugins\\Censor\\Helper', $renderer_data['censor']);
|
||||
|
||||
$file = $this->get_cache_dir() . get_class($renderer) . '.php';
|
||||
|
@ -34,7 +34,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case
|
||||
$cache->expects($this->once())
|
||||
->method('get')
|
||||
->with('_foo_renderer')
|
||||
->will($this->returnValue(array('class' => 'renderer_foo', 'renderer' => serialize($mock))));
|
||||
->will($this->returnValue(array('class' => 'renderer_foo')));
|
||||
|
||||
$factory = $this->getMockBuilder('phpbb\\textformatter\\s9e\\factory')
|
||||
->disableOriginalConstructor()
|
||||
|
Loading…
x
Reference in New Issue
Block a user