Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
proxy_instantiator.php
01 <?php
02 /**
03 *
04 * This file is part of the phpBB Forum Software package.
05 *
06 * @copyright (c) phpBB Limited <https://www.phpbb.com>
07 * @license GNU General Public License, version 2 (GPL-2.0)
08 *
09 * For full copyright and license information, please see
10 * the docs/CREDITS.txt file.
11 *
12 */
13
14 namespace phpbb\di;
15
16 use ProxyManager\Configuration;
17 use ProxyManager\Factory\LazyLoadingValueHolderFactory;
18 use ProxyManager\GeneratorStrategy\EvaluatingGeneratorStrategy;
19 use Symfony\Component\DependencyInjection\ContainerInterface;
20 use Symfony\Component\DependencyInjection\Definition;
21 use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\InstantiatorInterface;
22
23 /**
24 * Runtime lazy loading proxy generator extended for allowing use while using
25 * open_basedir restrictions
26 *
27 * Original author: Marco Pivetta <ocramius@gmail.com>
28 */
29 class proxy_instantiator implements InstantiatorInterface
30 {
31 /**
32 * @var LazyLoadingValueHolderFactory
33 */
34 private $factory;
35
36 /**
37 * proxy_instantiator constructor
38 * @param string $cache_dir Cache dir for fall back when using open_basedir
39 */
40 public function __construct($cache_dir)
41 {
42 $config = new Configuration();
43
44 // Prevent trying to write to system temp dir in case of open_basedir
45 // restrictions being in effect
46 $tmp_dir = (function_exists('sys_get_temp_dir')) ? sys_get_temp_dir() : '';
47 if (empty($tmp_dir) || !@file_exists($tmp_dir) || !@is_writable($tmp_dir))
48 {
49 $config->setProxiesTargetDir($cache_dir);
50 }
51 $config->setGeneratorStrategy(new EvaluatingGeneratorStrategy());
52
53 $this->factory = new LazyLoadingValueHolderFactory($config);
54 }
55
56 /**
57 * {@inheritdoc}
58 */
59 public function instantiateProxy(ContainerInterface $container, Definition $definition, $id, $realInstantiator)
60 {
61 return $this->factory->createProxy(
62 $definition->getClass(),
63 function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($realInstantiator) {
64 $wrappedInstance = call_user_func($realInstantiator);
65
66 $proxy->setProxyInitializer(null);
67
68 return true;
69 }
70 );
71 }
72 }
73